UNPKG

@berlingske-media/bm.node-module.gateway_jwt

Version:

AuthGateway JWT verification library based on public JWKS endpoint

17 lines 754 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.cacheWrapper = void 0; const tslib_1 = require("tslib"); const lru_memoizer_1 = tslib_1.__importDefault(require("lru-memoizer")); const node_util_1 = require("node:util"); function cacheWrapper(client, { cacheMaxEntries = 5, cacheMaxAge = 600000 }) { client.debug(`Configured caching of signing keys. Max: ${cacheMaxEntries} / Age: ${cacheMaxAge}`); return (0, node_util_1.promisify)((0, lru_memoizer_1.default)({ hash: (kid) => kid, load: (0, node_util_1.callbackify)(client.getSigningKey.bind(client)), maxAge: cacheMaxAge, max: cacheMaxEntries, })); } exports.cacheWrapper = cacheWrapper; //# sourceMappingURL=cache.js.map