@0xpolygonid/js-sdk 1.29.0 → 1.29.1

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.
@@ -205,7 +205,7 @@ class AuthHandler extends message_handler_1.AbstractMessageHandler {
205
205
  // group requests by query group id
206
206
  for (const proofRequest of requestScope) {
207
207
  const groupId = proofRequest.query.groupId;
208
- const proofResp = responseScope.find((resp) => resp.id === proofRequest.id);
208
+ const proofResp = responseScope.find((resp) => resp.id.toString() === proofRequest.id.toString());
209
209
  if (!proofResp) {
210
210
  throw new Error(`proof is not given for requestId ${proofRequest.id}`);
211
211
  }
@@ -237,6 +237,7 @@ class InputGenerator {
237
237
  return circuitInputs.inputsMarshal();
238
238
  };
239
239
  this.credentialAtomicQueryV3OnChainPrepareInputs = async ({ preparedCredential, identifier, proofReq, params, circuitQueries }) => {
240
+ const id = js_iden3_core_1.DID.idFromDID(identifier);
240
241
  const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
241
242
  circuitClaimData.nonRevProof = (0, common_1.toClaimNonRevStatus)(preparedCredential.revStatus);
242
243
  let proofType;
@@ -286,20 +287,17 @@ class InputGenerator {
286
287
  const isEthIdentity = (0, utils_1.isEthereumIdentity)(identifier);
287
288
  circuitInputs.isBJJAuthEnabled = isEthIdentity ? 0 : 1;
288
289
  circuitInputs.challenge = BigInt(params.challenge ?? 0);
289
- const { nonce: authProfileNonce, genesisDID } = await this._identityWallet.getGenesisDIDMetadata(identifier);
290
- const id = js_iden3_core_1.DID.idFromDID(genesisDID);
291
290
  const stateProof = await this._stateStorage.getGISTProof(id.bigInt());
292
291
  const gistProof = (0, common_1.toGISTProof)(stateProof);
293
292
  circuitInputs.gistProof = gistProof;
294
293
  // auth inputs
295
294
  if (circuitInputs.isBJJAuthEnabled === 1) {
296
- const authPrepared = await this.prepareAuthBJJCredential(genesisDID);
295
+ const authPrepared = await this.prepareAuthBJJCredential(identifier);
297
296
  const authClaimData = await this.newCircuitClaimData({
298
297
  credential: authPrepared.credential,
299
298
  credentialCoreClaim: authPrepared.coreClaim
300
299
  });
301
300
  const signature = await this._identityWallet.signChallenge(circuitInputs.challenge, authPrepared.credential);
302
- circuitInputs.profileNonce = BigInt(authProfileNonce);
303
301
  circuitInputs.authClaim = authClaimData.claim;
304
302
  circuitInputs.authClaimIncMtp = authClaimData.proof;
305
303
  circuitInputs.authClaimNonRevMtp = authPrepared.nonRevProof.proof;
@@ -177,7 +177,7 @@ export class AuthHandler extends AbstractMessageHandler {
177
177
  // group requests by query group id
178
178
  for (const proofRequest of requestScope) {
179
179
  const groupId = proofRequest.query.groupId;
180
- const proofResp = responseScope.find((resp) => resp.id === proofRequest.id);
180
+ const proofResp = responseScope.find((resp) => resp.id.toString() === proofRequest.id.toString());
181
181
  if (!proofResp) {
182
182
  throw new Error(`proof is not given for requestId ${proofRequest.id}`);
183
183
  }
@@ -234,6 +234,7 @@ export class InputGenerator {
234
234
  return circuitInputs.inputsMarshal();
235
235
  };
236
236
  this.credentialAtomicQueryV3OnChainPrepareInputs = async ({ preparedCredential, identifier, proofReq, params, circuitQueries }) => {
237
+ const id = DID.idFromDID(identifier);
237
238
  const circuitClaimData = await this.newCircuitClaimData(preparedCredential);
238
239
  circuitClaimData.nonRevProof = toClaimNonRevStatus(preparedCredential.revStatus);
239
240
  let proofType;
@@ -283,20 +284,17 @@ export class InputGenerator {
283
284
  const isEthIdentity = isEthereumIdentity(identifier);
284
285
  circuitInputs.isBJJAuthEnabled = isEthIdentity ? 0 : 1;
285
286
  circuitInputs.challenge = BigInt(params.challenge ?? 0);
286
- const { nonce: authProfileNonce, genesisDID } = await this._identityWallet.getGenesisDIDMetadata(identifier);
287
- const id = DID.idFromDID(genesisDID);
288
287
  const stateProof = await this._stateStorage.getGISTProof(id.bigInt());
289
288
  const gistProof = toGISTProof(stateProof);
290
289
  circuitInputs.gistProof = gistProof;
291
290
  // auth inputs
292
291
  if (circuitInputs.isBJJAuthEnabled === 1) {
293
- const authPrepared = await this.prepareAuthBJJCredential(genesisDID);
292
+ const authPrepared = await this.prepareAuthBJJCredential(identifier);
294
293
  const authClaimData = await this.newCircuitClaimData({
295
294
  credential: authPrepared.credential,
296
295
  credentialCoreClaim: authPrepared.coreClaim
297
296
  });
298
297
  const signature = await this._identityWallet.signChallenge(circuitInputs.challenge, authPrepared.credential);
299
- circuitInputs.profileNonce = BigInt(authProfileNonce);
300
298
  circuitInputs.authClaim = authClaimData.claim;
301
299
  circuitInputs.authClaimIncMtp = authClaimData.proof;
302
300
  circuitInputs.authClaimNonRevMtp = authPrepared.nonRevProof.proof;
@@ -36,7 +36,7 @@ export type AuthorizationRequestMessageBody = {
36
36
  };
37
37
  /** ZeroKnowledgeProofRequest represents structure of zkp request object */
38
38
  export type ZeroKnowledgeProofRequest = {
39
- id: number;
39
+ id: number | string;
40
40
  circuitId: CircuitId;
41
41
  optional?: boolean;
42
42
  query: ZeroKnowledgeProofQuery;
@@ -61,7 +61,7 @@ export type ZeroKnowledgeInvokeResponse = {
61
61
  };
62
62
  /** ZeroKnowledgeProofResponse represents structure of zkp response */
63
63
  export type ZeroKnowledgeProofResponse = {
64
- id: number;
64
+ id: number | string;
65
65
  circuitId: string;
66
66
  vp?: VerifiablePresentation;
67
67
  } & ZKProof;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.29.0",
3
+ "version": "1.29.1",
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",