Skip to content

this package is a wrapper to jsonwebtoken as promise

Notifications You must be signed in to change notification settings

marcelitocs/jwt-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

this package is a wrapper to jsonwebtoken as promise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published