@0xpolygonid/js-sdk 1.9.4 → 1.10.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.
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AtomicQuerySigV2OnChainPubSignals = exports.AtomicQuerySigV2OnChainCircuitInputs = exports.AtomicQuerySigV2OnChainInputs = void 0;
4
- const js_merkletree_1 = require("@iden3/js-merkletree");
5
4
  const js_iden3_core_1 = require("@iden3/js-iden3-core");
6
5
  const models_1 = require("./models");
6
+ const js_merkletree_1 = require("@iden3/js-merkletree");
7
7
  const common_1 = require("./common");
8
8
  const utils_1 = require("../utils");
9
9
  /**
@@ -206,7 +206,7 @@ class AtomicQuerySigV2OnChainPubSignals extends common_1.BaseConfig {
206
206
  this.circuitQueryHash = BigInt(sVals[fieldIdx]);
207
207
  fieldIdx++;
208
208
  // - issuerAuthState
209
- this.issuerAuthState = (0, js_merkletree_1.newHashFromString)(sVals[fieldIdx]);
209
+ this.issuerAuthState = js_merkletree_1.Hash.fromString(sVals[fieldIdx]);
210
210
  fieldIdx++;
211
211
  // - requestID
212
212
  this.requestID = BigInt(sVals[fieldIdx]);
@@ -215,7 +215,7 @@ class AtomicQuerySigV2OnChainPubSignals extends common_1.BaseConfig {
215
215
  this.challenge = BigInt(sVals[fieldIdx]);
216
216
  fieldIdx++;
217
217
  // - gistRoot
218
- this.gistRoot = (0, js_merkletree_1.newHashFromString)(sVals[fieldIdx]);
218
+ this.gistRoot = js_merkletree_1.Hash.fromString(sVals[fieldIdx]);
219
219
  fieldIdx++;
220
220
  // - issuerID
221
221
  this.issuerID = js_iden3_core_1.Id.fromBigInt(BigInt(sVals[fieldIdx]));
@@ -224,7 +224,7 @@ class AtomicQuerySigV2OnChainPubSignals extends common_1.BaseConfig {
224
224
  this.isRevocationChecked = parseInt(sVals[fieldIdx]);
225
225
  fieldIdx++;
226
226
  // - issuerClaimNonRevState
227
- this.issuerClaimNonRevState = (0, js_merkletree_1.newHashFromString)(sVals[fieldIdx]);
227
+ this.issuerClaimNonRevState = js_merkletree_1.Hash.fromString(sVals[fieldIdx]);
228
228
  fieldIdx++;
229
229
  // - timestamp
230
230
  this.timestamp = parseInt(sVals[fieldIdx]);
@@ -83,8 +83,8 @@ class StateTransitionPubSignals {
83
83
  throw new Error(`invalid number of Output values expected ${fieldLength} got ${sVals.length}`);
84
84
  }
85
85
  this.userId = js_iden3_core_1.Id.fromBigInt(BigInt(sVals[0]));
86
- this.oldUserState = (0, js_merkletree_1.newHashFromString)(sVals[1]);
87
- this.newUserState = (0, js_merkletree_1.newHashFromString)(sVals[2]);
86
+ this.oldUserState = js_merkletree_1.Hash.fromString(sVals[1]);
87
+ this.newUserState = js_merkletree_1.Hash.fromString(sVals[2]);
88
88
  this.isOldStateGenesis = BigInt(sVals[3]) === BigInt(1);
89
89
  return this;
90
90
  }
@@ -83,7 +83,7 @@ class IdentityWallet {
83
83
  const tmpIdentifier = opts.seed ? uuid.v5(js_crypto_1.Hex.encode((0, js_crypto_1.sha256)(opts.seed)), uuid.NIL) : uuid.v4();
84
84
  opts.method = opts.method ?? js_iden3_core_1.DidMethod.Iden3;
85
85
  opts.blockchain = opts.blockchain ?? js_iden3_core_1.Blockchain.Polygon;
86
- opts.networkId = opts.networkId ?? js_iden3_core_1.NetworkId.Mumbai;
86
+ opts.networkId = opts.networkId ?? js_iden3_core_1.NetworkId.Amoy;
87
87
  await this._storage.mt.createIdentityMerkleTrees(tmpIdentifier);
88
88
  opts.seed = opts.seed ?? (0, js_crypto_1.getRandomBytes)(32);
89
89
  const keyId = await this._kms.createKeyFromSeed(kms_1.KmsKeyType.BabyJubJub, opts.seed);
@@ -1,6 +1,6 @@
1
- import { newHashFromString } from '@iden3/js-merkletree';
2
1
  import { Id } from '@iden3/js-iden3-core';
3
2
  import { ValueProof, CircuitError } from './models';
3
+ import { Hash } from '@iden3/js-merkletree';
4
4
  import { BaseConfig, bigIntArrayToStringArray, existenceToInt, getNodeAuxValue, prepareCircuitArrayValues, prepareSiblingsStr } from './common';
5
5
  import { byteDecoder, byteEncoder } from '../utils';
6
6
  /**
@@ -201,7 +201,7 @@ export class AtomicQuerySigV2OnChainPubSignals extends BaseConfig {
201
201
  this.circuitQueryHash = BigInt(sVals[fieldIdx]);
202
202
  fieldIdx++;
203
203
  // - issuerAuthState
204
- this.issuerAuthState = newHashFromString(sVals[fieldIdx]);
204
+ this.issuerAuthState = Hash.fromString(sVals[fieldIdx]);
205
205
  fieldIdx++;
206
206
  // - requestID
207
207
  this.requestID = BigInt(sVals[fieldIdx]);
@@ -210,7 +210,7 @@ export class AtomicQuerySigV2OnChainPubSignals extends BaseConfig {
210
210
  this.challenge = BigInt(sVals[fieldIdx]);
211
211
  fieldIdx++;
212
212
  // - gistRoot
213
- this.gistRoot = newHashFromString(sVals[fieldIdx]);
213
+ this.gistRoot = Hash.fromString(sVals[fieldIdx]);
214
214
  fieldIdx++;
215
215
  // - issuerID
216
216
  this.issuerID = Id.fromBigInt(BigInt(sVals[fieldIdx]));
@@ -219,7 +219,7 @@ export class AtomicQuerySigV2OnChainPubSignals extends BaseConfig {
219
219
  this.isRevocationChecked = parseInt(sVals[fieldIdx]);
220
220
  fieldIdx++;
221
221
  // - issuerClaimNonRevState
222
- this.issuerClaimNonRevState = newHashFromString(sVals[fieldIdx]);
222
+ this.issuerClaimNonRevState = Hash.fromString(sVals[fieldIdx]);
223
223
  fieldIdx++;
224
224
  // - timestamp
225
225
  this.timestamp = parseInt(sVals[fieldIdx]);
@@ -1,5 +1,5 @@
1
1
  import { Id } from '@iden3/js-iden3-core';
2
- import { newHashFromString } from '@iden3/js-merkletree';
2
+ import { Hash } from '@iden3/js-merkletree';
3
3
  import { BaseConfig, getNodeAuxValue, prepareSiblingsStr } from './common';
4
4
  import { CircuitError } from './models';
5
5
  import { byteDecoder, byteEncoder } from '../utils';
@@ -79,8 +79,8 @@ export class StateTransitionPubSignals {
79
79
  throw new Error(`invalid number of Output values expected ${fieldLength} got ${sVals.length}`);
80
80
  }
81
81
  this.userId = Id.fromBigInt(BigInt(sVals[0]));
82
- this.oldUserState = newHashFromString(sVals[1]);
83
- this.newUserState = newHashFromString(sVals[2]);
82
+ this.oldUserState = Hash.fromString(sVals[1]);
83
+ this.newUserState = Hash.fromString(sVals[2]);
84
84
  this.isOldStateGenesis = BigInt(sVals[3]) === BigInt(1);
85
85
  return this;
86
86
  }
@@ -57,7 +57,7 @@ export class IdentityWallet {
57
57
  const tmpIdentifier = opts.seed ? uuid.v5(Hex.encode(sha256(opts.seed)), uuid.NIL) : uuid.v4();
58
58
  opts.method = opts.method ?? DidMethod.Iden3;
59
59
  opts.blockchain = opts.blockchain ?? Blockchain.Polygon;
60
- opts.networkId = opts.networkId ?? NetworkId.Mumbai;
60
+ opts.networkId = opts.networkId ?? NetworkId.Amoy;
61
61
  await this._storage.mt.createIdentityMerkleTrees(tmpIdentifier);
62
62
  opts.seed = opts.seed ?? getRandomBytes(32);
63
63
  const keyId = await this._kms.createKeyFromSeed(KmsKeyType.BabyJubJub, opts.seed);
@@ -1,8 +1,7 @@
1
- import { Proof } from '@iden3/js-merkletree';
2
1
  import { Id, Claim } from '@iden3/js-iden3-core';
3
2
  import { Signature } from '@iden3/js-crypto';
4
3
  import { Query, ClaimWithSigProof, TreeState, GISTProof } from './models';
5
- import { Hash } from '@iden3/js-merkletree';
4
+ import { Hash, Proof } from '@iden3/js-merkletree';
6
5
  import { BaseConfig } from './common';
7
6
  /**
8
7
  * AtomicQuerySigV2OnChainInputs ZK private inputs for credentialAtomicQuerySig.circom
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.9.4",
3
+ "version": "1.10.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",
@@ -34,7 +34,9 @@
34
34
  "tsc:declaration:watch": "tsc --watch --module commonjs --emitDeclarationOnly",
35
35
  "test": "env TS_NODE_COMPILER_OPTIONS='{\"strict\": false, \"module\": \"CommonJS\"}' mocha",
36
36
  "lint": "eslint --fix --ext .ts src/** tests/**",
37
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\""
37
+ "lint:check": "eslint --ext .ts src/** tests/**",
38
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
39
+ "format:check": "prettier \"src/**/*.ts\" \"tests/**/*.ts\" --check"
38
40
  },
39
41
  "repository": {
40
42
  "type": "git",
@@ -85,11 +87,11 @@
85
87
  "typescript": "^4.8.4"
86
88
  },
87
89
  "peerDependencies": {
88
- "@iden3/js-crypto": "1.0.3",
89
- "@iden3/js-iden3-core": "1.2.1",
90
- "@iden3/js-jsonld-merklization": "1.1.2",
91
- "@iden3/js-jwz": "1.3.0",
92
- "@iden3/js-merkletree": "1.1.2",
90
+ "@iden3/js-crypto": "1.1.0",
91
+ "@iden3/js-iden3-core": "1.3.1",
92
+ "@iden3/js-jsonld-merklization": "1.2.0",
93
+ "@iden3/js-jwz": "1.4.0",
94
+ "@iden3/js-merkletree": "1.2.0",
93
95
  "ffjavascript": "0.2.63",
94
96
  "rfc4648": "1.5.3",
95
97
  "snarkjs": "0.7.3"
@@ -121,6 +123,6 @@
121
123
  ]
122
124
  },
123
125
  "engines": {
124
- "node": ">=18.16.0"
126
+ "node": ">=20.11.0"
125
127
  }
126
128
  }