@docknetwork/wallet-sdk-wasm 1.5.14 → 1.7.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.
Files changed (91) hide show
  1. package/generate-docs.js +49 -0
  2. package/jsdoc.conf.json +29 -6
  3. package/lib/index.js +8 -1
  4. package/lib/index.mjs +8 -1
  5. package/lib/rpc-server.js +10 -1
  6. package/lib/rpc-server.mjs +10 -1
  7. package/lib/services/blockchain/cached-did-resolver.js +113 -0
  8. package/lib/services/blockchain/cached-did-resolver.mjs +109 -0
  9. package/lib/services/blockchain/index.js +11 -0
  10. package/lib/services/blockchain/index.mjs +11 -0
  11. package/lib/services/blockchain/service-rpc.js +12 -0
  12. package/lib/services/blockchain/service-rpc.mjs +12 -0
  13. package/lib/services/blockchain/service.js +140 -11
  14. package/lib/services/blockchain/service.mjs +140 -11
  15. package/lib/services/credential/bbs-revocation.js +11 -0
  16. package/lib/services/credential/bbs-revocation.mjs +11 -0
  17. package/lib/services/credential/config.js +4 -1
  18. package/lib/services/credential/config.mjs +4 -1
  19. package/lib/services/credential/index.js +14 -0
  20. package/lib/services/credential/index.mjs +14 -0
  21. package/lib/services/credential/sd-jwt.js +214 -0
  22. package/lib/services/credential/sd-jwt.mjs +200 -0
  23. package/lib/services/credential/service-rpc.js +9 -0
  24. package/lib/services/credential/service-rpc.mjs +9 -0
  25. package/lib/services/credential/service.js +324 -7
  26. package/lib/services/credential/service.mjs +324 -7
  27. package/lib/services/edv/service.js +145 -1
  28. package/lib/services/edv/service.mjs +145 -1
  29. package/lib/services/index.js +13 -0
  30. package/lib/services/index.mjs +13 -0
  31. package/lib/services/relay-service/service.js +124 -1
  32. package/lib/services/relay-service/service.mjs +124 -1
  33. package/lib/services/rpc-service-client.js +0 -3
  34. package/lib/services/rpc-service-client.mjs +0 -3
  35. package/lib/services/storage/index.js +19 -2
  36. package/lib/services/storage/index.mjs +24 -1
  37. package/lib/services/storage/service-rpc.js +7 -3
  38. package/lib/services/storage/service-rpc.mjs +7 -3
  39. package/lib/services/storage/service.js +4 -0
  40. package/lib/services/storage/service.mjs +4 -0
  41. package/lib/setup-nodejs.js +8 -1
  42. package/lib/setup-nodejs.mjs +8 -1
  43. package/lib/setup-tests.js +8 -1
  44. package/lib/setup-tests.mjs +8 -1
  45. package/lib/src/services/blockchain/cached-did-resolver.d.ts +28 -0
  46. package/lib/src/services/blockchain/cached-did-resolver.d.ts.map +1 -0
  47. package/lib/src/services/blockchain/cached-did-resolver.test.d.ts +2 -0
  48. package/lib/src/services/blockchain/cached-did-resolver.test.d.ts.map +1 -0
  49. package/lib/src/services/blockchain/service.d.ts +114 -17
  50. package/lib/src/services/blockchain/service.d.ts.map +1 -1
  51. package/lib/src/services/credential/config.d.ts.map +1 -1
  52. package/lib/src/services/credential/index.d.ts +3 -0
  53. package/lib/src/services/credential/index.d.ts.map +1 -1
  54. package/lib/src/services/credential/sd-jwt.test.d.ts +2 -0
  55. package/lib/src/services/credential/sd-jwt.test.d.ts.map +1 -0
  56. package/lib/src/services/credential/service.d.ts +274 -4
  57. package/lib/src/services/credential/service.d.ts.map +1 -1
  58. package/lib/src/services/edv/service.d.ts +151 -1
  59. package/lib/src/services/edv/service.d.ts.map +1 -1
  60. package/lib/src/services/relay-service/service.d.ts +129 -1
  61. package/lib/src/services/relay-service/service.d.ts.map +1 -1
  62. package/lib/src/services/rpc-service-client.d.ts +2 -2
  63. package/lib/src/services/rpc-service-client.d.ts.map +1 -1
  64. package/lib/src/services/storage/index.d.ts +1 -1
  65. package/lib/src/services/storage/index.d.ts.map +1 -1
  66. package/lib/src/services/storage/service-rpc.d.ts +9 -0
  67. package/lib/src/services/storage/service-rpc.d.ts.map +1 -0
  68. package/lib/src/services/storage/service.d.ts +1 -0
  69. package/lib/src/services/storage/service.d.ts.map +1 -1
  70. package/lib/src/services/util-crypto/service.d.ts +1 -1
  71. package/lib/tsconfig.tsbuildinfo +1 -1
  72. package/lib/wallet/rpc-storage-interface.js +13 -3
  73. package/lib/wallet/rpc-storage-interface.mjs +11 -1
  74. package/lib/wallet/rpc-storage-wallet.js +10 -0
  75. package/lib/wallet/rpc-storage-wallet.mjs +10 -0
  76. package/package.json +13 -8
  77. package/src/services/blockchain/cached-did-resolver.test.ts +288 -0
  78. package/src/services/blockchain/cached-did-resolver.ts +126 -0
  79. package/src/services/blockchain/service-rpc.js +12 -0
  80. package/src/services/blockchain/service.ts +142 -11
  81. package/src/services/credential/config.ts +7 -1
  82. package/src/services/credential/sd-jwt.test.ts +718 -0
  83. package/src/services/credential/sd-jwt.ts +231 -0
  84. package/src/services/credential/service-rpc.js +9 -0
  85. package/src/services/credential/service.ts +328 -7
  86. package/src/services/edv/service.ts +153 -1
  87. package/src/services/relay-service/service.ts +130 -1
  88. package/src/services/rpc-service-client.js +0 -3
  89. package/src/services/storage/index.js +15 -1
  90. package/src/services/storage/service-rpc.js +7 -3
  91. package/src/services/storage/service.ts +5 -0
