JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1924
  • Score
    100M100P100Q117647F
  • License MPL 2.0

a JWT utility

Package Exports

  • fxa-jwtool

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fxa-jwtool) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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" }