1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const UnauthorizedError_1 = require("../web/errors/UnauthorizedError");
|
4 | class ApiKeyVerification {
|
5 | static verifyApiKey(apiKey) {
|
6 | return (req, authOrSecDef, scopesOrApiKey, callback) => {
|
7 |
|
8 | if (!apiKey) {
|
9 | return callback(new UnauthorizedError_1.UnauthorizedError('Failed to set up an api key'));
|
10 | }
|
11 | if (scopesOrApiKey === apiKey) {
|
12 | return callback();
|
13 | }
|
14 | return callback(new UnauthorizedError_1.UnauthorizedError('Failed to authenticate using api key'));
|
15 | };
|
16 | }
|
17 | }
|
18 | exports.ApiKeyVerification = ApiKeyVerification;
|
19 |
|
\ | No newline at end of file |