{"version":3,"sources":["src/common.speech/CognitiveTokenAuthentication.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGjE,qBAAa,4BAA6B,YAAW,eAAe;IAChE,OAAO,CAAC,MAAM,CAAC,eAAe,CAAqB;IACnD,OAAO,CAAC,iBAAiB,CAAgD;IACzE,OAAO,CAAC,yBAAyB,CAAgD;gBAE9D,aAAa,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC;IAa9I,KAAK,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIlD,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAGpE","file":"CognitiveTokenAuthentication.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { ArgumentNullError } from \"../common/Exports.js\";\nimport { AuthInfo, IAuthentication } from \"./IAuthentication.js\";\nimport { HeaderNames } from \"./HeaderNames.js\";\n\nexport class CognitiveTokenAuthentication implements IAuthentication {\n    private static privTokenPrefix: string = \"Bearer \";\n    private privFetchCallback: (authFetchEventId: string) => Promise<string>;\n    private privFetchOnExpiryCallback: (authFetchEventId: string) => Promise<string>;\n\n    public constructor(fetchCallback: (authFetchEventId: string) => Promise<string>, fetchOnExpiryCallback: (authFetchEventId: string) => Promise<string>) {\n        if (!fetchCallback) {\n            throw new ArgumentNullError(\"fetchCallback\");\n        }\n\n        if (!fetchOnExpiryCallback) {\n            throw new ArgumentNullError(\"fetchOnExpiryCallback\");\n        }\n\n        this.privFetchCallback = fetchCallback;\n        this.privFetchOnExpiryCallback = fetchOnExpiryCallback;\n    }\n\n    public fetch(authFetchEventId: string): Promise<AuthInfo> {\n        return this.privFetchCallback(authFetchEventId).then((token: string): AuthInfo => new AuthInfo(HeaderNames.Authorization, token === undefined ? undefined : CognitiveTokenAuthentication.privTokenPrefix + token));\n    }\n\n    public fetchOnExpiry(authFetchEventId: string): Promise<AuthInfo> {\n        return this.privFetchOnExpiryCallback(authFetchEventId).then((token: string): AuthInfo => new AuthInfo(HeaderNames.Authorization, token === undefined ? undefined : CognitiveTokenAuthentication.privTokenPrefix + token));\n    }\n}\n"]}