@@ -1,43 +1,313 @@
1
+ /**
2
+ * Checks if a credential uses BBS+ signature
3
+ * @param {Object} credential - The credential to check
4
+ * @returns {boolean} True if the credential uses BBS+ signature
5
+ * @example
6
+ * const isBBS = isBBSPlusCredential(credential);
7
+ * if (isBBS) {
8
+ * console.log('This credential uses BBS+ signatures');
9
+ * }
10
+ */
1
11
  export declare function isBBSPlusCredential(credential: any): any;
12
+ /**
13
+ * Checks if a credential uses KVAC (BBDT16) signature
14
+ * @param {Object} credential - The credential to check
15
+ * @returns {boolean} True if the credential uses KVAC signature
16
+ * @example
17
+ * const isKVAC = isKvacCredential(credential);
18
+ */
2
19
  export declare function isKvacCredential(credential: any): any;
20
+ /**
21
+ * Checks if a credential is anonymous (BBS+ or KVAC)
22
+ * @param {Object} credential - The credential to check
23
+ * @returns {boolean} True if the credential is anonymous
24
+ * @example
25
+ * if (isAnnonymousCredential(credential)) {
26
+ * console.log('This credential supports selective disclosure');
27
+ * }
28
+ */
3
29
  export declare function isAnnonymousCredential(credential: any): any;
