@docknetwork/wallet-sdk-wasm 1.5.14 → 1.7.6
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.
- package/generate-docs.js +49 -0
- package/jsdoc.conf.json +29 -6
- package/lib/index.js +9 -1
- package/lib/index.mjs +9 -1
- package/lib/modules/network-manager.js +15 -12
- package/lib/modules/network-manager.mjs +15 -12
- package/lib/rpc-server.js +11 -1
- package/lib/rpc-server.mjs +11 -1
- package/lib/services/blockchain/cached-did-resolver.js +113 -0
- package/lib/services/blockchain/cached-did-resolver.mjs +109 -0
- package/lib/services/blockchain/index.js +11 -0
- package/lib/services/blockchain/index.mjs +11 -0
- package/lib/services/blockchain/service-rpc.js +12 -0
- package/lib/services/blockchain/service-rpc.mjs +12 -0
- package/lib/services/blockchain/service.js +161 -19
- package/lib/services/blockchain/service.mjs +162 -20
- package/lib/services/credential/bbs-revocation.js +11 -0
- package/lib/services/credential/bbs-revocation.mjs +11 -0
- package/lib/services/credential/bound-check.js +1 -1
- package/lib/services/credential/bound-check.mjs +1 -1
- package/lib/services/credential/config.js +4 -1
- package/lib/services/credential/config.mjs +4 -1
- package/lib/services/credential/delegatable-credentials.js +300 -0
- package/lib/services/credential/delegatable-credentials.mjs +263 -0
- package/lib/services/credential/index.js +53 -0
- package/lib/services/credential/index.mjs +18 -0
- package/lib/services/credential/pex-helpers.js +4 -4
- package/lib/services/credential/pex-helpers.mjs +4 -4
- package/lib/services/credential/sd-jwt.js +214 -0
- package/lib/services/credential/sd-jwt.mjs +200 -0
- package/lib/services/credential/service-rpc.js +9 -0
- package/lib/services/credential/service-rpc.mjs +9 -0
- package/lib/services/credential/service.js +324 -7
- package/lib/services/credential/service.mjs +324 -7
- package/lib/services/edv/index.js +1 -0
- package/lib/services/edv/index.mjs +1 -0
- package/lib/services/edv/service-rpc.js +23 -0
- package/lib/services/edv/service-rpc.mjs +23 -0
- package/lib/services/edv/service.js +226 -2
- package/lib/services/edv/service.mjs +223 -3
- package/lib/services/index.js +14 -0
- package/lib/services/index.mjs +14 -0
- package/lib/services/pex/config.js +4 -0
- package/lib/services/pex/config.mjs +4 -0
- package/lib/services/pex/service-rpc.js +4 -0
- package/lib/services/pex/service-rpc.mjs +4 -0
- package/lib/services/pex/service.js +7 -0
- package/lib/services/pex/service.mjs +7 -0
- package/lib/services/relay-service/service.js +124 -1
- package/lib/services/relay-service/service.mjs +124 -1
- package/lib/services/rpc-service-client.js +0 -3
- package/lib/services/rpc-service-client.mjs +0 -3
- package/lib/services/storage/index.js +19 -2
- package/lib/services/storage/index.mjs +24 -1
- package/lib/services/storage/service-rpc.js +7 -3
- package/lib/services/storage/service-rpc.mjs +7 -3
- package/lib/services/storage/service.js +4 -0
- package/lib/services/storage/service.mjs +4 -0
- package/lib/setup-nodejs.js +9 -1
- package/lib/setup-nodejs.mjs +9 -1
- package/lib/setup-tests.js +9 -1
- package/lib/setup-tests.mjs +9 -1
- package/lib/src/modules/event-manager.d.ts +0 -1
- package/lib/src/modules/event-manager.d.ts.map +1 -1
- package/lib/src/modules/network-manager.d.ts +2 -4
- package/lib/src/modules/network-manager.d.ts.map +1 -1
- package/lib/src/services/blockchain/cached-did-resolver.d.ts +28 -0
- package/lib/src/services/blockchain/cached-did-resolver.d.ts.map +1 -0
- package/lib/src/services/blockchain/cached-did-resolver.test.d.ts +2 -0
- package/lib/src/services/blockchain/cached-did-resolver.test.d.ts.map +1 -0
- package/lib/src/services/blockchain/configs.d.ts +1 -2
- package/lib/src/services/blockchain/configs.d.ts.map +1 -1
- package/lib/src/services/blockchain/service.d.ts +117 -19
- package/lib/src/services/blockchain/service.d.ts.map +1 -1
- package/lib/src/services/credential/bbs-revocation.d.ts +1 -1
- package/lib/src/services/credential/bbs-revocation.d.ts.map +1 -1
- package/lib/src/services/credential/bound-check.d.ts.map +1 -1
- package/lib/src/services/credential/config.d.ts.map +1 -1
- package/lib/src/services/credential/delegatable-credentials.d.ts +272 -0
- package/lib/src/services/credential/delegatable-credentials.d.ts.map +1 -0
- package/lib/src/services/credential/index.d.ts +4 -0
- package/lib/src/services/credential/index.d.ts.map +1 -1
- package/lib/src/services/credential/pex-helpers.d.ts +2 -2
- package/lib/src/services/credential/pex-helpers.d.ts.map +1 -1
- package/lib/src/services/credential/sd-jwt.test.d.ts +2 -0
- package/lib/src/services/credential/sd-jwt.test.d.ts.map +1 -0
- package/lib/src/services/credential/service.d.ts +274 -4
- package/lib/src/services/credential/service.d.ts.map +1 -1
- package/lib/src/services/dids/keypair-utils.d.ts +2 -2
- package/lib/src/services/dids/keypair-utils.d.ts.map +1 -1
- package/lib/src/services/dids/service.d.ts +35 -3
- package/lib/src/services/dids/service.d.ts.map +1 -1
- package/lib/src/services/edv/service.d.ts +201 -2
- package/lib/src/services/edv/service.d.ts.map +1 -1
- package/lib/src/services/pex/config.d.ts +1 -0
- package/lib/src/services/pex/config.d.ts.map +1 -1
- package/lib/src/services/pex/service.d.ts +1 -0
- package/lib/src/services/pex/service.d.ts.map +1 -1
- package/lib/src/services/relay-service/service.d.ts +148 -8
- package/lib/src/services/relay-service/service.d.ts.map +1 -1
- package/lib/src/services/rpc-service-client.d.ts +2 -2
- package/lib/src/services/rpc-service-client.d.ts.map +1 -1
- package/lib/src/services/storage/index.d.ts +1 -1
- package/lib/src/services/storage/index.d.ts.map +1 -1
- package/lib/src/services/storage/service-rpc.d.ts +9 -0
- package/lib/src/services/storage/service-rpc.d.ts.map +1 -0
- package/lib/src/services/storage/service.d.ts +1 -0
- package/lib/src/services/storage/service.d.ts.map +1 -1
- package/lib/src/services/util-crypto/service.d.ts +2 -2
- package/lib/src/services/util-crypto/service.d.ts.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/wallet/rpc-storage-interface.js +13 -3
- package/lib/wallet/rpc-storage-interface.mjs +11 -1
- package/lib/wallet/rpc-storage-wallet.js +10 -0
- package/lib/wallet/rpc-storage-wallet.mjs +10 -0
- package/package.json +29 -16
- package/rollup.config.mjs +5 -3
- package/src/globals.d.ts +3 -0
- package/src/modules/network-manager.ts +15 -14
- package/src/services/blockchain/cached-did-resolver.test.ts +288 -0
- package/src/services/blockchain/cached-did-resolver.ts +126 -0
- package/src/services/blockchain/configs.ts +1 -2
- package/src/services/blockchain/service-rpc.js +12 -0
- package/src/services/blockchain/service.ts +167 -20
- package/src/services/credential/bound-check.ts +1 -1
- package/src/services/credential/config.ts +7 -1
- package/src/services/credential/delegatable-credentials.ts +409 -0
- package/src/services/credential/index.ts +16 -0
- package/src/services/credential/pex-helpers.js +4 -4
- package/src/services/credential/pex-helpers.test.js +2 -2
- package/src/services/credential/sd-jwt.test.ts +718 -0
- package/src/services/credential/sd-jwt.ts +231 -0
- package/src/services/credential/service-rpc.js +9 -0
- package/src/services/credential/service.ts +328 -7
- package/src/services/edv/index.test.js +229 -0
- package/src/services/edv/service-rpc.js +23 -0
- package/src/services/edv/service.ts +272 -1
- package/src/services/pex/config.ts +4 -0
- package/src/services/pex/service-rpc.js +4 -0
- package/src/services/pex/service.ts +13 -0
- package/src/services/pex/tests/pex-service.test.js +210 -0
- package/src/services/relay-service/service.ts +130 -1
- package/src/services/rpc-service-client.js +0 -3
- package/src/services/storage/index.js +15 -1
- package/src/services/storage/service-rpc.js +7 -3
- package/src/services/storage/service.ts +5 -0
|
@@ -16,8 +16,8 @@ export const EPSILON_INT: 1;
|
|
|
16
16
|
export const MAX_DATE_PLACEHOLDER: 884541351600000;
|
|
17
17
|
export const MIN_DATE_PLACEHOLDER: -17592186044415;
|
|
18
18
|
export const MAX_INTEGER: number;
|
|
19
|
-
export const MIN_INTEGER:
|
|
19
|
+
export const MIN_INTEGER: number;
|
|
20
20
|
export const MAX_NUMBER: number;
|
|
21
|
-
export const MIN_NUMBER:
|
|
21
|
+
export const MIN_NUMBER: number;
|
|
22
22
|
export function shouldSkipAttribute(attributeName: any): boolean;
|
|
23
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;;;;;;;;;;GAUG;AACH,
|
|
1
|
+
{"version":3,"file":"pex-helpers.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/pex-helpers.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;GAUG;AACH,wCATW,GAAC,wBACD,GAAC,sBACD,GAAC,SA4MX;AAcD,4FAgCC;AA1TD,6BAA8B,KAAK,CAAC;AACpC,0BAA2B,CAAC,CAAC;AAE7B,mCAAoC,eAAe,CAAC;AACpD,mCAAoC,CAAC,cAAc,CAAC;AACpD,iCAAmD;AACnD,iCAAmD;AACnD,gCAAkD;AAClD,gCAAkD;AA+Q3C,iEACoD"}
|
|
@@ -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
|
-
*
|
|
30
|
-
* The witness is generated by the issuer when the credential is created
|
|
31
|
-
*
|
|
32
|
-
*
|
|
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":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/credential/service.ts"],"names":[],"mappings":"AAiDA;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,KAAA,OAS7C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,KAAA,OAK1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,KAAA,OAEhD;AAED;;;;;GAKG;AACH,cAAM,iBAAiB;IACrB;;;OAGG;;IAIH,UAAU,2BAaR;IAGF,uBAAuB,CAAC,MAAM,KAAA;IAK9B;;;;;;;;;OASG;IACH,kBAAkB,CAAC,MAAM,KAAK;IAkB9B;;;;;;;;;;;;OAYG;IACG,cAAc,CAAC,MAAM,KAAA;IAe3B;;;;;;;;;;;;;;;;;OAiBG;IACG,kBAAkB,CAAC,MAAM,KAAA;IAmC/B;;;;;;;;;;;OAWG;IACG,kBAAkB,CAAC,EAAE,YAAY,EAAE,OAAO,EAAE,EAAE,GAAG;IAIvD;;;;;;;;;;;;;;;;;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"}
|
|
@@ -10,6 +10,6 @@ export function keypairToKeydoc(key: any, controller: any, id?: any): {
|
|
|
10
10
|
publicKeyBase58: any;
|
|
11
11
|
};
|
|
12
12
|
export const MULTIBASE_BASE58BTC_HEADER: "z";
|
|
13
|
-
export const MULTICODEC_ED25519_PUB_HEADER: Uint8Array
|
|
14
|
-
export const MULTICODEC_ED25519_PRIV_HEADER: Uint8Array
|
|
13
|
+
export const MULTICODEC_ED25519_PUB_HEADER: Uint8Array<ArrayBuffer>;
|
|
14
|
+
export const MULTICODEC_ED25519_PRIV_HEADER: Uint8Array<ArrayBuffer>;
|
|
15
15
|
//# sourceMappingURL=keypair-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair-utils.d.ts","sourceRoot":"","sources":["../../../../src/services/dids/keypair-utils.js"],"names":[],"mappings":"AASA,8CAWC;AAMD,2DAKC;AAeD;;;;;;;;EAgEC;AAxFD,
|
|
1
|
+
{"version":3,"file":"keypair-utils.d.ts","sourceRoot":"","sources":["../../../../src/services/dids/keypair-utils.js"],"names":[],"mappings":"AASA,8CAWC;AAMD,2DAKC;AAeD;;;;;;;;EAgEC;AAxFD,yCAA0C,GAAG,CAAC;AAC9C,oEAA0E;AAC1E,qEAA2E"}
|
|
@@ -2,13 +2,45 @@ import { KeypairToDIDKeyDocumentParams, GetDIDResolutionParams } from './config'
|
|
|
2
2
|
declare class DIDService {
|
|
3
3
|
name: string;
|
|
4
4
|
constructor();
|
|
5
|
-
rpcMethods: (((params: KeypairToDIDKeyDocumentParams) =>
|
|
5
|
+
rpcMethods: (((params: KeypairToDIDKeyDocumentParams) => Promise<{
|
|
6
|
+
didDocument: any;
|
|
7
|
+
keyDoc: any;
|
|
8
|
+
}>) | ((params: GetDIDResolutionParams) => {
|
|
9
|
+
'@context': string[];
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
correlation: any[];
|
|
13
|
+
created: string;
|
|
14
|
+
expires: string;
|
|
15
|
+
name: any;
|
|
16
|
+
didDocument: any;
|
|
17
|
+
}) | ((params: any) => Promise<{
|
|
18
|
+
controller: any;
|
|
19
|
+
type: any;
|
|
20
|
+
id: any;
|
|
21
|
+
publicKeyMultibase: string;
|
|
22
|
+
privateKeyMultibase: string;
|
|
23
|
+
privateKeyBase58: any;
|
|
24
|
+
publicKeyBase58: any;
|
|
25
|
+
}>) | (({ payload, privateKeyDoc, headerInput }: {
|
|
6
26
|
payload: any;
|
|
7
27
|
privateKeyDoc: any;
|
|
8
28
|
headerInput: any;
|
|
9
29
|
}) => Promise<string>))[];
|
|
10
|
-
keypairToDIDKeyDocument(params: KeypairToDIDKeyDocumentParams):
|
|
11
|
-
|
|
30
|
+
keypairToDIDKeyDocument(params: KeypairToDIDKeyDocumentParams): Promise<{
|
|
31
|
+
didDocument: any;
|
|
32
|
+
keyDoc: any;
|
|
33
|
+
}>;
|
|
34
|
+
getDIDResolution(params: GetDIDResolutionParams): {
|
|
35
|
+
'@context': string[];
|
|
36
|
+
id: string;
|
|
37
|
+
type: string;
|
|
38
|
+
correlation: any[];
|
|
39
|
+
created: string;
|
|
40
|
+
expires: string;
|
|
41
|
+
name: any;
|
|
42
|
+
didDocument: any;
|
|
43
|
+
};
|
|
12
44
|
generateKeyDoc(params: any): Promise<{
|
|
13
45
|
controller: any;
|
|
14
46
|
type: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/dids/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAkDlB,cAAM,UAAU;IACd,IAAI,EAAE,MAAM,CAAC;;IAKb,UAAU,aAOsB,6BAA6B,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/dids/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,6BAA6B,EAC7B,sBAAsB,EACvB,MAAM,UAAU,CAAC;AAkDlB,cAAM,UAAU;IACd,IAAI,EAAE,MAAM,CAAC;;IAKb,UAAU,aAOsB,6BAA6B;;;oBAMpC,sBAAsB;;;;;;;;;;;;;;;;;;;;;8BAP7C;IACF,uBAAuB,CAAC,MAAM,EAAE,6BAA6B;;;;IAM7D,gBAAgB,CAAC,MAAM,EAAE,sBAAsB;;;;;;;;;;IAMzC,cAAc,CAAC,MAAM,KAAA;;;;;;;;;IAOrB,YAAY,CAAC,MAAM,KAAA;;;;;;;;;IAOnB,eAAe,CAAC,EAAC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAC;;;;KAAA;CAmB5D;AAED,eAAO,MAAM,UAAU,YAAmB,CAAC"}
|
|
@@ -1,30 +1,229 @@
|
|
|
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';
|
|
9
|
+
export declare const HKDF_LENGTH = 32;
|
|
10
|
+
export declare const HKDF_HASH = "SHA-256";
|
|
3
11
|
/**
|
|
4
|
-
*
|
|
12
|
+
* Service class for managing Encrypted Data Vaults
|
|
13
|
+
* @class
|
|
14
|
+
* @description Provides methods for creating, managing, and interacting with
|
|
15
|
+
* encrypted data vaults for secure storage of sensitive wallet data
|
|
5
16
|
*/
|
|
6
17
|
export declare class EDVService {
|
|
7
18
|
storageInterface: EDVHTTPStorageInterface;
|
|
8
19
|
private insertQueue;
|
|
9
20
|
controller: string;
|
|
10
|
-
rpcMethods: ((params: any) => any)
|
|
21
|
+
rpcMethods: (((params: any) => any) | ((biometricData: Buffer, identifier: string) => Buffer) | ((biometricData: Buffer, identifier: string) => Promise<{
|
|
22
|
+
key: Buffer;
|
|
23
|
+
iv: Buffer;
|
|
24
|
+
}>) | ((masterKey: Uint8Array, encryptionKey: Buffer, iv: Buffer) => Promise<Uint8Array>))[];
|
|
25
|
+
/**
|
|
26
|
+
* Creates a new EDVService instance
|
|
27
|
+
* @constructor
|
|
28
|
+
*/
|
|
11
29
|
constructor();
|
|
30
|
+
/**
|
|
31
|
+
* Initializes the EDV service with encryption keys and connection parameters
|
|
32
|
+
* @param {InitializeEDVParams} params - Initialization parameters
|
|
33
|
+
* @param {Object} params.hmacKey - HMAC key for document indexing
|
|
34
|
+
* @param {Object} params.agreementKey - Key agreement key for encryption
|
|
35
|
+
* @param {Object} params.verificationKey - Verification key for authentication
|
|
36
|
+
* @param {string} params.edvUrl - URL of the EDV server
|
|
37
|
+
* @param {string} params.authKey - Authentication key for the EDV server
|
|
38
|
+
* @returns {Promise<void>}
|
|
39
|
+
* @throws {Error} If unable to create or connect to EDV
|
|
40
|
+
* @example
|
|
41
|
+
* await edvService.initialize({
|
|
42
|
+
* hmacKey: hmacKeyData,
|
|
43
|
+
* agreementKey: agreementKeyData,
|
|
44
|
+
* verificationKey: verificationKeyData,
|
|
45
|
+
* edvUrl: 'https://edv.example.com',
|
|
46
|
+
* authKey: 'auth-token-123'
|
|
47
|
+
* });
|
|
48
|
+
*/
|
|
12
49
|
initialize({ hmacKey, agreementKey, verificationKey, edvUrl, authKey, }: InitializeEDVParams): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Generates new cryptographic keys for EDV operations
|
|
52
|
+
* @returns {Promise<Object>} Generated keys
|
|
53
|
+
* @returns {Object} returns.verificationKey - Ed25519 verification key for authentication
|
|
54
|
+
* @returns {Object} returns.agreementKey - X25519 key agreement key for encryption
|
|
55
|
+
* @returns {Object} returns.hmacKey - HMAC key for indexing
|
|
56
|
+
* @example
|
|
57
|
+
* const keys = await edvService.generateKeys();
|
|
58
|
+
* // Use keys for EDV initialization
|
|
59
|
+
* await edvService.initialize({
|
|
60
|
+
* ...keys,
|
|
61
|
+
* edvUrl: 'https://edv.example.com',
|
|
62
|
+
* authKey: 'auth-token'
|
|
63
|
+
* });
|
|
64
|
+
*/
|
|
13
65
|
generateKeys(): Promise<{
|
|
14
66
|
verificationKey: any;
|
|
15
67
|
agreementKey: any;
|
|
16
68
|
hmacKey: any;
|
|
17
69
|
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Derives cryptographic keys from a master key
|
|
72
|
+
* @param {Uint8Array} masterKey - Master key for derivation
|
|
73
|
+
* @returns {Promise<Object>} Derived keys
|
|
74
|
+
* @returns {Object} returns.verificationKey - Derived Ed25519 verification key
|
|
75
|
+
* @returns {Object} returns.agreementKey - Derived X25519 key agreement key
|
|
76
|
+
* @returns {Object} returns.hmacKey - Derived HMAC key
|
|
77
|
+
* @example
|
|
78
|
+
* const masterKey = new Uint8Array(32); // Your master key
|
|
79
|
+
* const keys = await edvService.deriveKeys(masterKey);
|
|
80
|
+
*/
|
|
18
81
|
deriveKeys(masterKey: Uint8Array): Promise<{
|
|
19
82
|
verificationKey: any;
|
|
20
83
|
agreementKey: any;
|
|
21
84
|
hmacKey: any;
|
|
22
85
|
}>;
|
|
86
|
+
/**
|
|
87
|
+
* Gets the controller identifier for the current EDV
|
|
88
|
+
* @returns {Promise<string>} The controller DID or identifier
|
|
89
|
+
* @example
|
|
90
|
+
* const controller = await edvService.getController();
|
|
91
|
+
* console.log('EDV Controller:', controller);
|
|
92
|
+
*/
|
|
23
93
|
getController(): Promise<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Finds documents in the EDV based on query parameters
|
|
96
|
+
* @param {Object} params - Query parameters
|
|
97
|
+
* @param {Object} [params.equals] - Equality-based query conditions
|
|
98
|
+
* @param {boolean} [params.has] - Existence-based query conditions
|
|
99
|
+
* @param {number} [params.limit] - Maximum number of results
|
|
100
|
+
* @returns {Promise<Array>} Array of matching documents
|
|
101
|
+
* @example
|
|
102
|
+
* const documents = await edvService.find({
|
|
103
|
+
* equals: { 'content.type': 'VerifiableCredential' },
|
|
104
|
+
* limit: 10
|
|
105
|
+
* });
|
|
106
|
+
*/
|
|
24
107
|
find(params: any): any;
|
|
108
|
+
/**
|
|
109
|
+
* Updates a document in the EDV
|
|
110
|
+
* @param {Object} params - Update parameters
|
|
111
|
+
* @param {string} params.id - Document ID to update
|
|
112
|
+
* @param {Object} params.content - New document content
|
|
113
|
+
* @returns {Promise<Object>} Updated document
|
|
114
|
+
* @example
|
|
115
|
+
* const updated = await edvService.update({
|
|
116
|
+
* id: 'doc-123',
|
|
117
|
+
* content: { ...existingContent, updated: true }
|
|
118
|
+
* });
|
|
119
|
+
*/
|
|
25
120
|
update(params: any): any;
|
|
121
|
+
/**
|
|
122
|
+
* Inserts a new document into the EDV
|
|
123
|
+
* @param {Object} params - Insert parameters
|
|
124
|
+
* @param {string} params.id - Document ID
|
|
125
|
+
* @param {Object} params.content - Document content to store
|
|
126
|
+
* @returns {Promise<Object>} The inserted document
|
|
127
|
+
* @throws {Error} If insertion fails
|
|
128
|
+
* @example
|
|
129
|
+
* const document = await edvService.insert({
|
|
130
|
+
* id: 'doc-456',
|
|
131
|
+
* content: {
|
|
132
|
+
* type: 'VerifiableCredential',
|
|
133
|
+
* data: credentialData
|
|
134
|
+
* }
|
|
135
|
+
* });
|
|
136
|
+
*/
|
|
26
137
|
insert(params: any): Promise<any>;
|
|
138
|
+
/**
|
|
139
|
+
* Deletes a document from the EDV
|
|
140
|
+
* @param {Object} params - Deletion parameters
|
|
141
|
+
* @param {string} params.id - Document ID to delete
|
|
142
|
+
* @returns {Promise<boolean>} True if deletion successful
|
|
143
|
+
* @example
|
|
144
|
+
* const deleted = await edvService.delete({
|
|
145
|
+
* id: 'doc-123'
|
|
146
|
+
* });
|
|
147
|
+
*/
|
|
27
148
|
delete(params: any): any;
|
|
149
|
+
/**
|
|
150
|
+
* Derives a key from biometric data using HKDF
|
|
151
|
+
* @param {Buffer} biometricData - Biometric data from provider
|
|
152
|
+
* @param {string} identifier - User's identifier as salt (email, phone number, etc.)
|
|
153
|
+
* @returns {Buffer} Derived key
|
|
154
|
+
* @example
|
|
155
|
+
* const key = edvService.deriveBiometricKey(biometricData, 'user@example.com');
|
|
156
|
+
*/
|
|
157
|
+
deriveBiometricKey(biometricData: Buffer, identifier: string): Buffer;
|
|
158
|
+
/**
|
|
159
|
+
* Generates a key for encrypting/decrypting the master key
|
|
160
|
+
* @param {Buffer} biometricData - Biometric data from provider
|
|
161
|
+
* @param {string} identifier - User's identifier as salt (email, phone number, etc.)
|
|
162
|
+
* @returns {Promise<Object>} Encryption key and IV for AES encryption
|
|
163
|
+
* @returns {Buffer} returns.key - Encryption key
|
|
164
|
+
* @returns {Buffer} returns.iv - Initialization vector
|
|
165
|
+
* @example
|
|
166
|
+
* const { key, iv } = await edvService.deriveBiometricEncryptionKey(biometricData, 'user@example.com');
|
|
167
|
+
*/
|
|
168
|
+
deriveBiometricEncryptionKey(biometricData: Buffer, identifier: string): Promise<{
|
|
169
|
+
key: Buffer;
|
|
170
|
+
iv: Buffer;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Encrypts the master key using a key derived from biometric data
|
|
174
|
+
* @param {Uint8Array} masterKey - The CloudWalletVault master key to encrypt
|
|
175
|
+
* @param {Buffer} encryptionKey - Key derived from biometric data
|
|
176
|
+
* @param {Buffer} iv - Initialization vector
|
|
177
|
+
* @returns {Promise<Uint8Array>} Encrypted master key
|
|
178
|
+
* @example
|
|
179
|
+
* const encrypted = await edvService.encryptMasterKey(masterKey, encryptionKey, iv);
|
|
180
|
+
*/
|
|
181
|
+
encryptMasterKey(masterKey: Uint8Array, encryptionKey: Buffer, iv: Buffer): Promise<Uint8Array>;
|
|
182
|
+
/**
|
|
183
|
+
* Decrypts the master key using biometric-derived key
|
|
184
|
+
* @param {Uint8Array} encryptedKey - The encrypted master key
|
|
185
|
+
* @param {Buffer} decryptionKey - Key derived from biometric data
|
|
186
|
+
* @param {Buffer} iv - Initialization vector
|
|
187
|
+
* @returns {Promise<Uint8Array>} The decrypted master key
|
|
188
|
+
* @throws {Error} If decryption fails
|
|
189
|
+
* @example
|
|
190
|
+
* const masterKey = await edvService.decryptMasterKey(encryptedKey, decryptionKey, iv);
|
|
191
|
+
*/
|
|
192
|
+
decryptMasterKey(encryptedKey: Uint8Array, decryptionKey: Buffer, iv: Buffer): Promise<Uint8Array>;
|
|
28
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Singleton instance of the EDV service
|
|
196
|
+
* @type {EDVService}
|
|
197
|
+
* @example
|
|
198
|
+
* import { edvService } from '@docknetwork/wallet-sdk-wasm/services/edv';
|
|
199
|
+
*
|
|
200
|
+
* // Generate keys and initialize
|
|
201
|
+
* const keys = await edvService.generateKeys();
|
|
202
|
+
* await edvService.initialize({
|
|
203
|
+
* ...keys,
|
|
204
|
+
* edvUrl: 'https://edv.example.com',
|
|
205
|
+
* authKey: 'auth-token'
|
|
206
|
+
* });
|
|
207
|
+
*
|
|
208
|
+
* // Store encrypted data
|
|
209
|
+
* await edvService.insert({
|
|
210
|
+
* id: 'credential-1',
|
|
211
|
+
* content: {
|
|
212
|
+
* type: 'VerifiableCredential',
|
|
213
|
+
* data: credentialData
|
|
214
|
+
* }
|
|
215
|
+
* });
|
|
216
|
+
*
|
|
217
|
+
* // Query encrypted data
|
|
218
|
+
* const credentials = await edvService.find({
|
|
219
|
+
* equals: { 'content.type': 'VerifiableCredential' }
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* // Update encrypted data
|
|
223
|
+
* await edvService.update({
|
|
224
|
+
* id: 'credential-1',
|
|
225
|
+
* content: updatedData
|
|
226
|
+
* });
|
|
227
|
+
*/
|
|
29
228
|
export declare const edvService: EDVService;
|
|
30
229
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/services/edv/service.ts"],"names":[],"mappings":"
|
|
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;AAY7F,eAAO,MAAM,WAAW,KAAK,CAAC;AAC9B,eAAO,MAAM,SAAS,YAAY,CAAC;AAEnC;;;;;GAKG;AACH,qBAAa,UAAU;IACrB,gBAAgB,EAAE,uBAAuB,CAAC;IAE1C,OAAO,CAAC,WAAW,CAAmC;IAC/C,UAAU,EAAE,MAAM,CAAC;IAE1B,UAAU,aAwLG,GAAG,6BAoEkB,MAAM,cAAc,MAAM,KAAG,MAAM,qBAgBpD,MAAM,cACT,MAAM,KACjB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,iBAqB1B,UAAU,iBACN,MAAM,MACjB,MAAM,KACT,OAAO,CAAC,UAAU,CAAC,KAzRpB;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;IAIlB;;;;;;;OAOG;IACH,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM;IAKrE;;;;;;;;;OASG;IACG,4BAA4B,CAChC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAWvC;;;;;;;;OAQG;IACG,gBAAgB,CACpB,SAAS,EAAE,UAAU,EACrB,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,UAAU,CAAC;IAqBtB;;;;;;;;;OASG;IACG,gBAAgB,CACpB,YAAY,EAAE,UAAU,EACxB,aAAa,EAAE,MAAM,EACrB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,UAAU,CAAC;CAwBvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,UAAU,EAAE,UAA6B,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const serviceName = "pex";
|
|
2
2
|
export declare const validation: {
|
|
3
3
|
filterCredentials: (params: FilterCredentialsParams) => void;
|
|
4
|
+
evaluateCredentials: (params: EvaluateCredentialsParams) => void;
|
|
4
5
|
evaluatePresentation: (params: EvaluatePresentationParams) => void;
|
|
5
6
|
};
|
|
6
7
|
export type FilterCredentialsParams = {
|