@docknetwork/wallet-sdk-wasm 1.5.10 → 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.
Files changed (42) hide show
  1. package/lib/services/blockchain/service-rpc.js +4 -0
  2. package/lib/services/blockchain/service-rpc.mjs +4 -0
  3. package/lib/services/blockchain/service.js +5 -4
  4. package/lib/services/blockchain/service.mjs +5 -4
  5. package/lib/services/credential/pex-helpers.js +20 -0
  6. package/lib/services/credential/pex-helpers.mjs +20 -1
  7. package/lib/services/credential/service.js +1 -1
  8. package/lib/services/credential/service.mjs +2 -2
  9. package/lib/services/credential/utils.js +4 -10
  10. package/lib/services/credential/utils.mjs +8 -8
  11. package/lib/services/dids/index.js +1 -16
  12. package/lib/services/dids/index.mjs +1 -16
  13. package/lib/services/dids/service-rpc.js +0 -3
  14. package/lib/services/dids/service-rpc.mjs +0 -3
  15. package/lib/services/dids/service.js +3 -26
  16. package/lib/services/dids/service.mjs +3 -25
  17. package/lib/services/edv/index.js +1 -16
  18. package/lib/services/edv/index.mjs +1 -16
  19. package/lib/services/edv/service.js +1 -16
  20. package/lib/services/edv/service.mjs +1 -16
  21. package/lib/services/util-crypto/service-rpc.js +2 -7
  22. package/lib/services/util-crypto/service-rpc.mjs +2 -7
  23. package/lib/src/services/blockchain/service.d.ts +1 -0
  24. package/lib/src/services/blockchain/service.d.ts.map +1 -1
  25. package/lib/src/services/credential/pex-helpers.d.ts +13 -1
  26. package/lib/src/services/credential/pex-helpers.d.ts.map +1 -1
  27. package/lib/src/services/dids/service-rpc.d.ts +0 -1
  28. package/lib/src/services/dids/service-rpc.d.ts.map +1 -1
  29. package/lib/src/services/dids/service.d.ts +5 -2
  30. package/lib/src/services/dids/service.d.ts.map +1 -1
  31. package/lib/tsconfig.tsbuildinfo +1 -1
  32. package/package.json +5 -5
  33. package/src/services/blockchain/service-rpc.js +4 -0
  34. package/src/services/blockchain/service.ts +5 -4
  35. package/src/services/credential/pex-helpers.js +20 -1
  36. package/src/services/credential/pex-helpers.test.js +114 -0
  37. package/src/services/credential/service.ts +2 -2
  38. package/src/services/credential/utils.js +8 -8
  39. package/src/services/dids/index.test.js +37 -14
  40. package/src/services/dids/service-rpc.ts +0 -3
  41. package/src/services/dids/service.ts +1 -9
  42. package/src/services/util-crypto/service-rpc.js +2 -7
@@ -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);
@@ -111,9 +111,7 @@ class BlockchainService {
111
111
  core_logger.Logger.info(`Cheqd initialized at: ${checkdApiUrl}`);
112
112
  }
113
113
  catch (err) {
114
- console.error(err);
115
- debugger;
116
- core_logger.Logger.error(`Failed to initialize cheqd at: ${checkdApiUrl}`);
114
+ core_logger.Logger.error(`Failed to initialize cheqd at: ${checkdApiUrl}`, err);
117
115
  }
118
116
  this.resolver = this.createDIDResolver();
119
117
  if (process.env.NODE_ENV !== 'test' ||
@@ -145,6 +143,9 @@ class BlockchainService {
145
143
  }
146
144
  });
147
145
  }
