UNPKG

@jc-lab/jose

Version:

JSON Web Almost Everything - JWA, JWS, JWE, JWK, JWT, JWKS for Node.js with minimal dependencies

8 lines (5 loc) 307 B
const { randomBytes } = require('crypto') const { createSecretKey } = require('../help/key_object') const { KEYLENGTHS } = require('../help/consts') const importKey = require('../jwk/import') module.exports = alg => importKey(createSecretKey(randomBytes(KEYLENGTHS[alg] / 8)), { use: 'enc', alg })