@0xpolygonid/js-sdk 1.20.2 → 1.21.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.
@@ -8,7 +8,7 @@ const utils_1 = require("../../utils");
8
8
  * Returns a Map where the key is the groupId and the value is an object containing the query and linkNonce.
9
9
  *
10
10
  * @param requestScope - An array of ZeroKnowledgeProofRequest objects.
11
- * @returns A Map<number, { query: JsonDocumentObject; linkNonce: number }> representing the grouped queries.
11
+ * @returns A Map<number, { query: ZeroKnowledgeProofQuery; linkNonce: number }> representing the grouped queries.
12
12
  */
13
13
  const getGroupedQueries = (requestScope) => requestScope.reduce((acc, proofReq) => {
14
14
  const groupId = proofReq.query.groupId;
@@ -109,7 +109,6 @@ class ContractRequestHandler extends message_handler_1.AbstractMessageHandler {
109
109
  to: request.from,
110
110
  body: {
111
111
  transaction_data: request.body.transaction_data,
112
- reason: request.body.reason,
113
112
  scope: []
114
113
  }
115
114
  };
@@ -5,7 +5,7 @@ import { mergeObjects } from '../../utils';
5
5
  * Returns a Map where the key is the groupId and the value is an object containing the query and linkNonce.
6
6
  *
7
7
  * @param requestScope - An array of ZeroKnowledgeProofRequest objects.
8
- * @returns A Map<number, { query: JsonDocumentObject; linkNonce: number }> representing the grouped queries.
8
+ * @returns A Map<number, { query: ZeroKnowledgeProofQuery; linkNonce: number }> representing the grouped queries.
9
9
  */
10
10
  const getGroupedQueries = (requestScope) => requestScope.reduce((acc, proofReq) => {
11
11
  const groupId = proofReq.query.groupId;
@@ -106,7 +106,6 @@ export class ContractRequestHandler extends AbstractMessageHandler {
106
106
  to: request.from,
107
107
  body: {
108
108
  transaction_data: request.body.transaction_data,
109
- reason: request.body.reason,
110
109
  scope: []
111
110
  }
112
111
  };
@@ -1,4 +1,4 @@
1
- import { BasicMessage, IPackageManager, JsonDocumentObject, PackerParams } from '../types';
1
+ import { BasicMessage, DIDDocument, IPackageManager, JsonDocumentObject, PackerParams } from '../types';
2
2
  import { DID } from '@iden3/js-iden3-core';
3
3
  import { Proposal, ProposalRequestCredential, ProposalRequestMessage, ProposalMessage } from '../types/protocol/proposal-request';
4
4
  import { IIdentityWallet } from '../../identity';
@@ -10,7 +10,7 @@ export type ProposalRequestCreationOptions = {
10
10
  type: string;
11
11
  data?: JsonDocumentObject;
12
12
  };
13
- did_doc?: JsonDocumentObject;
13
+ did_doc?: DIDDocument;
14
14
  };
15
15
  /**
16
16
  * @beta
@@ -1,6 +1,10 @@
1
1
  import { ZKProof } from '@iden3/js-jwz';
2
2
  import { BasicMessage, JsonDocumentObject } from '../packer';
3
3
  import { PROTOCOL_MESSAGE_TYPE } from '../../constants';
4
+ import { ProofType } from '../../../verifiable';
5
+ import { CircuitId } from '../../../circuits';
6
+ import { DIDDocument as DidResolverDidDocument, VerificationMethod as DidResolverVerificationMethod } from 'did-resolver';
7
+ import { RootInfo, StateInfo } from '../../../storage';
4
8
  /** AuthorizationResponseMessage is struct the represents iden3message authorization response */
5
9
  export type AuthorizationResponseMessage = BasicMessage & {
6
10
  body: AuthorizationMessageResponseBody;
@@ -10,7 +14,7 @@ export type AuthorizationResponseMessage = BasicMessage & {
10
14
  };
11
15
  /** AuthorizationMessageResponseBody is struct the represents authorization response data */
12
16
  export type AuthorizationMessageResponseBody = {
13
- did_doc?: JsonDocumentObject;
17
+ did_doc?: DIDDocument;
14
18
  message?: string;
15
19
  scope: Array<ZeroKnowledgeProofResponse>;
16
20
  };
@@ -25,19 +29,29 @@ export type AuthorizationRequestMessageBody = {
25
29
  callbackUrl: string;
26
30
  reason?: string;
27
31
  message?: string;
28
- did_doc?: JsonDocumentObject;
32
+ did_doc?: DIDDocument;
29
33
  scope: Array<ZeroKnowledgeProofRequest>;
30
34
  };
31
35
  /** ZeroKnowledgeProofRequest represents structure of zkp request object */
32
36
  export type ZeroKnowledgeProofRequest = {
33
37
  id: number;
34
- circuitId: string;
38
+ circuitId: CircuitId;
35
39
  optional?: boolean;
36
- query: JsonDocumentObject;
40
+ query: ZeroKnowledgeProofQuery;
37
41
  params?: {
38
42
  nullifierSessionId?: string | number;
39
43
  };
40
44
  };
45
+ /** ZeroKnowledgeProofQuery represents structure of zkp request query object */
46
+ export type ZeroKnowledgeProofQuery = {
47
+ allowedIssuers: string[];
48
+ context: string;
49
+ credentialSubject?: JsonDocumentObject;
50
+ proofType?: ProofType;
51
+ skipClaimRevocationCheck?: boolean;
52
+ groupId?: number;
53
+ type: string;
54
+ };
41
55
  /** ZeroKnowledgeProofResponse represents structure of zkp response */
42
56
  export type ZeroKnowledgeProofResponse = {
43
57
  id: number;
@@ -54,3 +68,13 @@ export type VerifiablePresentation = {
54
68
  credentialSubject: JsonDocumentObject;
55
69
  };
56
70
  };
71
+ /** DIDDocument represents structure of DID Document */
72
+ export type DIDDocument = DidResolverDidDocument & {
73
+ verificationMethod?: VerificationMethod[];
74
+ };
75
+ /** VerificationMethod represents structure of Verification Method */
76
+ export type VerificationMethod = DidResolverVerificationMethod & {
77
+ published?: boolean;
78
+ info?: StateInfo;
79
+ global?: RootInfo;
80
+ };
@@ -1,6 +1,6 @@
1
1
  import { PROTOCOL_MESSAGE_TYPE } from '../../constants';
2
2
  import { BasicMessage } from '../packer';
3
- import { ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from './auth';
3
+ import { DIDDocument, ZeroKnowledgeProofRequest, ZeroKnowledgeProofResponse } from './auth';
4
4
  /** ContractInvokeRequest represents structure of contract invoke request object */
5
5
  export type ContractInvokeRequest = BasicMessage & {
6
6
  body: ContractInvokeRequestBody;
@@ -8,9 +8,10 @@ export type ContractInvokeRequest = BasicMessage & {
8
8
  };
9
9
  /** ContractInvokeRequestBody represents structure of contract invoke request body object */
10
10
  export type ContractInvokeRequestBody = {
11
- reason: string;
11
+ reason?: string;
12
12
  transaction_data: ContractInvokeTransactionData;
13
13
  scope: Array<ZeroKnowledgeProofRequest>;
14
+ did_doc?: DIDDocument;
14
15
  };
15
16
  /** ContractInvokeResponse represents structure of contract invoke response object */
16
17
  export type ContractInvokeResponse = BasicMessage & {
@@ -21,7 +22,7 @@ export type ContractInvokeResponse = BasicMessage & {
21
22
  export type ContractInvokeResponseBody = {
22
23
  scope: Array<OnChainZeroKnowledgeProofResponse>;
23
24
  transaction_data: ContractInvokeTransactionData;
24
- reason: string;
25
+ did_doc?: DIDDocument;
25
26
  };
26
27
  /** OnChainZeroKnowledgeProofResponse represents structure of onchain zero knowledge proof response */
27
28
  export type OnChainZeroKnowledgeProofResponse = ZeroKnowledgeProofResponse & {
@@ -1,4 +1,4 @@
1
- import { BasicMessage, JsonDocumentObject } from '../';
1
+ import { BasicMessage, DIDDocument, JsonDocumentObject } from '../';
2
2
  import { PROTOCOL_MESSAGE_TYPE } from '../../constants';
3
3
  /** @beta ProposalRequestMessage is struct the represents proposal-request message */
4
4
  export type ProposalRequestMessage = BasicMessage & {
@@ -12,7 +12,7 @@ export type ProposalRequestMessageBody = {
12
12
  type: string;
13
13
  data?: JsonDocumentObject;
14
14
  };
15
- did_doc?: JsonDocumentObject;
15
+ did_doc?: DIDDocument;
16
16
  };
17
17
  /** @beta ProposalMessage is struct the represents proposal message */
18
18
  export type ProposalMessage = BasicMessage & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.20.2",
3
+ "version": "1.21.0",
4
4
  "description": "SDK to work with Polygon ID",
5
5
  "main": "dist/node/cjs/index.js",
6
6
  "module": "dist/node/esm/index.js",