@0xpolygonid/js-sdk 1.15.0 → 1.15.2

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,2 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CredentialOfferStatus = void 0;
4
+ /** CredentialOfferStatus is list of possible statuses for credential offer message */
5
+ var CredentialOfferStatus;
6
+ (function (CredentialOfferStatus) {
7
+ CredentialOfferStatus["Pending"] = "pending";
8
+ CredentialOfferStatus["Completed"] = "completed";
9
+ CredentialOfferStatus["Rejected"] = "rejected";
10
+ })(CredentialOfferStatus = exports.CredentialOfferStatus || (exports.CredentialOfferStatus = {}));
@@ -390,7 +390,7 @@ class IdentityWallet {
390
390
  req.revocationOpts.nonce =
391
391
  typeof req.revocationOpts.nonce === 'number'
392
392
  ? req.revocationOpts.nonce
393
- : Math.round(Math.random() * 10000);
393
+ : new DataView((0, js_crypto_1.getRandomBytes)(16).buffer).getUint32(0, false);
394
394
  req.subjectPosition = req.subjectPosition ?? verifiable_1.SubjectPosition.Index;
395
395
  try {
396
396
  credential = this._credentialWallet.createCredential(issuerDID, req, jsonSchema);
@@ -226,9 +226,6 @@ class ProofService {
226
226
  const gistRoot = authV2PubSignals.GISTRoot.bigInt();
227
227
  const userId = authV2PubSignals.userID.bigInt();
228
228
  const globalStateInfo = await this._stateStorage.getGISTRootInfo(gistRoot, userId);
229
- if (globalStateInfo.createdAtTimestamp === 0n) {
230
- throw new Error(`gist state doesn't exists in contract`);
231
- }
232
229
  if (globalStateInfo.root !== gistRoot) {
233
230
  throw new Error(`gist info contains invalid state`);
234
231
  }
@@ -1 +1,7 @@
1
- export {};
1
+ /** CredentialOfferStatus is list of possible statuses for credential offer message */
2
+ export var CredentialOfferStatus;
3
+ (function (CredentialOfferStatus) {
4
+ CredentialOfferStatus["Pending"] = "pending";
5
+ CredentialOfferStatus["Completed"] = "completed";
6
+ CredentialOfferStatus["Rejected"] = "rejected";
7
+ })(CredentialOfferStatus || (CredentialOfferStatus = {}));
@@ -364,7 +364,7 @@ export class IdentityWallet {
364
364
  req.revocationOpts.nonce =
365
365
  typeof req.revocationOpts.nonce === 'number'
366
366
  ? req.revocationOpts.nonce
367
- : Math.round(Math.random() * 10000);
367
+ : new DataView(getRandomBytes(16).buffer).getUint32(0, false);
368
368
  req.subjectPosition = req.subjectPosition ?? SubjectPosition.Index;
369
369
  try {
370
370
  credential = this._credentialWallet.createCredential(issuerDID, req, jsonSchema);
@@ -223,9 +223,6 @@ export class ProofService {
223
223
  const gistRoot = authV2PubSignals.GISTRoot.bigInt();
224
224
  const userId = authV2PubSignals.userID.bigInt();
225
225
  const globalStateInfo = await this._stateStorage.getGISTRootInfo(gistRoot, userId);
226
- if (globalStateInfo.createdAtTimestamp === 0n) {
227
- throw new Error(`gist state doesn't exists in contract`);
228
- }
229
226
  if (globalStateInfo.root !== gistRoot) {
230
227
  throw new Error(`gist info contains invalid state`);
231
228
  }
@@ -1,6 +1,5 @@
1
1
  import { ZKProof } from '@iden3/js-jwz';
2
2
  import { BasicMessage, JSONObject } from '../packer';
3
- import { DID } from '@iden3/js-iden3-core';
4
3
  /** AuthorizationResponseMessage is struct the represents iden3message authorization response */
5
4
  export type AuthorizationResponseMessage = BasicMessage & {
6
5
  body: AuthorizationMessageResponseBody;
@@ -34,7 +33,6 @@ export type ZeroKnowledgeProofRequest = {
34
33
  query: JSONObject;
35
34
  params?: {
36
35
  nullifierSessionId?: string | number;
37
- verifierDid?: DID;
38
36
  };
39
37
  };
40
38
  /** ZeroKnowledgeProofResponse represents structure of zkp response */
@@ -29,10 +29,17 @@ export type CredentialsOnchainOfferMessageBody = {
29
29
  credentials: CredentialOffer[];
30
30
  transaction_data: ContractInvokeTransactionData;
31
31
  };
32
+ /** CredentialOfferStatus is list of possible statuses for credential offer message */
33
+ export declare enum CredentialOfferStatus {
34
+ Pending = "pending",
35
+ Completed = "completed",
36
+ Rejected = "rejected"
37
+ }
32
38
  /** CredentialOffer is structure to fetch credential */
33
39
  export type CredentialOffer = {
34
40
  id: string;
35
41
  description: string;
42
+ status?: CredentialOfferStatus;
36
43
  };
37
44
  /** CredentialIssuanceMessage represent Iden3message for credential issuance */
38
45
  export type CredentialIssuanceMessage = Required<BasicMessage> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xpolygonid/js-sdk",
3
- "version": "1.15.0",
3
+ "version": "1.15.2",
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",
@@ -87,9 +87,9 @@
87
87
  },
88
88
  "peerDependencies": {
89
89
  "@iden3/js-crypto": "1.1.0",
90
- "@iden3/js-iden3-core": "1.3.1",
91
- "@iden3/js-jsonld-merklization": "1.2.0",
92
- "@iden3/js-jwz": "1.5.0",
90
+ "@iden3/js-iden3-core": "1.3.2",
91
+ "@iden3/js-jsonld-merklization": "1.3.1",
92
+ "@iden3/js-jwz": "1.5.1",
93
93
  "@iden3/js-merkletree": "1.2.0",
94
94
  "ffjavascript": "0.3.0",
95
95
  "rfc4648": "1.5.3",