fxa-jwtool

0.7.2 • Public • Published

fxa-jwtool

A module for creating and verifying JWTs used by Firefox Accounts.

Example

var JWTool = require('fxa-jwtool')
 
var secretKey = JWTool.JWK.fromFile(
  'priv.pem',
  {
    jku: 'https://api.accounts.firefox.com/.well-known/public-keys',
    kid: 'dev-1'
  }
)
 
var encodedJWT = secretKey.sign({ sub: 'hello world' })
 
var trustedJKUs = [
  'https://api.accounts.firefox.com/.well-known/public-keys'
]
 
var jwtool = new JWTool(trustedJKUs)
 
var message = jwtool.verify(encodedJWT)
 
console.log(message) // { sub: "hello world" }
 

Readme

Keywords

Package Sidebar

Install

npm i fxa-jwtool

Weekly Downloads

160

Version

0.7.2

License

MPL 2.0

Last publish

Collaborators

  • dannycoates
  • rfkelly
  • chilts