UNPKG

@authup/server-api

Version:

This is a standalone application.

31 lines 1.21 kB
"use strict"; /* * Copyright (c) 2022-2022. * Author Peter Placzek (tada5hi) * For the full copyright and license information, * view the LICENSE file that was distributed with this source code. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.verifyOAuth2TokenWithKey = void 0; const server_core_1 = require("@authup/server-core"); const core_1 = require("@authup/core"); async function verifyOAuth2TokenWithKey(token, entity, options) { if (entity.type === core_1.KeyType.OCT) { return await (0, server_core_1.verifyToken)(token, { type: core_1.KeyType.OCT, secret: Buffer.from(entity.decryption_key, 'base64'), ...options, }); } return await (0, server_core_1.verifyToken)(token, { type: entity.type, keyPair: { publicKey: (0, core_1.wrapPublicKeyPem)(entity.encryption_key), privateKey: (0, core_1.wrapPrivateKeyPem)(entity.decryption_key), }, ...(entity.signature_algorithm ? { algorithms: [entity.signature_algorithm] } : {}), ...options, }); } exports.verifyOAuth2TokenWithKey = verifyOAuth2TokenWithKey; //# sourceMappingURL=verify.js.map