jwk-lite
isomorphic library to generate, import, and export JSON Web Keys
Last updated a year ago by kevlened .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install jwk-lite 
SYNC missed versions from official npm registry.

jwk-lite

Install

npm install jwk-lite

Usage

const jwk = require('jwk-lite')

jwk.generateKey('HS256')
.then(keys => {
  console.log(keys.sharedKey)
})

jwk.generateKey('PS256')
.then(keys => {
  console.log(keys.publicKey)
  console.log(keys.privateKey)
})

jwk.generateKey('RS256')
.then(keys => {
  console.log(keys.publicKey)
  console.log(keys.privateKey)
})

jwk.generateKey('ES256')
.then(keys => {
  console.log(keys.publicKey)
  console.log(keys.privateKey)
})

jwk.exportKey(key)
.then(jsonJwk => console.log(jsonJwk))

jwk.import(jsonJwk)
.then(key => console.log(key))

Can it be smaller?

If you use ES6 imports with a bundler that supports tree-shaking, yes!

import { generateKey } from 'jwk-lite'

License

MIT

Current Tags

  • 1.1.0                                ...           latest (a year ago)

7 Versions

  • 1.1.0                                ...           a year ago
  • 1.0.0                                ...           a year ago
  • 0.1.3                                ...           a year ago
  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 1
Dependencies (2)
Dev Dependencies (9)

Copyright 2014 - 2017 © taobao.org |