UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

28 lines (25 loc) 1.28 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import IKeyStore from '../keyStore/IKeyStore'; import CryptoFactory from './CryptoFactory'; import EllipticCryptoOperations from './EllipticCryptoOperations'; import { SubtleCrypto } from 'webcrypto-core'; /** * Utility class to handle all CryptoFactory dependency injection for the environment browser. * In the same way a developer can add new CryptoFactory classes that support a different device. */ export default class CryptoFactoryBrowser extends CryptoFactory { /** * Constructs a new CryptoRegistry * @param keyStore used to store private keys * @param crypto The suite to use for dependency injection */ constructor (keyStore: IKeyStore, crypto: SubtleCrypto) { super(keyStore, crypto); const operations = new EllipticCryptoOperations(keyStore, crypto); this.messageSigners['ES256K'] = <any>operations; this.messageSigners['EdDSA'] = <any>operations; } }