json-web-key

0.4.0 • Public • Published

JSON Web Key

npm npm license npm downloads build status

Install via npm

$ npm install --save json-web-key

Usage

var JSONWebKey = require( 'json-web-key' )
// Constructing a JWK from PEM data
var webKey = JSONWebKey.fromPEM( '-----BEGIN PUBLIC KEY-----\nMIIBIjANB...' )
// Constructing a JWK from JSON data
var webKey = JSONWebKey.fromJSON({
  "kty": "RSA",
  "n": "oL9U7lsMfBGZiFO...",
  "e": "AQAB"
})
// Formatting as JSON
webKey.toJSON() // -> Object
JSON.stringify( webKey ) // -> String

API Reference

Classes

JSONWebKey

JSONWebKey

Kind: global class

new JSONWebKey()

JSONWebKey

JSONWebKey.PEM : Object

Key structures

Kind: static property of JSONWebKey

JSONWebKey.getPEMBuffer(pem) ⇒ Buffer

Parse PEM content into a Buffer

Kind: static method of JSONWebKey

Param Type
pem String | Buffer

JSONWebKey.fromPEM(pem) ⇒ JSONWebKey

Create a JSON Web Key from PEM data

Kind: static method of JSONWebKey

Param Type
pem String | Buffer

JSONWebKey.fromJSON(json) ⇒ JSONWebKey

Create a JSON Web Key from JSON data

Kind: static method of JSONWebKey

Param Type
json Object | String

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.4.0
    670
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.4.0
    670
  • 0.3.0
    64
  • 0.2.0
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i json-web-key

Weekly Downloads

535

Version

0.4.0

License

MIT

Unpacked Size

11.6 kB

Total Files

8

Last publish

Collaborators

  • jhermsmeier