Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private getCredential(): Credential {
if (this.options.oauthToken) {
return new TokenCredential(this.options.oauthToken);
} else {
return new AnonymousCredential();
}
}
public async initialize() {
if (this.storageCredential) {
return;
}
this.storageCredential = (this.authType === AzureStorageAuthType.SharedKey)
?
new SharedKeyCredential(this.storageAccountName, await this.getKey())
:
new TokenCredential(await this.getToken());
}