// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/**
 * A static-key-based credential that supports updating
 * the underlying key value.
 */
var AzureKeyCredential = /** @class */ (function () {
    /**
     * Create an instance of an AzureKeyCredential for use
     * with a service client.
     *
     * @param key - The initial value of the key to use in authentication
     */
    function AzureKeyCredential(key) {
        if (!key) {
            throw new Error("key must be a non-empty string");
        }
        this._key = key;
    }
    Object.defineProperty(AzureKeyCredential.prototype, "key", {
        /**
         * The value of the key to be used in authentication
         */
        get: function () {
            return this._key;
        },
        enumerable: false,
        configurable: true
    });
    /**
     * Change the value of the key.
     *
     * Updates will take effect upon the next request after
     * updating the key value.
     *
     * @param newKey - The new key value to be used
     */
    AzureKeyCredential.prototype.update = function (newKey) {
        this._key = newKey;
    };
    return AzureKeyCredential;
}());
export { AzureKeyCredential };
//# sourceMappingURL=azureKeyCredential.js.map