@docknetwork/wallet-sdk-wasm 1.5.11 → 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 (97) 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 +16 -0
  12. package/lib/services/blockchain/service-rpc.mjs +16 -0
  13. package/lib/services/blockchain/service.js +144 -12
  14. package/lib/services/blockchain/service.mjs +144 -12
  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/pex-helpers.js +20 -0
  22. package/lib/services/credential/pex-helpers.mjs +20 -1
  23. package/lib/services/credential/sd-jwt.js +214 -0
  24. package/lib/services/credential/sd-jwt.mjs +200 -0
  25. package/lib/services/credential/service-rpc.js +9 -0
  26. package/lib/services/credential/service-rpc.mjs +9 -0
  27. package/lib/services/credential/service.js +325 -8
  28. package/lib/services/credential/service.mjs +326 -9
  29. package/lib/services/edv/service.js +145 -1
  30. package/lib/services/edv/service.mjs +145 -1
  31. package/lib/services/index.js +13 -0
  32. package/lib/services/index.mjs +13 -0
  33. package/lib/services/relay-service/service.js +124 -1
  34. package/lib/services/relay-service/service.mjs +124 -1
  35. package/lib/services/rpc-service-client.js +0 -3
  36. package/lib/services/rpc-service-client.mjs +0 -3
  37. package/lib/services/storage/index.js +19 -2
  38. package/lib/services/storage/index.mjs +24 -1
  39. package/lib/services/storage/service-rpc.js +7 -3
  40. package/lib/services/storage/service-rpc.mjs +7 -3
  41. package/lib/services/storage/service.js +4 -0
  42. package/lib/services/storage/service.mjs +4 -0
  43. package/lib/setup-nodejs.js +8 -1
  44. package/lib/setup-nodejs.mjs +8 -1
  45. package/lib/setup-tests.js +8 -1
  46. package/lib/setup-tests.mjs +8 -1
  47. package/lib/src/services/blockchain/cached-did-resolver.d.ts +28 -0
  48. package/lib/src/services/blockchain/cached-did-resolver.d.ts.map +1 -0
  49. package/lib/src/services/blockchain/cached-did-resolver.test.d.ts +2 -0
  50. package/lib/src/services/blockchain/cached-did-resolver.test.d.ts.map +1 -0
  51. package/lib/src/services/blockchain/service.d.ts +115 -17
  52. package/lib/src/services/blockchain/service.d.ts.map +1 -1
  53. package/lib/src/services/credential/config.d.ts.map +1 -1
  54. package/lib/src/services/credential/index.d.ts +3 -0
  55. package/lib/src/services/credential/index.d.ts.map +1 -1
  56. package/lib/src/services/credential/pex-helpers.d.ts +13 -1
  57. package/lib/src/services/credential/pex-helpers.d.ts.map +1 -1
  58. package/lib/src/services/credential/sd-jwt.test.d.ts +2 -0
  59. package/lib/src/services/credential/sd-jwt.test.d.ts.map +1 -0
  60. package/lib/src/services/credential/service.d.ts +274 -4
  61. package/lib/src/services/credential/service.d.ts.map +1 -1
  62. package/lib/src/services/edv/service.d.ts +151 -1
  63. package/lib/src/services/edv/service.d.ts.map +1 -1
  64. package/lib/src/services/relay-service/service.d.ts +129 -1
  65. package/lib/src/services/relay-service/service.d.ts.map +1 -1
  66. package/lib/src/services/rpc-service-client.d.ts +2 -2
  67. package/lib/src/services/rpc-service-client.d.ts.map +1 -1
  68. package/lib/src/services/storage/index.d.ts +1 -1
  69. package/lib/src/services/storage/index.d.ts.map +1 -1
  70. package/lib/src/services/storage/service-rpc.d.ts +9 -0
  71. package/lib/src/services/storage/service-rpc.d.ts.map +1 -0
  72. package/lib/src/services/storage/service.d.ts +1 -0
  73. package/lib/src/services/storage/service.d.ts.map +1 -1
  74. package/lib/src/services/util-crypto/service.d.ts +1 -1
  75. package/lib/tsconfig.tsbuildinfo +1 -1
  76. package/lib/wallet/rpc-storage-interface.js +13 -3
  77. package/lib/wallet/rpc-storage-interface.mjs +11 -1
  78. package/lib/wallet/rpc-storage-wallet.js +10 -0
  79. package/lib/wallet/rpc-storage-wallet.mjs +10 -0
  80. package/package.json +13 -8
  81. package/src/services/blockchain/cached-did-resolver.test.ts +288 -0
  82. package/src/services/blockchain/cached-did-resolver.ts +126 -0
  83. package/src/services/blockchain/service-rpc.js +16 -0
  84. package/src/services/blockchain/service.ts +146 -12
  85. package/src/services/credential/config.ts +7 -1
  86. package/src/services/credential/pex-helpers.js +20 -1
  87. package/src/services/credential/pex-helpers.test.js +114 -0
  88. package/src/services/credential/sd-jwt.test.ts +718 -0
  89. package/src/services/credential/sd-jwt.ts +231 -0
  90. package/src/services/credential/service-rpc.js +9 -0
  91. package/src/services/credential/service.ts +330 -9
  92. package/src/services/edv/service.ts +153 -1
  93. package/src/services/relay-service/service.ts +130 -1
  94. package/src/services/rpc-service-client.js +0 -3
  95. package/src/services/storage/index.js +15 -1
  96. package/src/services/storage/service-rpc.js +7 -3
  97. package/src/services/storage/service.ts +5 -0
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,UAAU;;;;;;;CA4CtB,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/config.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,gBAAgB,CAAC;AACzC,eAAO,MAAM,UAAU;;;;;;;CAkDtB,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare const credentialServiceRPC: {
2
2
  rpcMethods: ((params?: {}) => any)[];
3
+ createSDJWTPresentation(params: any): Promise<string>;
3
4
  generateCredential(params?: {}): any;
4
5
  signCredential(params: any): Promise<any>;
5
6
  createPresentation(params: any): Promise<any>;
@@ -9,6 +10,8 @@ export declare const credentialServiceRPC: {
9
10
  evaluatePresentation(params: any): import("@sphereon/pex").EvaluationResults;
10
11
  isBBSPlusCredential(params: any): any;
11
12
  isKvacCredential(params: any): any;
13
+ isSDJWTCredential(params: any): boolean;
14
+ credentialToW3C(params: any): Promise<any>;
12
15
  acquireOIDCredential({ uri, authorizationCode, holderKeyDocument, }: {
13
16
  uri: string;
14
17
  authorizationCode?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAoB,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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sd-jwt.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sd-jwt.test.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/sd-jwt.test.ts"],"names":[],"mappings":""}
@@ -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,mBAA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;;OAiBG;IACG,gBAAgB,CAAC,MAAM,KAAA;IAoC7B;;;;;;;;;;;;;OAaG;IACH,iBAAiB,CAAC,MAAM,KAAA;IAWxB;;;;;;;;;;;OAWG;IACH,oBAAoB,CAAC,MAAM,KAAA;IAU3B;;;;;OAKG;IACH,mBAAmB,CAAC,MAAM,KAAA;IAK1B;;;;;OAKG;IACH,gBAAgB,CAAC,MAAM,KAAA;IAKvB;;;;;;;;;OASG;IACH,iBAAiB,CAAC,MAAM,KAAA;IAKxB;;;;;;;;;;;;;;;;;OAiBG;IACG,eAAe,CAAC,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,UAA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