UNPKG

@kilterset/auth0-actions-testing

Version:

Test and develop Auth0 Actions or Okta CIC Actions locally.

20 lines 701 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.encodeHS256JWT = encodeHS256JWT; exports.signHS256 = signHS256; const node_crypto_1 = require("node:crypto"); function encodeHS256JWT({ secret, claims, }) { const header = { alg: "HS256", typ: "JWT", }; const body = [header, claims] .map((part) => Buffer.from(JSON.stringify(part)).toString("base64url")) .join("."); const signature = signHS256({ secret, body }); return `${body}.${signature}`; } function signHS256({ secret, body }) { return (0, node_crypto_1.createHmac)("sha256", secret).update(body).digest("base64url"); } //# sourceMappingURL=hs256.js.map