UNPKG

@euirim/microsoft-cognitiveservices-speech-sdk

Version:
44 lines (42 loc) 1.43 kB
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. import { ArgumentNullError, PromiseHelper } from "../common/Exports"; import { AuthInfo } from "./IAuthentication"; const AuthHeader = "Ocp-Apim-Subscription-Key"; /** * @class */ export class CognitiveSubscriptionKeyAuthentication { /** * Creates and initializes an instance of the CognitiveSubscriptionKeyAuthentication class. * @constructor * @param {string} subscriptionKey - The subscription key */ constructor(subscriptionKey) { /** * Fetches the subscription key. * @member * @function * @public * @param {string} authFetchEventId - The id to fetch. */ this.fetch = (authFetchEventId) => { return PromiseHelper.fromResult(this.privAuthInfo); }; /** * Fetches the subscription key. * @member * @function * @public * @param {string} authFetchEventId - The id to fetch. */ this.fetchOnExpiry = (authFetchEventId) => { return PromiseHelper.fromResult(this.privAuthInfo); }; if (!subscriptionKey) { throw new ArgumentNullError("subscriptionKey"); } this.privAuthInfo = new AuthInfo(AuthHeader, subscriptionKey); } } //# sourceMappingURL=CognitiveSubscriptionKeyAuthentication.js.map