@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
31 lines • 1.26 kB
JavaScript
;
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const CryptoError_1 = require("../CryptoError");
/**
* Subtle crypto for browser
**/
class SubtleCryptoBrowser {
/**
* Returns the @class SubtleCrypto implementation for the browser environment
*/
getSubtleCrypto() {
return SubtleCryptoBrowser.getSubtleCrypto();
}
/**
* Returns the @class SubtleCrypto implementation for the current environment
*/
static getSubtleCrypto() {
// tslint:disable-next-line:no-typeof-undefined
if (typeof window !== 'undefined') {
// return browser api
return window.crypto.subtle;
}
throw new CryptoError_1.default({}, 'window is not defined. Must be defined in browser.');
}
}
exports.default = SubtleCryptoBrowser;
//# sourceMappingURL=SubtleCryptoBrowser.js.map