Permalink
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@azure/core-auth/dist-esm/src/azureSASCredential.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
50 lines (50 sloc)
1.58 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) Microsoft Corporation. | |
// Licensed under the MIT license. | |
import { isObjectWithProperties } from "./typeguards"; | |
/** | |
* A static-signature-based credential that supports updating | |
* the underlying signature value. | |
*/ | |
export class AzureSASCredential { | |
/** | |
* Create an instance of an AzureSASCredential for use | |
* with a service client. | |
* | |
* @param signature - The initial value of the shared access signature to use in authentication | |
*/ | |
constructor(signature) { | |
if (!signature) { | |
throw new Error("shared access signature must be a non-empty string"); | |
} | |
this._signature = signature; | |
} | |
/** | |
* The value of the shared access signature to be used in authentication | |
*/ | |
get signature() { | |
return this._signature; | |
} | |
/** | |
* Change the value of the signature. | |
* | |
* Updates will take effect upon the next request after | |
* updating the signature value. | |
* | |
* @param newSignature - The new shared access signature value to be used | |
*/ | |
update(newSignature) { | |
if (!newSignature) { | |
throw new Error("shared access signature must be a non-empty string"); | |
} | |
this._signature = newSignature; | |
} | |
} | |
/** | |
* Tests an object to determine whether it implements SASCredential. | |
* | |
* @param credential - The assumed SASCredential to be tested. | |
*/ | |
export function isSASCredential(credential) { | |
return (isObjectWithProperties(credential, ["signature"]) && typeof credential.signature === "string"); | |
} | |
//# sourceMappingURL=azureSASCredential.js.map |