@0xpolygonid/js-sdk 1.12.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/esm/index.js +281 -18
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/umd/index.js +283 -17
- package/dist/browser/umd/index.js.map +1 -1
- package/dist/node/cjs/iden3comm/constants.js +5 -1
- package/dist/node/cjs/iden3comm/handlers/fetch.js +26 -12
- package/dist/node/cjs/iden3comm/handlers/index.js +1 -0
- package/dist/node/cjs/iden3comm/handlers/payment.js +232 -0
- package/dist/node/cjs/iden3comm/types/index.js +1 -0
- package/dist/node/cjs/iden3comm/types/protocol/payment.js +2 -0
- package/dist/node/cjs/proof/common.js +17 -4
- package/dist/node/cjs/verifiable/constants.js +37 -1
- package/dist/node/esm/iden3comm/constants.js +5 -1
- package/dist/node/esm/iden3comm/handlers/fetch.js +26 -12
- package/dist/node/esm/iden3comm/handlers/index.js +1 -0
- package/dist/node/esm/iden3comm/handlers/payment.js +203 -0
- package/dist/node/esm/iden3comm/types/index.js +1 -0
- package/dist/node/esm/iden3comm/types/protocol/payment.js +1 -0
- package/dist/node/esm/proof/common.js +17 -4
- package/dist/node/esm/verifiable/constants.js +36 -0
- package/dist/types/iden3comm/constants.d.ts +2 -0
- package/dist/types/iden3comm/handlers/index.d.ts +1 -0
- package/dist/types/iden3comm/handlers/message-handler.d.ts +2 -1
- package/dist/types/iden3comm/handlers/payment.d.ts +100 -0
- package/dist/types/iden3comm/types/index.d.ts +1 -0
- package/dist/types/iden3comm/types/protocol/credentials.d.ts +3 -3
- package/dist/types/iden3comm/types/protocol/payment.d.ts +48 -0
- package/dist/types/verifiable/constants.d.ts +32 -0
- package/package.json +1 -1
|
@@ -7443,6 +7443,42 @@ var RefreshServiceType;
|
|
|
7443
7443
|
(function (RefreshServiceType) {
|
|
7444
7444
|
RefreshServiceType["Iden3RefreshService2023"] = "Iden3RefreshService2023";
|
|
7445
7445
|
})(RefreshServiceType || (RefreshServiceType = {}));
|
|
7446
|
+
/**
|
|
7447
|
+
* PaymentRequestType type for payment requests
|
|
7448
|
+
* @beta
|
|
7449
|
+
* @enum {string}
|
|
7450
|
+
*/
|
|
7451
|
+
var PaymentRequestType;
|
|
7452
|
+
(function (PaymentRequestType) {
|
|
7453
|
+
PaymentRequestType["PaymentRequest"] = "PaymentRequest";
|
|
7454
|
+
})(PaymentRequestType || (PaymentRequestType = {}));
|
|
7455
|
+
/**
|
|
7456
|
+
* PaymentRequestDataType type for payment requests
|
|
7457
|
+
* @beta
|
|
7458
|
+
* @enum {string}
|
|
7459
|
+
*/
|
|
7460
|
+
var PaymentRequestDataType;
|
|
7461
|
+
(function (PaymentRequestDataType) {
|
|
7462
|
+
PaymentRequestDataType["Iden3PaymentRequestCryptoV1"] = "Iden3PaymentRequestCryptoV1";
|
|
7463
|
+
})(PaymentRequestDataType || (PaymentRequestDataType = {}));
|
|
7464
|
+
/**
|
|
7465
|
+
* PaymentType type for payment responses
|
|
7466
|
+
* @beta
|
|
7467
|
+
* @enum {string}
|
|
7468
|
+
*/
|
|
7469
|
+
var PaymentType;
|
|
7470
|
+
(function (PaymentType) {
|
|
7471
|
+
PaymentType["Iden3PaymentCryptoV1"] = "Iden3PaymentCryptoV1";
|
|
7472
|
+
})(PaymentType || (PaymentType = {}));
|
|
7473
|
+
/**
|
|
7474
|
+
* Media types for Payment supported currencies
|
|
7475
|
+
* @beta
|
|
7476
|
+
* @enum {number}
|
|
7477
|
+
*/
|
|
7478
|
+
var SupportedCurrencies;
|
|
7479
|
+
(function (SupportedCurrencies) {
|
|
7480
|
+
SupportedCurrencies["ETH"] = "ETH";
|
|
7481
|
+
})(SupportedCurrencies || (SupportedCurrencies = {}));
|
|
7446
7482
|
|
|
7447
7483
|
/**
|
|
7448
7484
|
* Iden3SparseMerkleProof is a iden3 protocol merkle tree proof
|
|
@@ -53483,7 +53519,11 @@ const PROTOCOL_MESSAGE_TYPE = Object.freeze({
|
|
|
53483
53519
|
// ProposalRequestMessageType is type for proposal-request message
|
|
53484
53520
|
PROPOSAL_REQUEST_MESSAGE_TYPE: IDEN3_PROTOCOL + 'credentials/0.1/proposal-request',
|
|
53485
53521
|
// ProposalMessageType is type for proposal message
|
|
53486
|
-
PROPOSAL_MESSAGE_TYPE: IDEN3_PROTOCOL + 'credentials/0.1/proposal'
|
|
53522
|
+
PROPOSAL_MESSAGE_TYPE: IDEN3_PROTOCOL + 'credentials/0.1/proposal',
|
|
53523
|
+
// PaymentRequestMessageType is type for payment-request message
|
|
53524
|
+
PAYMENT_REQUEST_MESSAGE_TYPE: IDEN3_PROTOCOL + 'credentials/0.1/payment-request',
|
|
53525
|
+
// PaymentMessageType is type for payment message
|
|
53526
|
+
PAYMENT_MESSAGE_TYPE: IDEN3_PROTOCOL + 'credentials/0.1/payment'
|
|
53487
53527
|
});
|
|
53488
53528
|
/**
|
|
53489
53529
|
* Media types for iden3 comm communication protocol
|
|
@@ -54140,10 +54180,23 @@ const parseQueryMetadata = async (propertyQuery, ldContextJSON, credentialType,
|
|
|
54140
54180
|
if (!isValidOperation(query.datatype, propertyQuery.operator)) {
|
|
54141
54181
|
throw new Error(`operator ${propertyQuery.operator} is not supported for datatype ${query.datatype}`);
|
|
54142
54182
|
}
|
|
54143
|
-
|
|
54144
|
-
propertyQuery.
|
|
54145
|
-
|
|
54146
|
-
|
|
54183
|
+
if ((propertyQuery.operator === Operators.NOOP || propertyQuery.operator === Operators.SD) &&
|
|
54184
|
+
propertyQuery.operatorValue) {
|
|
54185
|
+
throw new Error(`operator value should be undefined for ${propertyQuery.operator} operator`);
|
|
54186
|
+
}
|
|
54187
|
+
let values;
|
|
54188
|
+
switch (propertyQuery.operator) {
|
|
54189
|
+
case Operators.NOOP:
|
|
54190
|
+
case Operators.SD:
|
|
54191
|
+
values = [];
|
|
54192
|
+
break;
|
|
54193
|
+
case Operators.EXISTS:
|
|
54194
|
+
values = transformExistsValue(propertyQuery.operatorValue);
|
|
54195
|
+
break;
|
|
54196
|
+
default:
|
|
54197
|
+
values = await transformQueryValueToBigInts(propertyQuery.operatorValue, query.datatype);
|
|
54198
|
+
}
|
|
54199
|
+
query.values = values;
|
|
54147
54200
|
}
|
|
54148
54201
|
return query;
|
|
54149
54202
|
};
|
|
@@ -57516,9 +57569,17 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
57516
57569
|
}
|
|
57517
57570
|
async handle(message, ctx) {
|
|
57518
57571
|
switch (message.type) {
|
|
57519
|
-
case PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE:
|
|
57520
|
-
await this.handleOfferMessage(message, ctx);
|
|
57521
|
-
|
|
57572
|
+
case PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE: {
|
|
57573
|
+
const result = await this.handleOfferMessage(message, ctx);
|
|
57574
|
+
if (Array.isArray(result)) {
|
|
57575
|
+
const credWallet = this.opts?.credentialWallet;
|
|
57576
|
+
if (!credWallet)
|
|
57577
|
+
throw new Error('Credential wallet is not provided');
|
|
57578
|
+
await credWallet.saveAll(result);
|
|
57579
|
+
return null;
|
|
57580
|
+
}
|
|
57581
|
+
return result;
|
|
57582
|
+
}
|
|
57522
57583
|
case PROTOCOL_MESSAGE_TYPE.CREDENTIAL_FETCH_REQUEST_MESSAGE_TYPE:
|
|
57523
57584
|
return this.handleFetchRequest(message);
|
|
57524
57585
|
case PROTOCOL_MESSAGE_TYPE.CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE:
|
|
@@ -57532,8 +57593,7 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
57532
57593
|
ctx.mediaType = MediaType.ZKPMessage;
|
|
57533
57594
|
}
|
|
57534
57595
|
const credentials = [];
|
|
57535
|
-
for (
|
|
57536
|
-
const credentialInfo = offerMessage.body.credentials[index];
|
|
57596
|
+
for (const credentialInfo of offerMessage.body.credentials) {
|
|
57537
57597
|
const guid = v4();
|
|
57538
57598
|
const fetchRequest = {
|
|
57539
57599
|
id: guid,
|
|
@@ -57557,7 +57617,6 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
57557
57617
|
senderDID,
|
|
57558
57618
|
...packerOpts
|
|
57559
57619
|
}));
|
|
57560
|
-
let message;
|
|
57561
57620
|
try {
|
|
57562
57621
|
if (!offerMessage?.body?.url) {
|
|
57563
57622
|
throw new Error(`could not fetch W3C credential, body url is missing`);
|
|
@@ -57570,14 +57629,18 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
57570
57629
|
},
|
|
57571
57630
|
body: token
|
|
57572
57631
|
});
|
|
57573
|
-
|
|
57574
|
-
|
|
57632
|
+
const arrayBuffer = await resp.arrayBuffer();
|
|
57633
|
+
if (!arrayBuffer.byteLength) {
|
|
57634
|
+
throw new Error(`could not fetch , ${credentialInfo?.id}, response is empty`);
|
|
57635
|
+
}
|
|
57636
|
+
const { unpackedMessage: message } = await this._packerMgr.unpack(new Uint8Array(arrayBuffer));
|
|
57637
|
+
if (message.type !== PROTOCOL_MESSAGE_TYPE.CREDENTIAL_ISSUANCE_RESPONSE_MESSAGE_TYPE) {
|
|
57638
|
+
return message;
|
|
57575
57639
|
}
|
|
57576
|
-
message = await resp.json();
|
|
57577
57640
|
credentials.push(W3CCredential.fromJSON(message.body.credential));
|
|
57578
57641
|
}
|
|
57579
57642
|
catch (e) {
|
|
57580
|
-
throw new Error(`could not fetch
|
|
57643
|
+
throw new Error(`could not fetch protocol message for credential offer id: , ${credentialInfo?.id}, error: ${e.message ?? e}`);
|
|
57581
57644
|
}
|
|
57582
57645
|
}
|
|
57583
57646
|
return credentials;
|
|
@@ -57596,11 +57659,15 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
57596
57659
|
throw new Error(`jws packer options are required for ${MediaType.SignedMessage}`);
|
|
57597
57660
|
}
|
|
57598
57661
|
const offerMessage = await FetchHandler.unpackMessage(this._packerMgr, offer, PROTOCOL_MESSAGE_TYPE.CREDENTIAL_OFFER_MESSAGE_TYPE);
|
|
57599
|
-
|
|
57662
|
+
const result = await this.handleOfferMessage(offerMessage, {
|
|
57600
57663
|
mediaType: opts?.mediaType,
|
|
57601
57664
|
headers: opts?.headers,
|
|
57602
57665
|
packerOptions: opts?.packerOptions
|
|
57603
57666
|
});
|
|
57667
|
+
if (Array.isArray(result)) {
|
|
57668
|
+
return result;
|
|
57669
|
+
}
|
|
57670
|
+
throw new Error('invalid protocol message response');
|
|
57604
57671
|
}
|
|
57605
57672
|
async handleFetchRequest(msgRequest) {
|
|
57606
57673
|
if (!msgRequest.to) {
|
|
@@ -57613,7 +57680,7 @@ class FetchHandler extends AbstractMessageHandler {
|
|
|
57613
57680
|
const userDID = DID.parse(msgRequest.from);
|
|
57614
57681
|
const credId = msgRequest.body?.id;
|
|
57615
57682
|
if (!credId) {
|
|
57616
|
-
throw new Error('
|
|
57683
|
+
throw new Error('invalid credential id in fetch request body');
|
|
57617
57684
|
}
|
|
57618
57685
|
if (!this.opts?.credentialWallet) {
|
|
57619
57686
|
throw new Error('please, provide credential wallet in options');
|
|
@@ -58138,5 +58205,201 @@ class CredentialProposalHandler extends AbstractMessageHandler {
|
|
|
58138
58205
|
}
|
|
58139
58206
|
}
|
|
58140
58207
|
|
|
58141
|
-
|
|
58208
|
+
/**
|
|
58209
|
+
* @beta
|
|
58210
|
+
* createPaymentRequest is a function to create protocol payment-request message
|
|
58211
|
+
* @param {DID} sender - sender did
|
|
58212
|
+
* @param {DID} receiver - receiver did
|
|
58213
|
+
* @param {string} agent - agent URL
|
|
58214
|
+
* @param {PaymentRequestInfo[]} payments - payments
|
|
58215
|
+
* @returns `PaymentRequestMessage`
|
|
58216
|
+
*/
|
|
58217
|
+
function createPaymentRequest(sender, receiver, agent, payments) {
|
|
58218
|
+
const uuidv4 = v4();
|
|
58219
|
+
const request = {
|
|
58220
|
+
id: uuidv4,
|
|
58221
|
+
thid: uuidv4,
|
|
58222
|
+
from: sender.string(),
|
|
58223
|
+
to: receiver.string(),
|
|
58224
|
+
typ: MediaType.PlainMessage,
|
|
58225
|
+
type: PROTOCOL_MESSAGE_TYPE.PAYMENT_REQUEST_MESSAGE_TYPE,
|
|
58226
|
+
body: {
|
|
58227
|
+
agent,
|
|
58228
|
+
payments
|
|
58229
|
+
}
|
|
58230
|
+
};
|
|
58231
|
+
return request;
|
|
58232
|
+
}
|
|
58233
|
+
/**
|
|
58234
|
+
* @beta
|
|
58235
|
+
* createPayment is a function to create protocol payment message
|
|
58236
|
+
* @param {DID} sender - sender did
|
|
58237
|
+
* @param {DID} receiver - receiver did
|
|
58238
|
+
* @param {PaymentInfo[]} payments - payments
|
|
58239
|
+
* @returns `PaymentMessage`
|
|
58240
|
+
*/
|
|
58241
|
+
function createPayment(sender, receiver, payments) {
|
|
58242
|
+
const uuidv4 = v4();
|
|
58243
|
+
const request = {
|
|
58244
|
+
id: uuidv4,
|
|
58245
|
+
thid: uuidv4,
|
|
58246
|
+
from: sender.string(),
|
|
58247
|
+
to: receiver.string(),
|
|
58248
|
+
typ: MediaType.PlainMessage,
|
|
58249
|
+
type: PROTOCOL_MESSAGE_TYPE.PAYMENT_MESSAGE_TYPE,
|
|
58250
|
+
body: {
|
|
58251
|
+
payments
|
|
58252
|
+
}
|
|
58253
|
+
};
|
|
58254
|
+
return request;
|
|
58255
|
+
}
|
|
58256
|
+
/**
|
|
58257
|
+
*
|
|
58258
|
+
* Allows to process PaymentRequest protocol message
|
|
58259
|
+
* @beta
|
|
58260
|
+
* @class PaymentHandler
|
|
58261
|
+
* @implements implements IPaymentHandler interface
|
|
58262
|
+
*/
|
|
58263
|
+
class PaymentHandler extends AbstractMessageHandler {
|
|
58264
|
+
/**
|
|
58265
|
+
* @beta Creates an instance of PaymentHandler.
|
|
58266
|
+
* @param {IPackageManager} _packerMgr - package manager to unpack message envelope
|
|
58267
|
+
* @param {PaymentHandlerParams} _params - payment handler params
|
|
58268
|
+
*
|
|
58269
|
+
*/
|
|
58270
|
+
constructor(_packerMgr, _params) {
|
|
58271
|
+
super();
|
|
58272
|
+
this._packerMgr = _packerMgr;
|
|
58273
|
+
this._params = _params;
|
|
58274
|
+
}
|
|
58275
|
+
async handle(message, context) {
|
|
58276
|
+
switch (message.type) {
|
|
58277
|
+
case PROTOCOL_MESSAGE_TYPE.PAYMENT_REQUEST_MESSAGE_TYPE:
|
|
58278
|
+
return await this.handlePaymentRequestMessage(message, context);
|
|
58279
|
+
case PROTOCOL_MESSAGE_TYPE.PAYMENT_MESSAGE_TYPE:
|
|
58280
|
+
await this.handlePayment(message, context);
|
|
58281
|
+
return null;
|
|
58282
|
+
default:
|
|
58283
|
+
return super.handle(message, context);
|
|
58284
|
+
}
|
|
58285
|
+
}
|
|
58286
|
+
/**
|
|
58287
|
+
* @inheritdoc IPaymentHandler#parsePaymentRequest
|
|
58288
|
+
*/
|
|
58289
|
+
async parsePaymentRequest(request) {
|
|
58290
|
+
const { unpackedMessage: message } = await this._packerMgr.unpack(request);
|
|
58291
|
+
const paymentRequest = message;
|
|
58292
|
+
if (message.type !== PROTOCOL_MESSAGE_TYPE.PAYMENT_REQUEST_MESSAGE_TYPE) {
|
|
58293
|
+
throw new Error('Invalid media type');
|
|
58294
|
+
}
|
|
58295
|
+
return paymentRequest;
|
|
58296
|
+
}
|
|
58297
|
+
async handlePaymentRequestMessage(paymentRequest, ctx) {
|
|
58298
|
+
if (!paymentRequest.to) {
|
|
58299
|
+
throw new Error(`failed request. empty 'to' field`);
|
|
58300
|
+
}
|
|
58301
|
+
if (!paymentRequest.from) {
|
|
58302
|
+
throw new Error(`failed request. empty 'from' field`);
|
|
58303
|
+
}
|
|
58304
|
+
if (!paymentRequest.body?.payments?.length) {
|
|
58305
|
+
throw new Error(`failed request. no 'payments' in body`);
|
|
58306
|
+
}
|
|
58307
|
+
if (!ctx.paymentHandler) {
|
|
58308
|
+
throw new Error(`please provide payment handler in context`);
|
|
58309
|
+
}
|
|
58310
|
+
const senderDID = DID.parse(paymentRequest.to);
|
|
58311
|
+
const receiverDID = DID.parse(paymentRequest.from);
|
|
58312
|
+
const payments = [];
|
|
58313
|
+
for (let i = 0; i < paymentRequest.body.payments.length; i++) {
|
|
58314
|
+
const paymentReq = paymentRequest.body.payments[i];
|
|
58315
|
+
if (paymentReq.type !== PaymentRequestType.PaymentRequest) {
|
|
58316
|
+
throw new Error(`failed request. not supported '${paymentReq.type}' payment type `);
|
|
58317
|
+
}
|
|
58318
|
+
if (paymentReq.data.type !== PaymentRequestDataType.Iden3PaymentRequestCryptoV1) {
|
|
58319
|
+
throw new Error(`failed request. not supported '${paymentReq.data.type}' payment type `);
|
|
58320
|
+
}
|
|
58321
|
+
const txId = await ctx.paymentHandler(paymentReq.data);
|
|
58322
|
+
payments.push({
|
|
58323
|
+
id: paymentReq.data.id,
|
|
58324
|
+
type: PaymentType.Iden3PaymentCryptoV1,
|
|
58325
|
+
paymentData: {
|
|
58326
|
+
txId
|
|
58327
|
+
}
|
|
58328
|
+
});
|
|
58329
|
+
}
|
|
58330
|
+
const paymentMessage = createPayment(senderDID, receiverDID, payments);
|
|
58331
|
+
const response = await this.packMessage(paymentMessage, senderDID);
|
|
58332
|
+
const agentResult = await fetch(paymentRequest.body.agent, {
|
|
58333
|
+
method: 'POST',
|
|
58334
|
+
body: response,
|
|
58335
|
+
headers: {
|
|
58336
|
+
'Content-Type': 'application/octet-stream'
|
|
58337
|
+
}
|
|
58338
|
+
});
|
|
58339
|
+
const arrayBuffer = await agentResult.arrayBuffer();
|
|
58340
|
+
if (!arrayBuffer.byteLength) {
|
|
58341
|
+
return null;
|
|
58342
|
+
}
|
|
58343
|
+
const { unpackedMessage } = await this._packerMgr.unpack(new Uint8Array(arrayBuffer));
|
|
58344
|
+
return unpackedMessage;
|
|
58345
|
+
}
|
|
58346
|
+
/**
|
|
58347
|
+
* @inheritdoc IPaymentHandler#handlePaymentRequest
|
|
58348
|
+
*/
|
|
58349
|
+
async handlePaymentRequest(request, opts) {
|
|
58350
|
+
if (this._params.packerParams.mediaType === MediaType.SignedMessage &&
|
|
58351
|
+
!this._params.packerParams.packerOptions) {
|
|
58352
|
+
throw new Error(`jws packer options are required for ${MediaType.SignedMessage}`);
|
|
58353
|
+
}
|
|
58354
|
+
const paymentRequest = await this.parsePaymentRequest(request);
|
|
58355
|
+
if (!paymentRequest.from) {
|
|
58356
|
+
throw new Error(`failed request. empty 'from' field`);
|
|
58357
|
+
}
|
|
58358
|
+
if (!paymentRequest.to) {
|
|
58359
|
+
throw new Error(`failed request. empty 'to' field`);
|
|
58360
|
+
}
|
|
58361
|
+
const agentMessage = await this.handlePaymentRequestMessage(paymentRequest, opts);
|
|
58362
|
+
if (!agentMessage) {
|
|
58363
|
+
return null;
|
|
58364
|
+
}
|
|
58365
|
+
const senderDID = DID.parse(paymentRequest.to);
|
|
58366
|
+
return this.packMessage(agentMessage, senderDID);
|
|
58367
|
+
}
|
|
58368
|
+
/**
|
|
58369
|
+
* @inheritdoc IPaymentHandler#handlePayment
|
|
58370
|
+
*/
|
|
58371
|
+
async handlePayment(payment, opts) {
|
|
58372
|
+
if (opts.paymentRequest.from !== payment.to) {
|
|
58373
|
+
throw new Error(`sender of the request is not a target of response - expected ${opts.paymentRequest.from}, given ${payment.to}`);
|
|
58374
|
+
}
|
|
58375
|
+
if (!payment.body?.payments.length) {
|
|
58376
|
+
throw new Error(`failed request. empty 'payments' field in body`);
|
|
58377
|
+
}
|
|
58378
|
+
for (let i = 0; i < payment.body.payments.length; i++) {
|
|
58379
|
+
const p = payment.body?.payments[i];
|
|
58380
|
+
const paymentRequestData = opts.paymentRequest.body?.payments.find((r) => r.data.id === p.id);
|
|
58381
|
+
if (!paymentRequestData) {
|
|
58382
|
+
throw new Error(`can't find payment request for payment id ${p.id}`);
|
|
58383
|
+
}
|
|
58384
|
+
if (!opts.paymentValidationHandler) {
|
|
58385
|
+
throw new Error(`please provide payment validation handler in options`);
|
|
58386
|
+
}
|
|
58387
|
+
await opts.paymentValidationHandler(p.paymentData.txId, paymentRequestData.data);
|
|
58388
|
+
}
|
|
58389
|
+
}
|
|
58390
|
+
async packMessage(message, senderDID) {
|
|
58391
|
+
const responseEncoded = byteEncoder.encode(JSON.stringify(message));
|
|
58392
|
+
const packerOpts = this._params.packerParams.mediaType === MediaType.SignedMessage
|
|
58393
|
+
? this._params.packerParams.packerOptions
|
|
58394
|
+
: {
|
|
58395
|
+
provingMethodAlg: proving.provingMethodGroth16AuthV2Instance.methodAlg
|
|
58396
|
+
};
|
|
58397
|
+
return await this._packerMgr.pack(this._params.packerParams.mediaType, responseEncoded, {
|
|
58398
|
+
senderDID,
|
|
58399
|
+
...packerOpts
|
|
58400
|
+
});
|
|
58401
|
+
}
|
|
58402
|
+
}
|
|
58403
|
+
|
|
58404
|
+
export { AbstractMessageHandler, AbstractPrivateKeyStore, AgentResolver, AtomicQueryMTPV2Inputs, AtomicQueryMTPV2OnChainInputs, AtomicQueryMTPV2OnChainPubSignals, AtomicQueryMTPV2PubSignals, AtomicQuerySigV2Inputs, AtomicQuerySigV2OnChainCircuitInputs, AtomicQuerySigV2OnChainInputs, AtomicQuerySigV2OnChainPubSignals, AtomicQuerySigV2PubSignals, AtomicQueryV3Inputs, AtomicQueryV3OnChainInputs, AtomicQueryV3OnChainPubSignals, AtomicQueryV3PubSignals, AuthHandler, AuthV2Inputs, AuthV2PubSignals, BJJSignatureProof2021, BaseConfig, BjjProvider, BrowserDataSource, CircuitClaim, CircuitError, CircuitId, CircuitStorage, ContractRequestHandler, CredentialProposalHandler, CredentialStatusPublisherRegistry, CredentialStatusResolverRegistry, CredentialStatusType, CredentialStorage, CredentialWallet, DIDDocumentJSONSchema, DataPrepareHandlerFunc, Ed25519Provider, ErrorEmptyAuthClaimNonRevProof, ErrorEmptyAuthClaimProof, ErrorEmptyChallengeSignature, ErrorEmptyClaimNonRevProof, ErrorEmptyClaimProof, ErrorEmptyClaimSignature, ErrorEmptyIssuerAuthClaimNonRevProof, ErrorEmptyIssuerAuthClaimProof, ErrorUserStateInRelayClaimProof, EthStateStorage, FSCircuitStorage, FetchHandler, FilterQuery, Iden3OnchainSmtCredentialStatusPublisher, Iden3SmtRhsCredentialStatusPublisher, Iden3SparseMerkleTreeProof, IdentityStorage, IdentityWallet, InMemoryDataSource, InMemoryMerkleTreeStorage, InMemoryPrivateKeyStore, IndexedDBDataSource, IndexedDBPrivateKeyStore, InputGenerator, IssuerResolver, JSON_SCHEMA_VALIDATORS_REGISTRY, JWSPacker, JsonSchemaValidator, KMS, KmsKeyType, LDParser, LinkedMultiQueryInputs, LinkedMultiQueryPubSignals, LocalStoragePrivateKeyStore, MerkleTreeIndexedDBStorage, MerkleTreeLocalStorage, MerkleTreeType, MerklizedRootPosition, MessageBus, MessageHandler, NativeProver, OnChainResolver, OnChainRevocationStorage, OnChainZKPVerifier, Operators, constants as PROTOCOL_CONSTANTS, PackageManager, Parser, PaymentHandler, PaymentRequestDataType, PaymentRequestType, PaymentType, PlainPacker, ProofNode, ProofPurpose, ProofService, ProofType, PubSignalsVerifier, Query, QueryOperators, RHSResolver, RefreshHandler, RefreshServiceType, RevocationStatusHandler, SDK_EVENTS, Scalar, SearchError, Sec256k1Provider, StandardJSONCredentialsQueryFilter, StateTransitionInputs, StateTransitionPubSignals, SubjectPosition, SupportedCurrencies, TransactionService, ValueProof, Vector, VerifiableConstants, VerificationHandlerFunc, W3CCredential, XSDNS, ZKPPacker, availableTypesOperators, base58ToBytes$1 as base58ToBytes, base64ToBytes$1 as base64ToBytes, base64UrlToBytes, bigIntArrayToStringArray, bigIntCompare, buildDIDFromEthPubKey, buildFieldPath, buildTreeState, buildVerifierId, byteDecoder, byteEncoder, bytesToBase58$1 as bytesToBase58, bytesToBase64, bytesToBase64url$1 as bytesToBase64url, bytesToHex$3 as bytesToHex, cacheLoader, calculateCoreSchemaHash, calculateQueryHashV2, calculateQueryHashV3, checkCircuitOperator, checkCircuitQueriesLength, checkDataInField, checkQueryRequest, circuitValidator, comparatorOptions, createAuthorizationRequest, createAuthorizationRequestWithMessage, createPayment, createPaymentRequest, createProposal, createProposalRequest, createSchemaHash, createVerifiablePresentation, credentialSubjectKey, dataFillsSlot, decodeBase64url$1 as decodeBase64url, defaultEthConnectionConfig, defaultMTLevels, defaultMTLevelsClaim, defaultMTLevelsOnChain, defaultValueArraySize, defineMerklizedRootPosition, encodeBase64url, existenceToInt, extractProof, extractPublicKeyBytes, factoryComparer, fieldToByteArray, fieldValueFromVerifiablePresentation, fillCoreClaimSlot, fillSlot, findCredentialType, findValue, generateProfileDID, getFieldSlotIndex, getKMSIdByAuthCredential, getNodeAuxValue, getNodesRepresentation, getOperatorNameByValue, getProperties, getSerializationAttrFromContext, getSerializationAttrFromParsedContext, getUserDIDFromCredential, hexToBytes$3 as hexToBytes, isEthereumIdentity, isGenesisState, isGenesisStateId, isIssuerGenesis, isValidOperation, keyPath, mergeObjects, parseCoreClaimSlots, parseCredentialSubject, parseQueriesMetadata, parseQueryMetadata, parseSerializationAttr, prepareCircuitArrayValues, prepareSiblingsStr, processZeroKnowledgeProofRequests, pushHashesToRHS, resolveDIDDocumentAuth, resolvePath, resolveVerificationMethods, strMTHex, stringByPath, subjectPositionIndex, swapEndianness, toClaimNonRevStatus, toGISTProof, toRevocationStatus, transformQueryValueToBigInts, userStateError, validateDIDDocumentAuth, validateDisclosureNativeSDSupport, validateDisclosureV2Circuit, validateEmptyCredentialSubjectNoopNativeSupport, validateEmptyCredentialSubjectV2Circuit, validateOperators, validateTreeState, verifyFieldValueInclusionNativeExistsSupport, verifyFieldValueInclusionV2, witnessBuilder };
|
|
58142
58405
|
//# sourceMappingURL=index.js.map
|