30
+ /**
31
+ * Service class for managing verifiable credentials
32
+ * @class
33
+ * @description Provides methods for creating, signing, verifying, and presenting
34
+ * verifiable credentials with support for various signature types
35
+ */
4
36
  declare class CredentialService {
37
+ /**
38
+ * Creates a new CredentialService instance
39
+ * @constructor
40
+ */
5
41
  constructor();
6
42
  rpcMethods: ((params?: {}) => any)[];
43
+ createSDJWTPresentation(params: any): Promise<string>;
44
+ /**
45
+ * Generates a new verifiable credential template
46
+ * @param {Object} [params={}] - Generation parameters
47
+ * @param {Object} [params.subject] - The credential subject
48
+ * @returns {VerifiableCredential} A new verifiable credential instance
49
+ * @example
50
+ * const credential = credentialService.generateCredential({
51
+ * subject: { id: 'did:example:123', name: 'Alice' }
52
+ * });
53
+ */
7
54
  generateCredential(params?: {}): any;
55
+ /**
56
+ * Signs a verifiable credential
57
+ * @param {Object} params - Signing parameters
58
+ * @param {Object} params.vcJson - The credential JSON to sign
59
+ * @param {Object} params.keyDoc - The key document for signing
60
+ * @returns {Promise<VerifiableCredential>} The signed verifiable credential
61
+ * @throws {Error} If validation fails or signing fails
62
+ * @example
63
+ * const signedCredential = await credentialService.signCredential({
64
+ * vcJson: credentialData,
65
+ * keyDoc: issuerKeyDocument
66
+ * });
67
+ */
8
68
  signCredential(params: any): Promise<any>;
69
+ /**
70
+ * Creates a verifiable presentation from credentials
71
+ * @param {Object} params - Presentation parameters
72
+ * @param {Array<Object>} params.credentials - Array of verifiable credentials to include
73
+ * @param {Object} params.keyDoc - The key document for signing the presentation
74
+ * @param {string} [params.challenge] - Challenge string for the presentation proof
75
+ * @param {string} [params.id] - Presentation identifier
76
+ * @param {string} [params.domain] - Domain for the presentation proof
77
+ * @returns {Promise<Object>} The signed verifiable presentation
78
+ * @throws {Error} If validation fails
79
+ * @example
80
+ * const presentation = await credentialService.createPresentation({
81
+ * credentials: [credential1, credential2],
82
+ * keyDoc: holderKeyDocument,
83
+ * challenge: 'abc123',
84
+ * domain: 'example.com'
85
+ * });
86
+ */
9
87
  createPresentation(params: any): Promise<any>;
88
+ /**
89
+ * Verifies a verifiable presentation
90
+ * @param {Object} params - Verification parameters
91
+ * @param {Object} params.presentation - The presentation to verify
92
+ * @param {Object} [params.options] - Verification options
93
+ * @returns {Promise<Object>} Verification result with verified status and any errors
94
+ * @example
95
+ * const result = await credentialService.verifyPresentation({
96
+ * presentation: presentationData
97
+ * });
98
+ * console.log('Verified:', result.verified);
99
+ */
10
100
  verifyPresentation({ presentation, options }: any): Promise<any>;
101
+ /**
102
+ * Verifies a verifiable credential including revocation check
103
+ * @param {Object} params - Verification parameters
104
+ * @param {Object} params.credential - The credential to verify
105
+ * @param {Object} [params.membershipWitness] - Membership witness for revocation check
106
+ * @returns {Promise<Object>} Verification result
107
+ * @returns {boolean} returns.verified - Whether the credential is valid
108
+ * @returns {string} [returns.error] - Error message if verification failed
109
+ * @throws {Error} If validation fails
110
+ * @example
111
+ * const result = await credentialService.verifyCredential({
112
+ * credential: credentialData,
113
+ * membershipWitness: witnessData
114
+ * });
115
+ * if (!result.verified) {
116
+ * console.error('Verification failed:', result.error);
117
+ * }
118
+ */
11
119
  verifyCredential(params: any): Promise<any>;
120
+ /**
121
+ * Filters credentials based on a presentation definition
122
+ * @param {Object} params - Filter parameters
123
+ * @param {Array<Object>} params.credentials - Array of credentials to filter
124
+ * @param {Object} params.presentationDefinition - PEX presentation definition
125
+ * @param {string} [params.holderDid] - DID of the credential holder
126
+ * @returns {Object} Filtered credentials matching the presentation definition
127
+ * @example
128
+ * const filtered = credentialService.filterCredentials({
129
+ * credentials: allCredentials,
130
+ * presentationDefinition: definition,
131
+ * holderDid: 'did:example:holder'
132
+ * });
133
+ */
12
134
  filterCredentials(params: any): import("@sphereon/pex").SelectResults;
135
+ /**
136
+ * Evaluates a presentation against a presentation definition
137
+ * @param {Object} params - Evaluation parameters
138
+ * @param {Object} params.presentation - The presentation to evaluate
139
+ * @param {Object} params.presentationDefinition - PEX presentation definition
140
+ * @returns {Object} Evaluation result with validation details
141
+ * @example
142
+ * const evaluation = credentialService.evaluatePresentation({
143
+ * presentation: presentationData,
144
+ * presentationDefinition: definition
145
+ * });
146
+ */
13
147
  evaluatePresentation(params: any): import("@sphereon/pex").EvaluationResults;
148
+ /**
149
+ * Checks if a credential uses BBS+ signature
150
+ * @param {Object} params - Check parameters
151
+ * @param {Object} params.credential - The credential to check
152
+ * @returns {boolean} True if the credential uses BBS+ signature
153
+ */
14
154
  isBBSPlusCredential(params: any): any;
155
+ /**
156
+ * Checks if a credential uses KVAC signature
157
+ * @param {Object} params - Check parameters
158
+ * @param {Object} params.credential - The credential to check
159
+ * @returns {boolean} True if the credential uses KVAC signature
160
+ */
15
161
  isKvacCredential(params: any): any;
162
+ /**
163
+ * Checks if a credential is an SD-JWT (Selective Disclosure JWT) credential
164
+ * @param {Object} params - Check parameters
165
+ * @param {string} params.credential - The JWT string to check
166
+ * @returns {boolean} True if the credential is an SD-JWT credential
167
+ * @example
168
+ * const isSDJWT = credentialService.isSDJWTCredential({
169
+ * credential: 'eyJ0eXAiOiJ2YytzZC1qd3Q...'
170
+ * });
171
+ */
172
+ isSDJWTCredential(params: any): boolean;
173
+ /**
174
+ * Converts a credential to W3C Verifiable Credential format
175
+ * @description Handles both SD-JWT credentials (needs decoding) and regular W3C credentials (returns as-is)
176
+ * @param {Object} params - Conversion parameters
177
+ * @param {string|Object} params.credential - Either an SD-JWT string or a credential object
178
+ * @returns {Promise<Object>} W3C Verifiable Credential format
179
+ * @throws {Error} If credential cannot be converted to W3C format
180
+ * @example
181
+ * // Convert SD-JWT to W3C format
182
+ * const w3cCredential = await credentialService.credentialToW3C({
183
+ * credential: 'eyJ0eXAiOiJ2YytzZC1qd3Q...'
184
+ * });
185
+ *
186
+ * // Returns W3C credential as-is
187
+ * const w3cCredential = await credentialService.credentialToW3C({
188
+ * credential: { '@context': [...], type: [...], ... }
189
+ * });
190
+ */
191
+ credentialToW3C(params: any): Promise<any>;
192
+ /**
193
+ * Acquires a credential through OpenID for Verifiable Credentials (OID4VC)
194
+ * @param {Object} params - Acquisition parameters
195
+ * @param {string} params.uri - The credential offer URI
196
+ * @param {string} [params.authorizationCode] - Authorization code if required
197
+ * @param {Object} params.holderKeyDocument - Key document for the credential holder
198
+ * @returns {Promise<Object>} Result containing the credential or authorization URL
199
+ * @returns {Object} [returns.credential] - The acquired credential
200
+ * @returns {string} [returns.authorizationURL] - Authorization URL if auth is required
201
+ * @example
202
+ * const result = await credentialService.acquireOIDCredential({
203
+ * uri: 'openid-credential-offer://...',
204
+ * holderKeyDocument: keyDoc
205
+ * });
206
+ */
16
207
  acquireOIDCredential({ uri, authorizationCode, holderKeyDocument, }: {
17
208
  uri: string;
18
209
  authorizationCode?: string;
19
210
  holderKeyDocument: any;
20
211
  }): Promise<any>;
212
+ /**
213
+ * Creates a BBS+ presentation with selective disclosure
214
+ * @param {Object} params - Presentation parameters
215
+ * @param {Array<Object>} params.credentials - Array of credentials with attributes to reveal
216
+ * @param {Object} params.credentials[].credential - The BBS+ credential
217
+ * @param {Array<string>} [params.credentials[].attributesToReveal] - Attributes to reveal
218
+ * @returns {Promise<Object>} The BBS+ presentation
219
+ * @throws {Error} If validation fails
220
+ * @example
221
+ * const presentation = await credentialService.createBBSPresentation({
222
+ * credentials: [{
223
+ * credential: bbsCredential,
224
+ * attributesToReveal: ['name', 'age']
225
+ * }]
226
+ * });
227
+ */
21
228
  createBBSPresentation(params: any): Promise<any>;
229
+ /**
230
+ * Gets the accumulator ID from a credential's status
231
+ * @param {Object} params - Parameters
232
+ * @param {Object} params.credential - The credential to get accumulator ID from
233
+ * @returns {string|null} The accumulator ID or null if not present
234
+ * @throws {Error} If credential is not provided
235
+ */
22
236
  getAccumulatorId({ credential }: {
23
237
  credential: any;
24
238
  }): any;
239
+ /**
240
+ * Gets accumulator data from the blockchain for a credential
241
+ * @param {Object} params - Parameters
242
+ * @param {Object} params.credential - The credential to get accumulator data for
243
+ * @returns {Promise<Object|null>} The accumulator data or null if not found
244
+ * @throws {Error} If credential is not provided
245
+ */
25
246
  getAccumulatorData({ credential }: {
26
247
  credential: any;
27
248
  }): Promise<any>;
28
249
  /**
29
- * Fetch the latest accumulator witness updates for a given credential and membership witness
30
- * The witness is generated by the issuer when the credential is created and is stored in the wallet when the credential is imported
31
- *
32
- * @param param0
250
+ * Updates the membership witness with the latest accumulator state
251
+ * @description The witness is generated by the issuer when the credential is created
252
+ * and is stored in the wallet when the credential is imported. This method updates
253
+ * it with the latest accumulator changes from the blockchain.
254
+ * @param {Object} params - Update parameters
255
+ * @param {Object} params.credential - The credential with revocation status
256
+ * @param {Object} params.membershipWitnessJSON - Current membership witness in JSON format
257
+ * @returns {Promise<Object>} Updated membership witness in JSON format
258
+ * @throws {Error} If updates cannot be fetched or applied
33
259
  */
34
260
  updateMembershipWitness({ credential, membershipWitnessJSON }: {
35
261
  credential: any;
36
262
  membershipWitnessJSON: any;
37
263
  }): Promise<any>;
264
+ /**
265
+ * Derives verifiable credentials from a presentation with selective disclosure
266
+ * @param {Object} params - Derivation parameters
267
+ * @param {Array<Object>} params.credentials - Array of credential objects
268
+ * @param {Object} params.credentials[].credential - The credential
269
+ * @param {Array<string>} params.credentials[].attributesToReveal - Attributes to reveal
270
+ * @param {Object} [params.credentials[].witness] - Membership witness for revocation
271
+ * @param {Object} [params.options={}] - Additional options for derivation
272
+ * @param {Object} [params.proofRequest] - Proof request with constraints
273
+ * @returns {Promise<Array>} Array of derived credentials
274
+ * @throws {Error} If validation fails
275
+ * @example
276
+ * const derivedCredentials = await credentialService.deriveVCFromPresentation({
277
+ * credentials: [{
278
+ * credential: bbsCredential,
279
+ * attributesToReveal: ['name', 'dateOfBirth']
280
+ * }]
281
+ * });
282
+ */
38
283
  deriveVCFromPresentation(params: any): Promise<any>;
284
+ /**
285
+ * Test method for range proofs
286
+ * @private
287
+ * @returns {Promise<void>}
288
+ */
39
289
  testRangeProof(): Promise<void>;
40
290
  }
