some JWT utilities useful for Firefox Accounts
Перейти к файлу
Shane Tomlinson d9f822c9e5
Merge pull request #7 from Mozilla-GitHub-Standards/master r=@shane-tomlinson
Add Mozilla Code of Conduct
2019-04-01 16:13:56 +01:00
test lose some weight 2015-03-26 18:21:02 -07:00
.gitignore live long and prosper 2015-03-19 12:56:15 -07:00
CODE_OF_CONDUCT.md Add Mozilla Code of Conduct file 2019-03-29 09:54:51 -07:00
LICENSE chore(package.json): add extra fields related to the repo 2015-03-25 10:11:02 -07:00
README.md refactored internals and changed 'verify' to return only the payload 2015-03-25 21:52:27 -07:00
index.js added 'defaults' to jwtool.verify 2015-11-22 15:41:06 -08:00
package.json added 'defaults' to jwtool.verify 2015-11-22 15:41:06 -08:00

README.md

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