@euirim/microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 1.96 kB
Source Map (JSON)
{"version":3,"sources":["src/common.speech/CognitiveSubscriptionKeyAuthentication.ts"],"names":[],"mappings":"AAGA,OAAO,EAAqB,OAAO,EAAiB,MAAM,mBAAmB,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAI9D;;GAEG;AACH,qBAAa,sCAAuC,YAAW,eAAe;IAC1E,OAAO,CAAC,YAAY,CAAW;IAE/B;;;;OAIG;gBACS,eAAe,EAAE,MAAM;IAQnC;;;;;;OAMG;IACI,KAAK,kDAEX;IAED;;;;;;OAMG;IACI,aAAa,kDAEnB;CACJ","file":"CognitiveSubscriptionKeyAuthentication.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport { ArgumentNullError, Promise, PromiseHelper } from \"../common/Exports\";\nimport { AuthInfo, IAuthentication } from \"./IAuthentication\";\n\nconst AuthHeader: string = \"Ocp-Apim-Subscription-Key\";\n\n/**\n * @class\n */\nexport class CognitiveSubscriptionKeyAuthentication implements IAuthentication {\n private privAuthInfo: AuthInfo;\n\n /**\n * Creates and initializes an instance of the CognitiveSubscriptionKeyAuthentication class.\n * @constructor\n * @param {string} subscriptionKey - The subscription key\n */\n constructor(subscriptionKey: string) {\n if (!subscriptionKey) {\n throw new ArgumentNullError(\"subscriptionKey\");\n }\n\n this.privAuthInfo = new AuthInfo(AuthHeader, subscriptionKey);\n }\n\n /**\n * Fetches the subscription key.\n * @member\n * @function\n * @public\n * @param {string} authFetchEventId - The id to fetch.\n */\n public fetch = (authFetchEventId: string): Promise<AuthInfo> => {\n return PromiseHelper.fromResult(this.privAuthInfo);\n }\n\n /**\n * Fetches the subscription key.\n * @member\n * @function\n * @public\n * @param {string} authFetchEventId - The id to fetch.\n */\n public fetchOnExpiry = (authFetchEventId: string): Promise<AuthInfo> => {\n return PromiseHelper.fromResult(this.privAuthInfo);\n }\n}\n"]}