UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

48 lines 1.83 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const PayloadSigningStrategy_1 = require("../crypto/strategies/PayloadSigningStrategy"); const JoseConstants_1 = require("../crypto/protocols/jose/JoseConstants"); const typescript_map_1 = require("typescript-map"); /** * Class used to model registrar crypto options */ class RegistrarCryptoOptions { /** * Constructs a new instance of the @class RegistrarCryptoOptions * @param cryptoFactory used for crypto operations. * @param payloadProtection used for the specified protocol. */ constructor(cryptoFactory, payloadProtection) { /** * Get or set the authentication algorithm. * Conform to the JWA standard */ this.signingAlgorithm = 'ES256K'; this.cryptoFactory = cryptoFactory; this.payloadProtection = payloadProtection; } /** * Get or set the authentication algorithm. * Conform to the JWA standard */ get protectionStrategy() { const strategy = { payloadSigningStrategy: new PayloadSigningStrategy_1.default() }; strategy.payloadSigningStrategy.protectionOptions = { cryptoFactory: this.cryptoFactory, options: new typescript_map_1.TSMap([ [JoseConstants_1.default.optionHeader, new typescript_map_1.TSMap([ ['alg', ''], ['kid', ''], ['operation', 'create'], ['proofOfWork', '{}'] ])], ]), payloadProtection: this.payloadProtection }; return strategy; } } exports.default = RegistrarCryptoOptions; //# sourceMappingURL=RegistrarCryptoOptions.js.map