{"version":3,"sources":["../../../../src/server/requests-auth-methods/apiKeys.ts"],"names":["headerName","headerValue","headers"],"mappings":"AAEA,qHACS,yDAGW,MAGnB,EAAA,QAAA,iCAAYA,CAAAA,WAEN,CAAA,CAAA,CAAA,CAAaA,KAGnB,CAAA,CAAA,CAAM,IAAA,CAAA,UACCC,CAAAA,CAAcC,CAAAA,MAAa,KAAA,CAAA,CAAA,CAAA,CAAA,MAC7B,CAACD,CAAAA,CAAAA,CAAe,IAAA,CAAA,UAAuB,CAAA,CAAA,EAAU,CAAA,CAAA,CAAA,EAAA,OACrD,CAAA,EAAA,QAAO,CAAK,MAAA,IAGb,kCAAA,CAAA,OAAA,IAAA,CAAA,MAAA,CAAA,CAAA,CAAA,CAAA,uBACa,CACb,CACD,CAAA,OAAA,IAAA,CAAA,UAAA,CAAA,CAAA,wCAAA","file":"/home/runner/work/equipped/equipped/dist/cjs/server/requests-auth-methods/apiKeys.min.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"]}