UNPKG

inceptum

Version:

hipages take on the foundational library for enterprise-grade apps written in NodeJS

20 lines 878 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiKeyVerification = void 0; const UnauthorizedError_1 = require("../web/errors/UnauthorizedError"); class ApiKeyVerification { static verifyApiKey(apiKey) { return (req, authOrSecDef, scopesOrApiKey, callback) => { // apiKeyHeader is defined and used in swagger but apiKey is empty. Create an error. if (!apiKey) { return callback(new UnauthorizedError_1.UnauthorizedError('Failed to set up an api key')); } if (scopesOrApiKey === apiKey) { return callback(); } return callback(new UnauthorizedError_1.UnauthorizedError('Failed to authenticate using api key')); }; } } exports.ApiKeyVerification = ApiKeyVerification; //# sourceMappingURL=ApiKeyVerification.js.map