@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
31 lines (26 loc) • 1.1 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SubtleCrypto } from 'webcrypto-core';
import { ISubtleCrypto } from './ISubtleCryptoExtension';
const { Crypto } = require("@peculiar/webcrypto");
// var WebCrypto = require("node-webcrypto-ossl");
/**
* Subtle crypto for node
* */
export default class SubtleCryptoNode implements ISubtleCrypto {
private static crypto = new Crypto().subtle;
/**
* Returns the @class SubtleCrypto implementation for the nodes environment
*/
public getSubtleCrypto(): SubtleCrypto {
return SubtleCryptoNode.getSubtleCrypto();
}
/**
* Returns the @class SubtleCrypto implementation for the nodes environment
*/
public static getSubtleCrypto(): SubtleCrypto {
return SubtleCryptoNode.crypto;
}
}