146
+ async resolveDID(did) {
147
+ return this.resolver.resolve(did);
148
+ }
148
149
  /**
149
150
  *
150
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);
@@ -107,9 +107,7 @@ class BlockchainService {
107
107
  Logger.info(`Cheqd initialized at: ${checkdApiUrl}`);
108
108
  }
109
109
  catch (err) {
110
- console.error(err);
111
- debugger;
112
- Logger.error(`Failed to initialize cheqd at: ${checkdApiUrl}`);
110
+ Logger.error(`Failed to initialize cheqd at: ${checkdApiUrl}`, err);
113
111
  }
114
112
  this.resolver = this.createDIDResolver();
115
113
  if (process.env.NODE_ENV !== 'test' ||
@@ -141,6 +139,9 @@ class BlockchainService {
141
139
  }
142
140
  });
143
141
  }
142
+ async resolveDID(did) {
143
+ return this.resolver.resolve(did);
144
+ }
144
145
  /**
145
146
  *
146
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)) {
@@ -11,8 +11,6 @@ var ed25519VerificationKey2018 = require('@digitalbazaar/ed25519-verification-ke
11
11
  var ed25519VerificationKey2020 = require('@digitalbazaar/ed25519-verification-key-2020');
12
12
  var keypairs = require('@docknetwork/credential-sdk/keypairs');
13
13
 
14
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
-
16
14
  function _interopNamespace(e) {
17
15
  if (e && e.__esModule) return e;
18
16
  var n = Object.create(null);
@@ -32,10 +30,6 @@ function _interopNamespace(e) {
32
30
  }
33
31
 
34
32
  var bs58__namespace = /*#__PURE__*/_interopNamespace(bs58);
35
- var x25519KeyAgreementKey2020__default = /*#__PURE__*/_interopDefaultLegacy(x25519KeyAgreementKey2020);
36
- var x25519KeyAgreementKey2019__default = /*#__PURE__*/_interopDefaultLegacy(x25519KeyAgreementKey2019);
37
- var ed25519VerificationKey2018__default = /*#__PURE__*/_interopDefaultLegacy(ed25519VerificationKey2018);
38
- var ed25519VerificationKey2020__default = /*#__PURE__*/_interopDefaultLegacy(ed25519VerificationKey2020);
39
33
 
