jwt-wrapper

1.0.0 • Public • Published

jwt-wrapper

this package is a wrapper to jsonwebtoken as promise

Consult node-jsonwebtoken for detailed documentation.

examples

jwt.sign(payload, key, [options])

Sign a token with key, with options defaulting to { algorithm: 'HS256' }.

ES6:

jwt.sign({ username: 'myname' }, 'secret-dev-key').then(console.log)

ES7:

const token = await jwt.sign({ username: 'myname' }, 'secret-dev-key')
console.log(token)

jwt.verify(token, key, [options])

Verify a token, with options defaulting to { algorithm: 'HS256' }.

ES6:

jwt.verify(token, 'secret-dev-key')
  .then(console.log)

ES7:

const token = await jwt.verify({ username: 'fl0w' }, 'secret-dev-key')
console.log(token)

Package Sidebar

Install

npm i jwt-wrapper

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • marcelitocs