@docknetwork/wallet-sdk-wasm 1.5.11 → 1.5.14

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.
@@ -51,6 +51,10 @@ class BlockchainServiceRpc extends services_rpcServiceClient.RpcService {
51
51
  getAddress() {
52
52
  return this.call('getAddress');
53
53
  }
54
+
55
+ resolveDID(did ) {
56
+ return this.call('resolveDID', did);
57
+ }
54
58
  }
55
59
 
56
60
  exports.BlockchainServiceRpc = BlockchainServiceRpc;
@@ -47,6 +47,10 @@ class BlockchainServiceRpc extends RpcService {
47
47
  getAddress() {
48
48
  return this.call('getAddress');
49
49
  }
50
+
51
+ resolveDID(did ) {
52
+ return this.call('resolveDID', did);
53
+ }
50
54
  }
51
55
 
52
56
  export { BlockchainServiceRpc };
@@ -65,7 +65,7 @@ class BlockchainService {
65
65
  * @returns
66
66
  */
67
67
  async ensureBlockchainReady() {
68
- if (this.isBlockchainReady) {
68
+ if (await this.isApiConnected()) {
69
69
  return;
70
70
  }
71
71
  return modules_eventManager.once(this.emitter, BlockchainService.Events.BLOCKCHAIN_READY);
@@ -143,6 +143,9 @@ class BlockchainService {
143
143
  }
144
144
  });
145
145
  }
146
+ async resolveDID(did) {
147
+ return this.resolver.resolve(did);
148
+ }
146
149
  /**
147
150
  *
148
151
  * @returns
@@ -61,7 +61,7 @@ class BlockchainService {
61
61
  * @returns
62
62
  */
63
63
  async ensureBlockchainReady() {
64
- if (this.isBlockchainReady) {
64
+ if (await this.isApiConnected()) {
65
65
  return;
66
66
  }
67
67
  return once(this.emitter, BlockchainService.Events.BLOCKCHAIN_READY);
@@ -139,6 +139,9 @@ class BlockchainService {
139
139
  }
140
140
  });
141
141
  }
142
+ async resolveDID(did) {
143
+ return this.resolver.resolve(did);
144
+ }
142
145
  /**
143
146
  *
144
147
  * @returns
@@ -64,6 +64,17 @@ function getAttributeName({field, selectedCredentials, index}) {
64
64
  return attributeName;
65
65
  }
66
66
 
67
+ /**
68
+ * Convert PEX request to bounds for each descriptor
69
+ * @param {*} pexRequest - The PEX request object containing input descriptors and constraints
70
+ * @param {*} selectedCredentials - Array of selected credentials corresponding to the input descriptors
71
+ * @param {*} removeFromRequest - if true, removes range proofs fields from the request. it might be dangerous if you will be using the proof request later
72
+ * because it will not have the range proofs fields anymore.
73
+ * @returns {Array} - Array of bounds for each descriptor, where each bound is an object with attributeName, min, and max
74
+ * @throws {Error} - If a field path is missing or empty
75
+ * @throws {Error} - If an unsupported format or type is encountered
76
+ * @throws {Error} - If a selected credential is expected but not found at the given index
77
+ */
67
78
  function pexToBounds(
68
79
  pexRequest,
69
80
  selectedCredentials = [],
@@ -166,6 +177,9 @@ function pexToBounds(
166
177
  : formatMinimum
167
178
  : minimum;
168
179
 
180
+ const proofRequestMax = max;
181
+ const proofRequestMin = min;
182
+
169
183
  if (max === undefined && min === undefined) {
170
184
  return;
171
185
  }
@@ -240,6 +254,10 @@ function pexToBounds(
240
254
  attributeName,
241
255
  min,
242
256
  max,
257
+ proofRequestMax,
258
+ proofRequestMin,
259
+ format,
260
+ type,
243
261
  });
244
262
  });
245
263
 
@@ -262,6 +280,7 @@ const attributesToSkip = [
262
280
  /^@context/,
263
281
  /^proof/,
264
282
  /^credentialSchema/,
283
+ /^issuanceDate/,
265
284
  ];
266
285
 
267
286
  const shouldSkipAttribute = attributeName =>
@@ -311,3 +330,4 @@ exports.MIN_INTEGER = MIN_INTEGER;
311
330
  exports.MIN_NUMBER = MIN_NUMBER;