291
+ /**
292
+ * Singleton instance of the credential service
293
+ * @type {CredentialService}
294
+ * @example
295
+ * import { credentialService } from '@docknetwork/wallet-sdk-wasm/services/credential';
296
+ *
297
+ * // Create and sign a credential
298
+ * const credential = credentialService.generateCredential({
299
+ * subject: { id: 'did:example:123' }
300
+ * });
301
+ * const signed = await credentialService.signCredential({
302
+ * vcJson: credential,
303
+ * keyDoc: issuerKey
304
+ * });
305
+ *
306
+ * // Verify a credential
307
+ * const result = await credentialService.verifyCredential({
308
+ * credential: signedCredential
309
+ * });
310
+ */
41
311
  export declare const credentialService: CredentialService;
42
312
  export {};
43
313
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/service.ts"],"names":[],"mappings":"AAoCA,wBAAgB,mBAAmB,CAAC,UAAU,KAAA,OAS7C;AAED,wBAAgB,gBAAgB,CAAC,UAAU,KAAA,OAK1C;AAED,wBAAgB,sBAAsB,CAAC,UAAU,KAAA,OAEhD;AAED,cAAM,iBAAiB;;IAIrB,UAAU,2BAUR;IACF,kBAAkB,CAAC,MAAM,KAAK;IAkBxB,cAAc,CAAC,MAAM,KAAA;IAerB,kBAAkB,CAAC,MAAM,KAAA;IAyBzB,kBAAkB,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,GAAG;IAIjD,gBAAgB,CAAC,MAAM,KAAA;IA2B7B,iBAAiB,CAAC,MAAM,KAAA;IAWxB,oBAAoB,CAAC,MAAM,KAAA;IAU3B,mBAAmB,CAAC,MAAM,KAAA;IAK1B,gBAAgB,CAAC,MAAM,KAAA;IAKjB,oBAAoB,CAAC,EACzB,GAAG,EACH,iBAAiB,EACjB,iBAAiB,GAClB,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,GAAG,CAAC;KACxB,GAAG,OAAO,CAAC,GAAG,CAAC;IAiEV,qBAAqB,CAAC,MAAM,KAAA;IAgBlC,gBAAgB,CAAC,EAAC,UAAU,EAAC;;KAAA;IASvB,kBAA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,MAAM,KAAA;IAK5B;;;;;;;;;;;;;;OAcG;IACG,oBAAoB,CAAC,EACzB,GAAG,EACH,iBAAiB,EACjB,iBAAiB,GAClB,EAAE;QACD,GAAG,EAAE,MAAM,CAAC;QACZ,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,GAAG,CAAC;KACxB,GAAG,OAAO,CAAC,GAAG,CAAC;IAmEhB;;;;;;;;;;;;;;;OAeG;IACG,qBAAqB,CAAC,MAAM,KAAA;IAgBlC;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAC,UAAU,EAAC;;KAAA;IAS7B;;;;;;OAMG;IACG,kBAAkB,CAAC,EAAC,UAAU,EAAC;;KAAA;IAcrC;;;;;;;;;;OAUG;IACG,uBAAuB,CAAC,EAAC,UAAU,EAAE,qBAAqB,EAAC;;;KAAA;IAkDjE;;;;;;;;;;;;;;;;;;OAkBG;IACG,wBAAwB,CAAC,MAAM,KAAA;IAoFrC;;;;OAIG;IACG,cAAc;CAGrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,iBAAiB,mBAA0B,CAAC"}
@@ -1,30 +1,180 @@
1
+ /**
2
+ * @module edv-service
3
+ * @description Encrypted Data Vault (EDV) service for the Wallet SDK.
4
+ * This module provides secure, encrypted storage functionality using EDV protocol,
5
+ * enabling privacy-preserving data storage with client-side encryption.
6
+ */
1
7
  import { InitializeEDVParams } from './configs';
