jwk-lite
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i jwk-lite

Weekly Downloads

53

Version

1.1.0

License

MIT

Unpacked Size

9.54 kB

Total Files

6

Last publish

Collaborators

  • kevlened