312
331
  exports.getPexRequiredAttributes = getPexRequiredAttributes;
313
332
  exports.pexToBounds = pexToBounds;
333
+ exports.shouldSkipAttribute = shouldSkipAttribute;
@@ -60,6 +60,17 @@ function getAttributeName({field, selectedCredentials, index}) {
60
60
  return attributeName;
61
61
  }
62
62
 
63
+ /**
64
+ * Convert PEX request to bounds for each descriptor
65
+ * @param {*} pexRequest - The PEX request object containing input descriptors and constraints
66
+ * @param {*} selectedCredentials - Array of selected credentials corresponding to the input descriptors
67
+ * @param {*} removeFromRequest - if true, removes range proofs fields from the request. it might be dangerous if you will be using the proof request later
68
+ * because it will not have the range proofs fields anymore.
69
+ * @returns {Array} - Array of bounds for each descriptor, where each bound is an object with attributeName, min, and max
70
+ * @throws {Error} - If a field path is missing or empty
71
+ * @throws {Error} - If an unsupported format or type is encountered
72
+ * @throws {Error} - If a selected credential is expected but not found at the given index
73
+ */
63
74
  function pexToBounds(
64
75
  pexRequest,
65
76
  selectedCredentials = [],
@@ -162,6 +173,9 @@ function pexToBounds(
162
173
  : formatMinimum
163
174
  : minimum;
164
175
 
176
+ const proofRequestMax = max;
177
+ const proofRequestMin = min;
178
+
165
179
  if (max === undefined && min === undefined) {
166
180
  return;
167
181
  }
@@ -236,6 +250,10 @@ function pexToBounds(
236
250
  attributeName,
237
251
  min,
238
252
  max,
253
+ proofRequestMax,
254
+ proofRequestMin,
255
+ format,
256
+ type,
239
257
  });
240
258
  });
241
259
 
@@ -258,6 +276,7 @@ const attributesToSkip = [
258
276
  /^@context/,
259
277
  /^proof/,
260
278
  /^credentialSchema/,
279
+ /^issuanceDate/,
261
280
  ];
262
281
 
263
282
  const shouldSkipAttribute = attributeName =>
@@ -297,4 +316,4 @@ function getPexRequiredAttributes(pexRequest, selectedCredentials = []) {
297
316
  .filter(requiredAttributes => requiredAttributes.length > 0);
298
317
  }
299
318
 