2
8
  import EDVHTTPStorageInterface from '@docknetwork/universal-wallet/storage/edv-http-storage';
3
9
  /**
4
- * EDVService
10
+ * Service class for managing Encrypted Data Vaults
11
+ * @class
12
+ * @description Provides methods for creating, managing, and interacting with
13
+ * encrypted data vaults for secure storage of sensitive wallet data
5
14
  */
6
15
  export declare class EDVService {
7
16
  storageInterface: EDVHTTPStorageInterface;
8
17
  private insertQueue;
9
18
  controller: string;
10
19
  rpcMethods: ((params: any) => any)[];
20
+ /**
21
+ * Creates a new EDVService instance
22
+ * @constructor
23
+ */
11
24
  constructor();
25
+ /**
26
+ * Initializes the EDV service with encryption keys and connection parameters
27
+ * @param {InitializeEDVParams} params - Initialization parameters
28
+ * @param {Object} params.hmacKey - HMAC key for document indexing
29
+ * @param {Object} params.agreementKey - Key agreement key for encryption
30
+ * @param {Object} params.verificationKey - Verification key for authentication
31
+ * @param {string} params.edvUrl - URL of the EDV server
32
+ * @param {string} params.authKey - Authentication key for the EDV server
33
+ * @returns {Promise<void>}
34
+ * @throws {Error} If unable to create or connect to EDV
35
+ * @example
36
+ * await edvService.initialize({
37
+ * hmacKey: hmacKeyData,
38
+ * agreementKey: agreementKeyData,
39
+ * verificationKey: verificationKeyData,
40
+ * edvUrl: 'https://edv.example.com',
41
+ * authKey: 'auth-token-123'
42
+ * });
43
+ */
12
44
  initialize({ hmacKey, agreementKey, verificationKey, edvUrl, authKey, }: InitializeEDVParams): Promise<void>;
45
+ /**
46
+ * Generates new cryptographic keys for EDV operations
47
+ * @returns {Promise<Object>} Generated keys
48
+ * @returns {Object} returns.verificationKey - Ed25519 verification key for authentication
49
+ * @returns {Object} returns.agreementKey - X25519 key agreement key for encryption
50
+ * @returns {Object} returns.hmacKey - HMAC key for indexing
51
+ * @example
52
+ * const keys = await edvService.generateKeys();
53
+ * // Use keys for EDV initialization
54
+ * await edvService.initialize({
55
+ * ...keys,
56
+ * edvUrl: 'https://edv.example.com',
57
+ * authKey: 'auth-token'
58
+ * });
59
+ */
13
60
  generateKeys(): Promise<{
14
61
  verificationKey: any;
15
62
  agreementKey: any;
16
63
  hmacKey: any;
17
64
  }>;
65
+ /**
66
+ * Derives cryptographic keys from a master key
67
+ * @param {Uint8Array} masterKey - Master key for derivation
68
+ * @returns {Promise<Object>} Derived keys
69
+ * @returns {Object} returns.verificationKey - Derived Ed25519 verification key
70
+ * @returns {Object} returns.agreementKey - Derived X25519 key agreement key
71
+ * @returns {Object} returns.hmacKey - Derived HMAC key
72
+ * @example
73
+ * const masterKey = new Uint8Array(32); // Your master key
74
+ * const keys = await edvService.deriveKeys(masterKey);
75
+ */
18
76
  deriveKeys(masterKey: Uint8Array): Promise<{
19
77
  verificationKey: any;
20
78
  agreementKey: any;
21
79
  hmacKey: any;
22
80
  }>;
81
+ /**
82
+ * Gets the controller identifier for the current EDV
83
+ * @returns {Promise<string>} The controller DID or identifier
84
+ * @example
85
+ * const controller = await edvService.getController();
86
+ * console.log('EDV Controller:', controller);
87
+ */
23
88
  getController(): Promise<string>;
89
+ /**
90
+ * Finds documents in the EDV based on query parameters
91
+ * @param {Object} params - Query parameters
92
+ * @param {Object} [params.equals] - Equality-based query conditions
93
+ * @param {boolean} [params.has] - Existence-based query conditions
94
+ * @param {number} [params.limit] - Maximum number of results
95
+ * @returns {Promise<Array>} Array of matching documents
96
+ * @example
97
+ * const documents = await edvService.find({
98
+ * equals: { 'content.type': 'VerifiableCredential' },
99
+ * limit: 10
100
+ * });
101
+ */
24
102
  find(params: any): any;
103
+ /**
104
+ * Updates a document in the EDV
105
+ * @param {Object} params - Update parameters
106
+ * @param {string} params.id - Document ID to update
107
+ * @param {Object} params.content - New document content
108
+ * @returns {Promise<Object>} Updated document
109
+ * @example
110
+ * const updated = await edvService.update({
111
+ * id: 'doc-123',
112
+ * content: { ...existingContent, updated: true }
113
+ * });
114
+ */
25
115
  update(params: any): any;
116
+ /**
117
+ * Inserts a new document into the EDV
118
+ * @param {Object} params - Insert parameters
119
+ * @param {string} params.id - Document ID
120
+ * @param {Object} params.content - Document content to store
121
+ * @returns {Promise<Object>} The inserted document
122
+ * @throws {Error} If insertion fails
123
+ * @example
124
+ * const document = await edvService.insert({
125
+ * id: 'doc-456',
126
+ * content: {
127
+ * type: 'VerifiableCredential',
128
+ * data: credentialData
129
+ * }
130
+ * });
131
+ */
26
132
  insert(params: any): Promise<any>;
133
+ /**
134
+ * Deletes a document from the EDV
135
+ * @param {Object} params - Deletion parameters
136
+ * @param {string} params.id - Document ID to delete
137
+ * @returns {Promise<boolean>} True if deletion successful
138
+ * @example
139
+ * const deleted = await edvService.delete({
140
+ * id: 'doc-123'
141
+ * });
142
+ */
27
143
  delete(params: any): any;
28
144
  }
