{"version":3,"sources":["../../../../src/server/requests-auth-methods/apiKeys.ts","/home/runner/work/equipped/equipped/dist/cjs/server/requests-auth-methods/apiKeys.cjs"],"names":[],"mappings":"AAEA,8GAAsC;AACtC,kDAAsC;AAE/B,MAAe,4BAAA,QAA8D,+BAAyB;AAAA,EACzF;AAAA,EAGnB,WAAA,CAAY,UAAA,EAAoB;AAC/B,IAAA,KAAA,CAAM,CAAA;AACN,IAAA,IAAA,CAAK,WAAA,EAAa,UAAA;AAAA,EACnB;AAAA,EAEA,MAAM,KAAA,CAAM,OAAA,EAA8B;AACzC,IAAA,MAAM,YAAA,EAAc,OAAA,CAAQ,IAAA,CAAK,UAAU,CAAA;AAC3C,IAAA,GAAA,CAAI,CAAC,YAAA,GAAe,OAAO,YAAA,IAAgB,QAAA,EAAU,MAAM,IAAI,oCAAA,CAAsB,CAAA;AACrF,IAAA,OAAO,IAAA,CAAK,MAAA,CAAO,WAAW,CAAA;AAAA,EAC/B;AAAA,EAEA,uBAAA,CAAA,EAA0B;AACzB,IAAA,OAAO,IAAA,CAAK,UAAA;AAAA,EACb;AACD;ACNA;AACE;AACF,kEAAC","file":"/home/runner/work/equipped/equipped/dist/cjs/server/requests-auth-methods/apiKeys.cjs","sourcesContent":["import type { IncomingHttpHeaders } from 'node:http2'\n\nimport { BaseRequestAuthMethod } from './base'\nimport { NotAuthenticatedError } from '../../errors'\n\nexport abstract class BaseApiKeyRequestAuthMethod<T extends { id: string }> extends BaseRequestAuthMethod<T> {\n\tprotected readonly headerName: string\n\tprotected abstract verify(apiKey: string): Promise<T>\n\n\tconstructor(headerName: string) {\n\t\tsuper()\n\t\tthis.headerName = headerName\n\t}\n\n\tasync parse(headers: IncomingHttpHeaders) {\n\t\tconst headerValue = headers[this.headerName]\n\t\tif (!headerValue || typeof headerValue !== 'string') throw new NotAuthenticatedError()\n\t\treturn this.verify(headerValue)\n\t}\n\n\trouteSecuritySchemeName() {\n\t\treturn this.headerName\n\t}\n}\n",null]}