300
- export { EPSILON_INT, EPSILON_NUMBER, MAX_DATE_PLACEHOLDER, MAX_INTEGER, MAX_NUMBER, MIN_DATE_PLACEHOLDER, MIN_INTEGER, MIN_NUMBER, getPexRequiredAttributes, pexToBounds };
319
+ export { EPSILON_INT, EPSILON_NUMBER, MAX_DATE_PLACEHOLDER, MAX_INTEGER, MAX_NUMBER, MIN_DATE_PLACEHOLDER, MIN_INTEGER, MIN_NUMBER, getPexRequiredAttributes, pexToBounds, shouldSkipAttribute };
@@ -331,7 +331,7 @@ class CredentialService {
331
331
  const attributesToSkip = descriptorBounds[idx]
332
332
  ? descriptorBounds[idx].map(bound => bound.attributeName)
333
333
  : [];
334
- const filteredAttributes = attributesToReveal.filter(attribute => !attributesToSkip.includes(attribute));
334
+ const filteredAttributes = attributesToReveal.filter(attribute => !attributesToSkip.includes(attribute) && !services_credential_pexHelpers.shouldSkipAttribute(attribute));
335
335
  const _pexRequiredAttributes = pexRequiredAttributes[idx] || [];
336
336
  _pexRequiredAttributes.forEach(attr => {
337
337
  if (!filteredAttributes.includes(attr)) {
@@ -10,7 +10,7 @@ import { blockchainService } from '../blockchain/service.mjs';
10
10
  import { hasProvingKey, fetchProvingKey, applyEnforceBounds } from './bound-check.mjs';
11
11
  import assert from 'assert';
12
12
  import { getIsRevoked, getWitnessDetails } from './bbs-revocation.mjs';
13
- import { getPexRequiredAttributes } from './pex-helpers.mjs';
13
+ import { getPexRequiredAttributes, shouldSkipAttribute } from './pex-helpers.mjs';
14
14
  import { didService } from '../dids/service.mjs';
15
15
  import '@cosmjs/proto-signing';
16
16
  import '@docknetwork/cheqd-blockchain-api';
@@ -323,7 +323,7 @@ class CredentialService {
323
323
  const attributesToSkip = descriptorBounds[idx]
324
324
  ? descriptorBounds[idx].map(bound => bound.attributeName)
325
325
  : [];
326
- const filteredAttributes = attributesToReveal.filter(attribute => !attributesToSkip.includes(attribute));
326
+ const filteredAttributes = attributesToReveal.filter(attribute => !attributesToSkip.includes(attribute) && !shouldSkipAttribute(attribute));
327
327
  const _pexRequiredAttributes = pexRequiredAttributes[idx] || [];
328
328
  _pexRequiredAttributes.forEach(attr => {
329
329
  if (!filteredAttributes.includes(attr)) {
@@ -43,6 +43,7 @@ export declare class BlockchainService {
43
43
  */
44
44
  disconnect(): Promise<any>;
45
45
  waitBlockchainReady(): Promise<unknown>;
46
+ resolveDID(did: string): Promise<any>;
46
47
  /**
47
48
  *
48
49
  * @returns
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/blockchain/service.ts"],"names":[],"mappings":"AAMA,OAAO,EAGL,cAAc,EAGf,MAAM,sCAA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;OAGG;IACG,qBAAqB;IAQ3B,iBAAiB;IAOjB;;;;OAIG;IACG,IAAI,CAAC,MAAM,EAAE,UAAU;IAwD7B;;;OAGG;IACG,UAAU;IAYV,mBAAmB;IAUnB,UAAU,CAAC,GAAG,EAAE,MAAM;IAG5B;;;OAGG;IACG,cAAc;IAId,UAAU;IAIhB,mBAAmB,CAAC,iBAAiB,KAAA;CAOtC;AAED,eAAO,MAAM,iBAAiB,EAAE,iBAA2C,CAAC"}
@@ -1,4 +1,15 @@
1
- export function pexToBounds(pexRequest: any, selectedCredentials?: any[], removeFromRequest?: boolean): any[];
1
+ /**
2
+ * Convert PEX request to bounds for each descriptor
3
+ * @param {*} pexRequest - The PEX request object containing input descriptors and constraints
4
+ * @param {*} selectedCredentials - Array of selected credentials corresponding to the input descriptors
5
+ * @param {*} removeFromRequest - if true, removes range proofs fields from the request. it might be dangerous if you will be using the proof request later
6
+ * because it will not have the range proofs fields anymore.
7
+ * @returns {Array} - Array of bounds for each descriptor, where each bound is an object with attributeName, min, and max
8
+ * @throws {Error} - If a field path is missing or empty
9
+ * @throws {Error} - If an unsupported format or type is encountered
10
+ * @throws {Error} - If a selected credential is expected but not found at the given index
11
+ */
12
+ export function pexToBounds(pexRequest: any, selectedCredentials?: any, removeFromRequest?: any): any[];
2
13
  export function getPexRequiredAttributes(pexRequest: any, selectedCredentials?: any[]): any;
3
14
  export const EPSILON_NUMBER: 0.001;
4
15
  export const EPSILON_INT: 1;
@@ -8,4 +19,5 @@ export const MAX_INTEGER: number;
8
19
  export const MIN_INTEGER: -4294967295;
9
20
  export const MAX_NUMBER: number;
10
21
  export const MIN_NUMBER: -4294967294;
22
+ export function shouldSkipAttribute(attributeName: any): boolean;
11
23
  //# sourceMappingURL=pex-helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pex-helpers.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/pex-helpers.js"],"names":[],"mappings":"AA8DA,8GA8LC;AAaD,4FAgCC;AAvSD,mCAAoC;AACpC,4BAA6B;AAE7B,mDAAoD;AACpD,mDAAoD;AACpD,iCAAoC;AACpC,sCAAuC;AACvC,gCAAmC;AACnC,qCAAsC"}
1
+ {"version":3,"file":"pex-helpers.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/pex-helpers.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,wGAqMC;AAcD,4FAgCC;AA1TD,mCAAoC;AACpC,4BAA6B;AAE7B,mDAAoD;AACpD,mDAAoD;AACpD,iCAAoC;AACpC,sCAAuC;AACvC,gCAAmC;AACnC,qCAAsC;AA+Q/B,iEACoD"}