145
+ /**
146
+ * Singleton instance of the EDV service
147
+ * @type {EDVService}
148
+ * @example
149
+ * import { edvService } from '@docknetwork/wallet-sdk-wasm/services/edv';
150
+ *
151
+ * // Generate keys and initialize
152
+ * const keys = await edvService.generateKeys();
153
+ * await edvService.initialize({
154
+ * ...keys,
155
+ * edvUrl: 'https://edv.example.com',
156
+ * authKey: 'auth-token'
157
+ * });
158
+ *
159
+ * // Store encrypted data
160
+ * await edvService.insert({
161
+ * id: 'credential-1',
162
+ * content: {
163
+ * type: 'VerifiableCredential',
164
+ * data: credentialData
165
+ * }
166
+ * });
167
+ *
168
+ * // Query encrypted data
169
+ * const credentials = await edvService.find({
170
+ * equals: { 'content.type': 'VerifiableCredential' }
171
+ * });
172
+ *
173
+ * // Update encrypted data
174
+ * await edvService.update({
175
+ * id: 'credential-1',
176
+ * content: updatedData
177
+ * });
178
+ */
29
179
  export declare const edvService: EDVService;
30
180
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/edv/service.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAc,MAAM,WAAW,CAAC;AAC3D,OAAO,uBAAuB,MAAM,wDAAwD,CAAC;AAU7F;;GAEG;AACH,qBAAa,UAAU;IACrB,gBAAgB,EAAE,uBAAuB,CAAC;IAE1C,OAAO,CAAC,WAAW,CAAmC;IAC/C,UAAU,EAAE,MAAM,CAAC;IAE1B,UAAU,YA+GG,GAAG,YAtGd;;IAMI,UAAU,CAAC,EACf,OAAO,EACP,YAAY,EACZ,eAAe,EACf,MAAM,EACN,OAAO,GACR,EAAE,mBAAmB;IAuDhB,YAAY;;;;;IAgBZ,UAAU,CAAC,SAAS,EAAE,UAAU;;;;;IAehC,aAAa;IAInB,IAAI,CAAC,MAAM,EAAE,GAAG;IAIhB,MAAM,CAAC,MAAM,EAAE,GAAG;IAIlB,MAAM,CAAC,MAAM,EAAE,GAAG;IAUlB,MAAM,CAAC,MAAM,EAAE,GAAG;CAGnB;AAED,eAAO,MAAM,UAAU,EAAE,UAA6B,CAAC"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/edv/service.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,EAAC,mBAAmB,EAAc,MAAM,WAAW,CAAC;AAC3D,OAAO,uBAAuB,MAAM,wDAAwD,CAAC;AAU7F;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,gBAAgB,EAAE,uBAAuB,CAAC;IAE1C,OAAO,CAAC,WAAW,CAAmC;IAC/C,UAAU,EAAE,MAAM,CAAC;IAE1B,UAAU,YAoLG,GAAG,YA3Kd;IAEF;;;OAGG;;IAKH;;;;;;;;;;;;;;;;;;OAkBG;IACG,UAAU,CAAC,EACf,OAAO,EACP,YAAY,EACZ,eAAe,EACf,MAAM,EACN,OAAO,GACR,EAAE,mBAAmB;IAuDtB;;;;;;;;;;;;;;OAcG;IACG,YAAY;;;;;IAgBlB;;;;;;;;;;OAUG;IACG,UAAU,CAAC,SAAS,EAAE,UAAU;;;;;IAetC;;;;;;OAMG;IACG,aAAa;IAInB;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,MAAM,EAAE,GAAG;IAIhB;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAIlB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,MAAM,EAAE,GAAG;IAUlB;;;;;;;;;OASG;IACH,MAAM,CAAC,MAAM,EAAE,GAAG;CAGnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,UAAU,EAAE,UAA6B,CAAC"}
@@ -1,19 +1,147 @@
1
+ /**
2
+ * @module relay-service
3
+ * @description DIDComm message relay service for the Wallet SDK.
4
+ * This module provides functionality for sending, receiving, and managing DIDComm messages
5
+ * through a relay service, including push notification support.
6
+ */
1
7
  import { SendMessageParams, GetMessagesParams, ResolveDidcommMessageParams, RegisterDIDPushNotificationParams, AckMessagesParams } from './configs';
