UNPKG

@microsoft/useragent-sdk

Version:

SDK for building decentralized identity wallets and enterprise agents.

53 lines 2.57 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * 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 ProtectionFormat_1 = require("../../../../src/crypto/keyStore/ProtectionFormat"); const JoseConstants_1 = require("../../../../src/crypto/protocols/jose/JoseConstants"); const JoseToken_1 = require("../../../../src/crypto/protocols/jose/JoseToken"); class ProtocolTest { sign(_signingKeyReference, payload, _format, options) { return new Promise(resolve => { const signature = new JoseToken_1.default(options, new ProtocolTest(), [ [JoseConstants_1.default.tokenFormat, ProtectionFormat_1.ProtectionFormat.JwsFlatJson], [JoseConstants_1.default.tokenPayload, payload.toString()], [JoseConstants_1.default.tokenProtected, 'test'], [JoseConstants_1.default.tokenSignatures, ['test']] ]); resolve(signature); }); } verify(_validationKeys, _payload, _signature, _options) { return new Promise(resolve => { resolve({ result: true, reason: '' }); }); } encrypt(_recipients, _payload, _format, options) { return new Promise(resolve => { const cipher = new JoseToken_1.default(options, new ProtocolTest(), [ [JoseConstants_1.default.tokenFormat, ProtectionFormat_1.ProtectionFormat.JweFlatJson], ]); resolve(cipher); }); } decrypt(_decryptionKeyReference, _cipher, _options) { return new Promise(resolve => { resolve(Buffer.from('')); }); } serialize(token, _format, _options) { return JSON.stringify(token); } deserialize(_token, format, options) { return new JoseToken_1.default(options, new ProtocolTest(), [ [JoseConstants_1.default.tokenFormat, ProtectionFormat_1.ProtectionFormat.JwsFlatJson], [JoseConstants_1.default.tokenPayload, format], [JoseConstants_1.default.tokenProtected, 'test'], [JoseConstants_1.default.tokenSignatures, ['test']] ]); } } exports.default = ProtocolTest; //# sourceMappingURL=ProtocolTest.js.map