jwks-provider

0.1.0 • Public • Published

jwks-provider

Serializer of keys for jwks route

Use

npm install jwks-provider
// Example mounting a jwks route in express
const express = require('express')
const { getKeyList } = require('./someKeyProvider.js')
const { serialize } = require('jwks-provider')
 
const app = express()
app.get('/jwks', async (req, res) => {
 
  /*
    Returns an Array of
    {
      use: 'enc|sig',
      kid: [some-key-id]|undefined,
      publicKey: [pem formatted RSA key]
    }
  */
  const keys = await getKeyList()
  
  res.send(serialize(keys))
})

Test

Requires Node version >= 10.12.0 since it uses crypto.generateKeyPair() to generate keys for the tests.

npm run lint && npm test

/jwks-provider/

    Package Sidebar

    Install

    npm i jwks-provider

    Weekly Downloads

    9

    Version

    0.1.0

    License

    MIT

    Unpacked Size

    6.17 kB

    Total Files

    6

    Last publish

    Collaborators

    • johanobrink