2
8
  import { RelayService as relayServiceClient } from '@docknetwork/wallet-sdk-relay-service/lib';
3
9
  /**
4
- * RelayService
10
+ * Service class for managing DIDComm message relay operations
11
+ * @class
12
+ * @description Provides methods for sending, receiving, and acknowledging DIDComm messages
13
+ * through a relay service infrastructure
5
14
  */
6
15
  export declare class RelayService {
7
16
  name: string;
8
17
  rpcMethods: (((params: AckMessagesParams) => any) | ((params: GetMessagesParams) => any) | ((params: RegisterDIDPushNotificationParams) => any) | ((params: ResolveDidcommMessageParams) => any) | ((params: SendMessageParams) => any))[];
18
+ /**
19
+ * Creates a new RelayService instance
20
+ * @constructor
21
+ */
9
22
  constructor();
23
+ /**
24
+ * Sends a DIDComm message through the relay service
25
+ * @param {SendMessageParams} params - Message parameters
26
+ * @param {Object} params.keyPairDoc - Key pair document for message encryption
27
+ * @param {Object} params.message - The message payload to send
28
+ * @param {string} params.recipientDid - DID of the message recipient
29
+ * @param {string} [params.type] - Message type identifier
30
+ * @returns {Promise<Object>} Result of the send operation
31
+ * @throws {Error} If validation fails or sending fails
32
+ * @example
33
+ * const result = await relayService.sendMessage({
34
+ * keyPairDoc: senderKeyPair,
35
+ * message: { content: 'Hello' },
36
+ * recipientDid: 'did:key:recipient123',
37
+ * type: 'basic-message'
38
+ * });
39
+ */
10
40
  sendMessage(params: SendMessageParams): any;
41
+ /**
42
+ * Acknowledges receipt of messages from the relay service
43
+ * @param {AckMessagesParams} params - Acknowledgment parameters
44
+ * @param {string} params.did - DID acknowledging the messages
45
+ * @param {Array<string>} params.messageIds - Array of message IDs to acknowledge
46
+ * @returns {Promise<Object>} Result of the acknowledgment operation
47
+ * @example
48
+ * await relayService.ackMessages({
49
+ * did: 'did:key:holder123',
50
+ * messageIds: ['msg-1', 'msg-2']
51
+ * });
52
+ */
11
53
  ackMessages(params: AckMessagesParams): any;
54
+ /**
55
+ * Resolves and decrypts a DIDComm message
56
+ * @param {ResolveDidcommMessageParams} params - Resolution parameters
57
+ * @param {Object} params.encryptedMessage - The encrypted message to resolve
58
+ * @param {Object} params.keyPairDoc - Key pair document for decryption
59
+ * @returns {Promise<Object>} The decrypted and resolved message
60
+ * @throws {Error} If validation fails or resolution fails
61
+ * @example
62
+ * const decrypted = await relayService.resolveDidcommMessage({
63
+ * encryptedMessage: encryptedData,
64
+ * keyPairDoc: recipientKeyPair
65
+ * });
66
+ */
12
67
  resolveDidcommMessage(params: ResolveDidcommMessageParams): any;
68
+ /**
69
+ * Signs a JWT using the provided key pair
70
+ * @param {ResolveDidcommMessageParams} params - Signing parameters
71
+ * @param {Object} params.payload - JWT payload to sign
72
+ * @param {Object} params.keyPairDoc - Key pair document for signing
73
+ * @returns {Promise<string>} The signed JWT token
74
+ * @throws {Error} If validation fails or signing fails
75
+ * @example
76
+ * const jwt = await relayService.signJwt({
77
+ * payload: { sub: 'did:key:123', iat: Date.now() },
78
+ * keyPairDoc: signerKeyPair
79
+ * });
80
+ */
13
81
  signJwt(params: ResolveDidcommMessageParams): any;
82
+ /**
83
+ * Retrieves messages from the relay service
84
+ * @param {GetMessagesParams} params - Retrieval parameters
85
+ * @param {Object} params.keyPairDocs - Key pair documents for decryption
86
+ * @param {number} [params.limit] - Maximum number of messages to retrieve
87
+ * @param {boolean} [params.skipMessageResolution] - Whether to skip message resolution
88
+ * @returns {Promise<Array>} Array of retrieved messages
89
+ * @throws {Error} If validation fails or retrieval fails
90
+ * @example
91
+ * const messages = await relayService.getMessages({
92
+ * keyPairDocs: [keyPairDoc1, keyPairDoc2],
93
+ * limit: 50,
94
+ * skipMessageResolution: false
95
+ * });
96
+ */
14
97
  getMessages(params: GetMessagesParams): any;
98
+ /**
99
+ * Registers a DID for push notifications
100
+ * @param {RegisterDIDPushNotificationParams} params - Registration parameters
101
+ * @param {string} params.did - The DID to register for notifications
102
+ * @param {string} params.deviceToken - Device token for push notifications
103
+ * @param {string} [params.platform] - Platform identifier (ios, android, etc.)
104
+ * @returns {Promise<Object>} Result of the registration
105
+ * @throws {Error} If validation fails or registration fails
106
+ * @example
107
+ * await relayService.registerDIDPushNotification({
108
+ * did: 'did:key:holder123',
109
+ * deviceToken: 'fcm-token-123',
110
+ * platform: 'android'
111
+ * });
112
+ */
15
113
  registerDIDPushNotification(params: RegisterDIDPushNotificationParams): any;
16
114
  }