40
34
  async function keyDocToKeypair(keyDoc) {
41
35
  if (keyDoc.keypair) {
@@ -87,13 +81,13 @@ async function keyDocToKeypair(keyDoc) {
87
81
 
88
82
  const keyConstructors = {
89
83
  Ed25519VerificationKey2018: keypairOptions =>
90
- new ed25519VerificationKey2018__default["default"].Ed25519VerificationKey2018(keypairOptions),
84
+ new ed25519VerificationKey2018.Ed25519VerificationKey2018(keypairOptions),
91
85
  Ed25519VerificationKey2020: keypairOptions =>
92
- new ed25519VerificationKey2020__default["default"].Ed25519VerificationKey2020(keypairOptions),
86
+ new ed25519VerificationKey2020.Ed25519VerificationKey2020(keypairOptions),
93
87
  X25519KeyAgreementKey2019: keypairOptions =>
94
- new x25519KeyAgreementKey2019__default["default"].X25519KeyAgreementKey2019(keypairOptions),
88
+ new x25519KeyAgreementKey2019.X25519KeyAgreementKey2019(keypairOptions),
95
89
  X25519KeyAgreementKey2020: keypairOptions =>
96
- new x25519KeyAgreementKey2020__default["default"].X25519KeyAgreementKey2020(keypairOptions),
90
+ new x25519KeyAgreementKey2020.X25519KeyAgreementKey2020(keypairOptions),
97
91
  };
98
92
 
99
93
  function getKeypairFromDoc(keypairOptions) {
@@ -1,10 +1,10 @@
1
1
  import * as bs58 from 'base58-universal';
2
2
  import { Bls12381G2KeyPairDock2022, Bls12381BBSKeyPairDock2023, Bls12381BBDT16KeyPairDock2024 } from '@docknetwork/credential-sdk/vc/crypto';
3
3
  import { randomAsHex } from '@docknetwork/credential-sdk/utils';
4
- import x25519KeyAgreementKey2020 from '@digitalbazaar/x25519-key-agreement-key-2020';
5
- import x25519KeyAgreementKey2019 from '@digitalbazaar/x25519-key-agreement-key-2019';
6
- import ed25519VerificationKey2018 from '@digitalbazaar/ed25519-verification-key-2018';
7
- import ed25519VerificationKey2020 from '@digitalbazaar/ed25519-verification-key-2020';
4
+ import { X25519KeyAgreementKey2020 } from '@digitalbazaar/x25519-key-agreement-key-2020';
5
+ import { X25519KeyAgreementKey2019 } from '@digitalbazaar/x25519-key-agreement-key-2019';
6
+ import { Ed25519VerificationKey2018 } from '@digitalbazaar/ed25519-verification-key-2018';
7
+ import { Ed25519VerificationKey2020 } from '@digitalbazaar/ed25519-verification-key-2020';
8
8
  import { Ed25519Keypair } from '@docknetwork/credential-sdk/keypairs';
9
9
 
10
10
  async function keyDocToKeypair(keyDoc) {
@@ -57,13 +57,13 @@ async function keyDocToKeypair(keyDoc) {
57
57
 
58
58
  const keyConstructors = {
59
59
  Ed25519VerificationKey2018: keypairOptions =>
60
- new ed25519VerificationKey2018.Ed25519VerificationKey2018(keypairOptions),
60
+ new Ed25519VerificationKey2018(keypairOptions),
61
61
  Ed25519VerificationKey2020: keypairOptions =>
62
- new ed25519VerificationKey2020.Ed25519VerificationKey2020(keypairOptions),
62
+ new Ed25519VerificationKey2020(keypairOptions),
63
63
  X25519KeyAgreementKey2019: keypairOptions =>
64
- new x25519KeyAgreementKey2019.X25519KeyAgreementKey2019(keypairOptions),
64
+ new X25519KeyAgreementKey2019(keypairOptions),
65
65
  X25519KeyAgreementKey2020: keypairOptions =>
66
- new x25519KeyAgreementKey2020.X25519KeyAgreementKey2020(keypairOptions),
66
+ new X25519KeyAgreementKey2020(keypairOptions),
67
67
  };
68
68
 
69
69
  function getKeypairFromDoc(keypairOptions) {
@@ -6,27 +6,12 @@ var services_dids_service = require('./service.js');
6
6
  require('@docknetwork/wallet-sdk-dids/lib');
7
7
  require('./config.js');
8
8
  require('assert');
9
- require('../blockchain/service.js');
10
- require('@cosmjs/proto-signing');
11
- require('@docknetwork/cheqd-blockchain-api');
12
- require('@docknetwork/cheqd-blockchain-modules');
13
- require('@docknetwork/credential-sdk/modules');
14
- require('@docknetwork/credential-sdk/resolver');
15
- require('@docknetwork/crypto-wasm-ts/lib/index');
16
- require('events');
17
- require('../../core/logger.js');
18
- require('../../modules/event-manager.js');
19
- require('../util-crypto/service.js');
20
- require('@docknetwork/credential-sdk/utils');
21
- require('@scure/bip39');
22
- require('@scure/bip39/wordlists/english');
23
- require('../util-crypto/configs.js');
24
- require('@docknetwork/credential-sdk/types');
25
9
  require('@docknetwork/credential-sdk/keypairs');
26
10
  require('base64url');
27
11
  require('../credential/utils.js');
28
12
  require('base58-universal');
29
13
  require('@docknetwork/credential-sdk/vc/crypto');
14
+ require('@docknetwork/credential-sdk/utils');
30
15
  require('@digitalbazaar/x25519-key-agreement-key-2020');
31
16
  require('@digitalbazaar/x25519-key-agreement-key-2019');
32
17
  require('@digitalbazaar/ed25519-verification-key-2018');
@@ -2,27 +2,12 @@ import { didService } from './service.mjs';
2
2
  import '@docknetwork/wallet-sdk-dids/lib';
3
3
  import './config.mjs';
4
4
  import 'assert';
5
- import '../blockchain/service.mjs';
6
- import '@cosmjs/proto-signing';
7
- import '@docknetwork/cheqd-blockchain-api';
8
- import '@docknetwork/cheqd-blockchain-modules';
9
- import '@docknetwork/credential-sdk/modules';
10
- import '@docknetwork/credential-sdk/resolver';
11
- import '@docknetwork/crypto-wasm-ts/lib/index';
12
- import 'events';
13
- import '../../core/logger.mjs';
14
- import '../../modules/event-manager.mjs';
15
- import '../util-crypto/service.mjs';
16
- import '@docknetwork/credential-sdk/utils';
17
- import '@scure/bip39';
18
- import '@scure/bip39/wordlists/english';
19
- import '../util-crypto/configs.mjs';
20
- import '@docknetwork/credential-sdk/types';
21
5
  import '@docknetwork/credential-sdk/keypairs';
22
6
  import 'base64url';
23
7
  import '../credential/utils.mjs';
24
8
  import 'base58-universal';
25
9
  import '@docknetwork/credential-sdk/vc/crypto';
10
+ import '@docknetwork/credential-sdk/utils';
26
11
  import '@digitalbazaar/x25519-key-agreement-key-2020';
27
12
  import '@digitalbazaar/x25519-key-agreement-key-2019';
28
13
  import '@digitalbazaar/ed25519-verification-key-2018';
@@ -29,9 +29,6 @@ class DIDServiceRPC extends services_rpcServiceClient.RpcService {
29
29
  deriveKeyDoc(params) {
30
30
  return this.call('deriveKeyDoc', params);
31
31
  }
32
- getDidDockDocument(did) {
33
- return this.call('getDidDockDocument', did);
34
- }
35
32
  createSignedJWT(params) {
36
33
  return this.call('createSignedJWT', params);
37
34
  }
@@ -25,9 +25,6 @@ class DIDServiceRPC extends RpcService {
25
25
  deriveKeyDoc(params) {
26
26
  return this.call('deriveKeyDoc', params);
27
27
  }
28
- getDidDockDocument(did) {
29
- return this.call('getDidDockDocument', did);
30
- }
31
28
  createSignedJWT(params) {
32
29
  return this.call('createSignedJWT', params);
33
30
  }
@@ -4,29 +4,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var src = require('@docknetwork/wallet-sdk-dids/lib');
6
6
  var services_dids_config = require('./config.js');
7
- var assert = require('assert');
8
- var services_blockchain_service = require('../blockchain/service.js');
9
7
  var keypairs = require('@docknetwork/credential-sdk/keypairs');
10
8
  var base64url = require('base64url');
11
9
  var services_credential_utils = require('../credential/utils.js');
12
10
  var crypto = require('@docknetwork/credential-sdk/vc/crypto');
13
11
  var services_dids_keypairUtils = require('./keypair-utils.js');
14
- require('@cosmjs/proto-signing');
15
- require('@docknetwork/cheqd-blockchain-api');
16
- require('@docknetwork/cheqd-blockchain-modules');
17
- require('@docknetwork/credential-sdk/modules');
18
- require('@docknetwork/credential-sdk/resolver');
19
- require('@docknetwork/crypto-wasm-ts/lib/index');
20
- require('events');
21
- require('../../core/logger.js');
22
- require('../../modules/event-manager.js');
23
- require('../util-crypto/service.js');
24
- require('@docknetwork/credential-sdk/utils');
25
- require('@scure/bip39');
26
- require('@scure/bip39/wordlists/english');
27
- require('../util-crypto/configs.js');
28
- require('@docknetwork/credential-sdk/types');
12
+ require('assert');
29
13
  require('base58-universal');
14
+ require('@docknetwork/credential-sdk/utils');
30
15
  require('@digitalbazaar/x25519-key-agreement-key-2020');
31
16
  require('@digitalbazaar/x25519-key-agreement-key-2019');
32
17
  require('@digitalbazaar/ed25519-verification-key-2018');
@@ -34,12 +19,11 @@ require('@digitalbazaar/ed25519-verification-key-2020');
34
19
 
35
20
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
36
21
 
37
- var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert);
38
22
  var base64url__default = /*#__PURE__*/_interopDefaultLegacy(base64url);
39
23
 
40
24
  // @ts-nocheck
41
25
  async function getSignerKeypair(privateKeyDoc) {
42
- const privateKey = privateKeyDoc.keypair || services_credential_utils.keyDocToKeypair(privateKeyDoc, services_blockchain_service.blockchainService.dock);
26
+ const privateKey = privateKeyDoc.keypair || await services_credential_utils.keyDocToKeypair(privateKeyDoc);
43
27
  if (!privateKey.signer && privateKey.sign) {
44
28
  privateKey.signer = () => ({ sign: ({ data }) => privateKey.sign(data) });
45
29
  }
@@ -70,7 +54,6 @@ class DIDService {
70
54
  DIDService.prototype.getDIDResolution,
71
55
  DIDService.prototype.generateKeyDoc,
72
56
  DIDService.prototype.deriveKeyDoc,
73
- DIDService.prototype.getDidDockDocument,
74
57
  DIDService.prototype.createSignedJWT,
75
58
  ];
76
59
  keypairToDIDKeyDocument(params) {
@@ -111,12 +94,6 @@ class DIDService {
111
94
  const signature = await sign({ data: signPayload });
112
95
  return `${headerAndPayloadBase64URL}.${base64url__default["default"].encode(signature)}`;
113
96
  }
114
- async getDidDockDocument(did) {
115
- assert__default["default"](!!did, 'DID is required');
116
- services_blockchain_service.blockchainService.dock;
117
- const result = await services_blockchain_service.blockchainService.modules.did.getDocument(did);
118
- return result;
119
- }
120
97
  }
121
98
  const didService = new DIDService();
122
99
 
@@ -1,28 +1,13 @@
1
1
  import { DIDKeyManager } from '@docknetwork/wallet-sdk-dids/lib';
2
2
  import { serviceName, validation } from './config.mjs';
3
- import assert from 'assert';
4
- import { blockchainService } from '../blockchain/service.mjs';
5
3
  import { Ed25519Keypair } from '@docknetwork/credential-sdk/keypairs';
6
4
  import base64url from 'base64url';
7
5
  import { keyDocToKeypair } from '../credential/utils.mjs';
8
6
  import { Ed25519Signature2020, EcdsaSecp256k1Signature2019 } from '@docknetwork/credential-sdk/vc/crypto';
9
7
  import { keypairToKeydoc } from './keypair-utils.mjs';
10
- import '@cosmjs/proto-signing';
11
- import '@docknetwork/cheqd-blockchain-api';
12
- import '@docknetwork/cheqd-blockchain-modules';
13
- import '@docknetwork/credential-sdk/modules';
14
- import '@docknetwork/credential-sdk/resolver';
15
- import '@docknetwork/crypto-wasm-ts/lib/index';
16
- import 'events';
17
- import '../../core/logger.mjs';
18
- import '../../modules/event-manager.mjs';
19
- import '../util-crypto/service.mjs';
20
- import '@docknetwork/credential-sdk/utils';
21
- import '@scure/bip39';
22
- import '@scure/bip39/wordlists/english';
23
- import '../util-crypto/configs.mjs';
24
- import '@docknetwork/credential-sdk/types';
8
+ import 'assert';
25
9
  import 'base58-universal';
10
+ import '@docknetwork/credential-sdk/utils';
26
11
  import '@digitalbazaar/x25519-key-agreement-key-2020';
27
12
  import '@digitalbazaar/x25519-key-agreement-key-2019';
28
13
  import '@digitalbazaar/ed25519-verification-key-2018';
@@ -30,7 +15,7 @@ import '@digitalbazaar/ed25519-verification-key-2020';
30
15
 
31
16
  // @ts-nocheck
32
17
  async function getSignerKeypair(privateKeyDoc) {
33
- const privateKey = privateKeyDoc.keypair || keyDocToKeypair(privateKeyDoc, blockchainService.dock);
18
+ const privateKey = privateKeyDoc.keypair || await keyDocToKeypair(privateKeyDoc);
34
19
  if (!privateKey.signer && privateKey.sign) {
35
20
  privateKey.signer = () => ({ sign: ({ data }) => privateKey.sign(data) });
36
21
  }
@@ -61,7 +46,6 @@ class DIDService {
61
46
  DIDService.prototype.getDIDResolution,
62
47
  DIDService.prototype.generateKeyDoc,
63
48
  DIDService.prototype.deriveKeyDoc,
64
- DIDService.prototype.getDidDockDocument,
65
49
  DIDService.prototype.createSignedJWT,
66
50
  ];
67
51
  keypairToDIDKeyDocument(params) {
@@ -102,12 +86,6 @@ class DIDService {
102
86
  const signature = await sign({ data: signPayload });
103
87
  return `${headerAndPayloadBase64URL}.${base64url.encode(signature)}`;
104
88
  }
105
- async getDidDockDocument(did) {
106
- assert(!!did, 'DID is required');
107
- blockchainService.dock;
108
- const result = await blockchainService.modules.did.getDocument(did);
109
- return result;
110
- }
111
89
  }
112
90
  const didService = new DIDService();
113
91
 
@@ -17,27 +17,12 @@ require('@docknetwork/wallet-sdk-data-store/lib/logger');
17
17
  require('../dids/service.js');
18
18
  require('@docknetwork/wallet-sdk-dids/lib');
19
19
  require('../dids/config.js');
20
- require('../blockchain/service.js');
21
- require('@cosmjs/proto-signing');
22
- require('@docknetwork/cheqd-blockchain-api');
23
- require('@docknetwork/cheqd-blockchain-modules');
24
- require('@docknetwork/credential-sdk/modules');
25
- require('@docknetwork/credential-sdk/resolver');
26
- require('@docknetwork/crypto-wasm-ts/lib/index');
27
- require('events');
28
- require('../../core/logger.js');
29
- require('../../modules/event-manager.js');
30
- require('../util-crypto/service.js');
31
- require('@docknetwork/credential-sdk/utils');
32
- require('@scure/bip39');
33
- require('@scure/bip39/wordlists/english');
34
- require('../util-crypto/configs.js');
35
- require('@docknetwork/credential-sdk/types');
36
20
  require('@docknetwork/credential-sdk/keypairs');
37
21
  require('base64url');
38
22
  require('../credential/utils.js');
39
23
  require('base58-universal');
40
24
  require('@docknetwork/credential-sdk/vc/crypto');
25
+ require('@docknetwork/credential-sdk/utils');
41
26
  require('@digitalbazaar/x25519-key-agreement-key-2019');
42
27
  require('../dids/keypair-utils.js');
43
28
 
@@ -13,26 +13,11 @@ import '@docknetwork/wallet-sdk-data-store/lib/logger';
13
13
  import '../dids/service.mjs';
14
14
  import '@docknetwork/wallet-sdk-dids/lib';
15
15
  import '../dids/config.mjs';
16
- import '../blockchain/service.mjs';
17
- import '@cosmjs/proto-signing';
18
- import '@docknetwork/cheqd-blockchain-api';
19
- import '@docknetwork/cheqd-blockchain-modules';
20
- import '@docknetwork/credential-sdk/modules';
21
- import '@docknetwork/credential-sdk/resolver';
22
- import '@docknetwork/crypto-wasm-ts/lib/index';
23
- import 'events';
24
- import '../../core/logger.mjs';
25
- import '../../modules/event-manager.mjs';
26
- import '../util-crypto/service.mjs';
27
- import '@docknetwork/credential-sdk/utils';
28
- import '@scure/bip39';
29
- import '@scure/bip39/wordlists/english';
30
- import '../util-crypto/configs.mjs';
31
- import '@docknetwork/credential-sdk/types';
32
16
  import '@docknetwork/credential-sdk/keypairs';
33
17
  import 'base64url';
34
18
  import '../credential/utils.mjs';
35
19
  import 'base58-universal';
36
20
  import '@docknetwork/credential-sdk/vc/crypto';
21
+ import '@docknetwork/credential-sdk/utils';
37
22
  import '@digitalbazaar/x25519-key-agreement-key-2019';
38
23
  import '../dids/keypair-utils.mjs';
@@ -17,26 +17,11 @@ require('base64url-universal');
17
17
  require('@docknetwork/universal-wallet/crypto');
18
18
  require('@docknetwork/wallet-sdk-dids/lib');
19
19
  require('../dids/config.js');
20
- require('../blockchain/service.js');
21
- require('@cosmjs/proto-signing');
22
- require('@docknetwork/cheqd-blockchain-api');
23
- require('@docknetwork/cheqd-blockchain-modules');
24
- require('@docknetwork/credential-sdk/modules');
25
- require('@docknetwork/credential-sdk/resolver');
26
- require('@docknetwork/crypto-wasm-ts/lib/index');
27
- require('events');
28
- require('../../core/logger.js');
29
- require('../../modules/event-manager.js');
30
- require('../util-crypto/service.js');
31
- require('@docknetwork/credential-sdk/utils');
32
- require('@scure/bip39');
33
- require('@scure/bip39/wordlists/english');
34
- require('../util-crypto/configs.js');
35
- require('@docknetwork/credential-sdk/types');
36
20
  require('base64url');
37
21
  require('../credential/utils.js');
38
22
  require('base58-universal');
39
23
  require('@docknetwork/credential-sdk/vc/crypto');
24
+ require('@docknetwork/credential-sdk/utils');
40
25
  require('@digitalbazaar/x25519-key-agreement-key-2019');
41
26
  require('../dids/keypair-utils.js');
42
27
 
@@ -13,26 +13,11 @@ import 'base64url-universal';
13
13
  import '@docknetwork/universal-wallet/crypto';
14
14
  import '@docknetwork/wallet-sdk-dids/lib';
15
15
  import '../dids/config.mjs';
16
- import '../blockchain/service.mjs';
17
- import '@cosmjs/proto-signing';
18
- import '@docknetwork/cheqd-blockchain-api';
19
- import '@docknetwork/cheqd-blockchain-modules';
20
- import '@docknetwork/credential-sdk/modules';
21
- import '@docknetwork/credential-sdk/resolver';
22
- import '@docknetwork/crypto-wasm-ts/lib/index';
23
- import 'events';
24
- import '../../core/logger.mjs';
25
- import '../../modules/event-manager.mjs';
26
- import '../util-crypto/service.mjs';
27
- import '@docknetwork/credential-sdk/utils';
28
- import '@scure/bip39';
29
- import '@scure/bip39/wordlists/english';
30
- import '../util-crypto/configs.mjs';
31
- import '@docknetwork/credential-sdk/types';
32
16
  import 'base64url';
33
17
  import '../credential/utils.mjs';
34
18
  import 'base58-universal';
35
19
  import '@docknetwork/credential-sdk/vc/crypto';
20
+ import '@docknetwork/credential-sdk/utils';
36
21
  import '@digitalbazaar/x25519-key-agreement-key-2019';
37
22
  import '../dids/keypair-utils.mjs';
38
23
 
@@ -30,17 +30,12 @@ class UtilCryptoServiceRpc extends services_rpcServiceClient.RpcService {
30
30
  return this.call('mnemonicToMiniSecret', phrase);
31
31
  }
32
32
 
33
- deriveValidate(uri ) {
34
- services_utilCrypto_configs.validation.deriveValidate(uri);
35
- return this.call('deriveValidate', uri);
36
- }
37
-
38
33
  isBase64(value ) {
39
34
  return this.call('isBase64', value);
40
35
  }
41
36
 
42
- getAddressPrefix(params ) {
43
- return this.call('getAddressPrefix', params);
37
+ hexToString(hex ) {
38
+ return this.call('hexToString', hex);
44
39
  }
45
40
  }
46
41
 
@@ -26,17 +26,12 @@ class UtilCryptoServiceRpc extends RpcService {
26
26
  return this.call('mnemonicToMiniSecret', phrase);
27
27
  }
28
28
 
29
- deriveValidate(uri ) {
30
- validation.deriveValidate(uri);
31
- return this.call('deriveValidate', uri);
32
- }
33
-
34
29
  isBase64(value ) {
35
30
  return this.call('isBase64', value);
36
31
  }
37
32
 
38
- getAddressPrefix(params ) {
39
- return this.call('getAddressPrefix', params);
33
+ hexToString(hex ) {
34
+ return this.call('hexToString', hex);
40
35
  }
41
36
  }
42
37