115
+ /**
116
+ * Low-level relay service client for direct API access
117
+ * @type {Object}
118
+ * @see {@link RelayService} - Higher-level service wrapper
119
+ */
17
120
  export { relayServiceClient };
121
+ /**
122
+ * Singleton instance of the relay service
123
+ * @type {RelayService}
124
+ * @example
125
+ * import { relayService } from '@docknetwork/wallet-sdk-wasm/services/relay-service';
126
+ *
127
+ * // Send a DIDComm message
128
+ * await relayService.sendMessage({
129
+ * keyPairDoc: senderKeyPair,
130
+ * message: { type: 'greeting', content: 'Hello!' },
131
+ * recipientDid: 'did:key:recipient123'
132
+ * });
133
+ *
134
+ * // Retrieve messages
135
+ * const messages = await relayService.getMessages({
136
+ * keyPairDocs: [recipientKeyPair],
137
+ * limit: 10
138
+ * });
139
+ *
140
+ * // Acknowledge messages
141
+ * await relayService.ackMessages({
142
+ * did: 'did:key:recipient123',
143
+ * messageIds: messages.map(m => m.id)
144
+ * });
145
+ */
18
146
  export declare const relayService: RelayService;
19
147
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/relay-service/service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,2BAA2B,EAC3B,iCAAiC,EAGjC,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAC,YAAY,IAAI,kBAAkB,EAAC,MAAM,2CAA2C,CAAC;AAE7F;;GAEG;AACH,qBAAa,YAAY;IACvB,IAAI,EAAE,MAAM,CAAC;IAEb,UAAU,aAkB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H,2BAA2B,CAAC,MAAM,EAAE,iCAAiC;CAItE;AAED;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAAC,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,YAAY,EAAE,YAAiC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  export class RpcService {
2
2
  constructor(serviceName: any);
3
- serviceName: string;
4
- sandbox: Boolean;
3
+ serviceName: any;
4
+ sandbox: boolean;
5
5
  call(method: any, ...params: any[]): Promise<any>;
6
6
  }
7
7
  //# sourceMappingURL=rpc-service-client.d.ts.map