@docknetwork/wallet-sdk-core 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/.claude/settings.local.json +12 -0
- package/generate-docs.js +33 -0
- package/jsdoc.conf.json +28 -0
- package/lib/biometric-provider.d.ts +124 -32
- package/lib/biometric-provider.d.ts.map +1 -1
- package/lib/biometric-provider.js +146 -7
- package/lib/biometric-provider.js.map +1 -1
- package/lib/cloud-wallet.d.ts +8 -6
- package/lib/cloud-wallet.d.ts.map +1 -1
- package/lib/cloud-wallet.js +41 -57
- package/lib/cloud-wallet.js.map +1 -1
- package/lib/credential-provider.d.ts +58 -33
- package/lib/credential-provider.d.ts.map +1 -1
- package/lib/credential-provider.js +212 -11
- package/lib/credential-provider.js.map +1 -1
- package/lib/credentials/oidvc.js +4 -5
- package/lib/credentials/oidvc.js.map +1 -1
- package/lib/did-provider.d.ts +102 -36
- package/lib/did-provider.d.ts.map +1 -1
- package/lib/did-provider.js +185 -27
- package/lib/did-provider.js.map +1 -1
- package/lib/ecosystem-tools.js +4 -5
- package/lib/ecosystem-tools.js.map +1 -1
- package/lib/helpers.js +6 -6
- package/lib/helpers.js.map +1 -1
- package/lib/message-provider.d.ts +39 -13
- package/lib/message-provider.d.ts.map +1 -1
- package/lib/message-provider.js +173 -22
- package/lib/message-provider.js.map +1 -1
- package/lib/messages/message-helpers.js +6 -6
- package/lib/messages/message-helpers.js.map +1 -1
- package/lib/network-resolver.js +5 -5
- package/lib/network-resolver.js.map +1 -1
- package/lib/qr-handlers/builtin/index.d.ts +30 -0
- package/lib/qr-handlers/builtin/index.d.ts.map +1 -0
- package/lib/qr-handlers/builtin/index.js +46 -0
- package/lib/qr-handlers/builtin/index.js.map +1 -0
- package/lib/qr-handlers/builtin/oid4vc-handler.d.ts +137 -0
- package/lib/qr-handlers/builtin/oid4vc-handler.d.ts.map +1 -0
- package/lib/qr-handlers/builtin/oid4vc-handler.js +134 -0
- package/lib/qr-handlers/builtin/oid4vc-handler.js.map +1 -0
- package/lib/qr-handlers/index.d.ts +76 -0
- package/lib/qr-handlers/index.d.ts.map +1 -0
- package/lib/qr-handlers/index.js +92 -0
- package/lib/qr-handlers/index.js.map +1 -0
- package/lib/qr-handlers/processor.d.ts +110 -0
- package/lib/qr-handlers/processor.d.ts.map +1 -0
- package/lib/qr-handlers/processor.js +251 -0
- package/lib/qr-handlers/processor.js.map +1 -0
- package/lib/qr-handlers/types.d.ts +205 -0
- package/lib/qr-handlers/types.d.ts.map +1 -0
- package/lib/qr-handlers/types.js +10 -0
- package/lib/qr-handlers/types.js.map +1 -0
- package/lib/types.d.ts +613 -13
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js +16 -0
- package/lib/types.js.map +1 -1
- package/lib/verification-controller.d.ts +3 -4
- package/lib/verification-controller.d.ts.map +1 -1
- package/lib/verification-controller.js +10 -3
- package/lib/verification-controller.js.map +1 -1
- package/lib/wallet-to-wallet-verification/walletToWalletVerificationProvider.d.ts +0 -1
- package/lib/wallet-to-wallet-verification/walletToWalletVerificationProvider.d.ts.map +1 -1
- package/lib/wallet-to-wallet-verification/walletToWalletVerificationProvider.js +2 -2
- package/lib/wallet-to-wallet-verification/walletToWalletVerificationProvider.js.map +1 -1
- package/lib/wallet-wasm.d.ts +2 -2
- package/lib/wallet-wasm.d.ts.map +1 -1
- package/lib/wallet-wasm.js +15 -17
- package/lib/wallet-wasm.js.map +1 -1
- package/lib/wallet.d.ts +36 -20
- package/lib/wallet.d.ts.map +1 -1
- package/lib/wallet.js +172 -26
- package/lib/wallet.js.map +1 -1
- package/package.json +19 -11
- package/src/biometric-provider.ts +157 -42
- package/src/cloud-wallet.ts +21 -60
- package/src/credential-provider.test.ts +191 -1
- package/src/credential-provider.ts +208 -27
- package/src/did-provider.ts +183 -34
- package/src/message-provider.ts +177 -38
- package/src/qr-handlers/builtin/index.ts +30 -0
- package/src/qr-handlers/builtin/oid4vc-handler.ts +198 -0
- package/src/qr-handlers/index.ts +76 -0
- package/src/qr-handlers/processor.test.ts +514 -0
- package/src/qr-handlers/processor.ts +311 -0
- package/src/qr-handlers/types.ts +228 -0
- package/src/types.ts +671 -11
- package/src/verification-controller.test.ts +1 -2
- package/src/verification-controller.ts +14 -2
- package/src/wallet-wasm.ts +5 -8
- package/src/wallet.ts +173 -24
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,20 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module credential-provider
|
|
4
|
+
* @description Verifiable credential management functionality for the Truvera Wallet SDK.
|
|
5
|
+
* This module provides functions for importing, verifying, storing, and managing verifiable credentials.
|
|
6
|
+
*/
|
|
2
7
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
8
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
9
|
};
|
|
5
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
11
|
+
exports.CredentialStatus = exports.ACUMM_WITNESS_PROP_KEY = void 0;
|
|
12
|
+
exports.isBBSPlusCredential = isBBSPlusCredential;
|
|
13
|
+
exports.importCredentialFromURI = importCredentialFromURI;
|
|
14
|
+
exports.isCredentialExpired = isCredentialExpired;
|
|
15
|
+
exports.isValid = isValid;
|
|
16
|
+
exports.addCredential = addCredential;
|
|
17
|
+
exports.removeCredential = removeCredential;
|
|
18
|
+
exports.createCredentialProvider = createCredentialProvider;
|
|
7
19
|
const credential_1 = require("@docknetwork/wallet-sdk-wasm/lib/services/credential");
|
|
8
20
|
const assert_1 = __importDefault(require("assert"));
|
|
9
21
|
const blockchain_1 = require("@docknetwork/wallet-sdk-wasm/lib/services/blockchain");
|
|
10
22
|
const oidvc_1 = require("./credentials/oidvc");
|
|
23
|
+
/**
|
|
24
|
+
* Internal function to check if a credential uses BBS+ signature
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
11
27
|
function isBBSPlusCredential(credential) {
|
|
12
28
|
return ((typeof credential?.proof?.type === 'string' &&
|
|
13
29
|
credential.proof.type.includes('BBS+SignatureDock')) ||
|
|
14
30
|
(Array.isArray(credential['@context']) &&
|
|
15
31
|
credential['@context'].find(context => context.bs && context.bs.indexOf('bbs') > -1)));
|
|
16
32
|
}
|
|
17
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Internal function to import credential from URI
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
18
37
|
async function importCredentialFromURI({ uri, wallet, didProvider, getAuthCode, }) {
|
|
19
38
|
// TODO: unify the impl with the existing import credential flow
|
|
20
39
|
// if the URI is an OpenID credential offer, use the OpenID flow
|
|
@@ -27,16 +46,18 @@ async function importCredentialFromURI({ uri, wallet, didProvider, getAuthCode,
|
|
|
27
46
|
});
|
|
28
47
|
await addCredential({ wallet, credential });
|
|
29
48
|
}
|
|
30
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Internal function to check if credential is expired
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
31
53
|
function isCredentialExpired(credential) {
|
|
32
54
|
return (!!credential.expirationDate &&
|
|
33
55
|
new Date(credential.expirationDate) < new Date());
|
|
34
56
|
}
|
|
35
|
-
exports.isCredentialExpired = isCredentialExpired;
|
|
36
57
|
/**
|
|
37
58
|
* Uses Dock SDK to verify a credential
|
|
38
59
|
* @param credential
|
|
39
|
-
* @returns
|
|
60
|
+
* @returns {Promise<Object>} Verification result with status and optional error/warning messages
|
|
40
61
|
*/
|
|
41
62
|
async function isValid({ credential, wallet, }) {
|
|
42
63
|
(0, assert_1.default)(!!credential, 'credential is required');
|
|
@@ -101,9 +122,26 @@ async function isValid({ credential, wallet, }) {
|
|
|
101
122
|
};
|
|
102
123
|
}
|
|
103
124
|
}
|
|
104
|
-
exports.isValid = isValid;
|
|
105
125
|
exports.ACUMM_WITNESS_PROP_KEY = '$$accum__witness$$';
|
|
126
|
+
/**
|
|
127
|
+
* Internal function to add credential to wallet
|
|
128
|
+
* @private
|
|
129
|
+
*/
|
|
106
130
|
async function addCredential({ wallet, credential }) {
|
|
131
|
+
// Check if the credential is an SD-JWT (string format)
|
|
132
|
+
if (typeof credential === 'string') {
|
|
133
|
+
try {
|
|
134
|
+
const isSDJWT = await credential_1.credentialServiceRPC.isSDJWTCredential({ credential });
|
|
135
|
+
if (isSDJWT) {
|
|
136
|
+
// Convert SD-JWT to W3C format (includes _sd_jwt metadata for unwrapping)
|
|
137
|
+
credential = await credential_1.credentialServiceRPC.credentialToW3C({ credential });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.error('Error checking/converting SD-JWT credential:', error);
|
|
142
|
+
throw new Error('Failed to process SD-JWT credential: ' + error.message);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
107
145
|
const acummWitness = credential[exports.ACUMM_WITNESS_PROP_KEY];
|
|
108
146
|
if (acummWitness) {
|
|
109
147
|
delete credential[exports.ACUMM_WITNESS_PROP_KEY];
|
|
@@ -120,7 +158,10 @@ async function addCredential({ wallet, credential }) {
|
|
|
120
158
|
syncCredentialStatus({ wallet, credentialIds: [credential.id] });
|
|
121
159
|
return response;
|
|
122
160
|
}
|
|
123
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Internal function to get membership witness for credential
|
|
163
|
+
* @private
|
|
164
|
+
*/
|
|
124
165
|
async function getMembershipWitness({ credentialId, wallet }) {
|
|
125
166
|
const document = await wallet.getDocumentById(`${credentialId}#witness`);
|
|
126
167
|
return document?.value;
|
|
@@ -140,6 +181,10 @@ exports.CredentialStatus = {
|
|
|
140
181
|
* @param param0
|
|
141
182
|
* @returns CredentialStatusDocument[]
|
|
142
183
|
*/
|
|
184
|
+
/**
|
|
185
|
+
* Internal function to sync credential status from blockchain
|
|
186
|
+
* @private
|
|
187
|
+
*/
|
|
143
188
|
async function syncCredentialStatus({ wallet, credentialIds, forceFetch, }) {
|
|
144
189
|
let credentials;
|
|
145
190
|
if (credentialIds && credentialIds.length) {
|
|
@@ -165,7 +210,9 @@ async function syncCredentialStatus({ wallet, credentialIds, forceFetch, }) {
|
|
|
165
210
|
await wallet.addDocument(statusDoc);
|
|
166
211
|
}
|
|
167
212
|
statusDocs.push(statusDoc);
|
|
168
|
-
|
|
213
|
+
// Revoked and Expired statuses should be cached
|
|
214
|
+
// The user can fore refresh that from the credentials screen
|
|
215
|
+
if (!statusDoc.status || statusDoc.status === exports.CredentialStatus.Invalid || statusDoc.status === exports.CredentialStatus.Pending) {
|
|
169
216
|
shouldFetch = true;
|
|
170
217
|
}
|
|
171
218
|
if (!shouldFetch) {
|
|
@@ -201,7 +248,11 @@ async function syncCredentialStatus({ wallet, credentialIds, forceFetch, }) {
|
|
|
201
248
|
/**
|
|
202
249
|
* Removes a credential and its related documents from the wallet
|
|
203
250
|
* @param param0
|
|
204
|
-
* @returns
|
|
251
|
+
* @returns {Promise<void>}
|
|
252
|
+
*/
|
|
253
|
+
/**
|
|
254
|
+
* Internal function to remove credential and related documents
|
|
255
|
+
* @private
|
|
205
256
|
*/
|
|
206
257
|
async function removeCredential({ wallet, credential, }) {
|
|
207
258
|
// Allow passing either a credential object or a credential ID
|
|
@@ -216,24 +267,134 @@ async function removeCredential({ wallet, credential, }) {
|
|
|
216
267
|
await wallet.removeDocument(`${credentialId}#status`);
|
|
217
268
|
}
|
|
218
269
|
}
|
|
219
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Creates a credential provider instance bound to a wallet
|
|
272
|
+
* @param {Object} params - Provider configuration
|
|
273
|
+
* @param {IWallet} params.wallet - The wallet instance to use for credential storage
|
|
274
|
+
* @returns {ICredentialProvider} A credential provider instance with all verifiable credential management methods
|
|
275
|
+
* @see {@link ICredentialProvider} - The interface defining all available credential provider methods
|
|
276
|
+
* @example
|
|
277
|
+
* import { createCredentialProvider } from '@docknetwork/wallet-sdk-core';
|
|
278
|
+
*
|
|
279
|
+
* const credentialProvider = createCredentialProvider({wallet});
|
|
280
|
+
*
|
|
281
|
+
* // Add a credential
|
|
282
|
+
* const addedCredential = await credentialProvider.addCredential(myCredential);
|
|
283
|
+
*
|
|
284
|
+
* // Validate a credential
|
|
285
|
+
* const result = await credentialProvider.isValid(credential);
|
|
286
|
+
* if (result.status === 'verified') {
|
|
287
|
+
* console.log('Credential is valid');
|
|
288
|
+
* }
|
|
289
|
+
*
|
|
290
|
+
* // Get all credentials
|
|
291
|
+
* const allCredentials = credentialProvider.getCredentials();
|
|
292
|
+
*
|
|
293
|
+
* // Import from URI
|
|
294
|
+
* await credentialProvider.importCredentialFromURI({
|
|
295
|
+
* uri: 'https://example.com/credential-offer',
|
|
296
|
+
* didProvider
|
|
297
|
+
* });
|
|
298
|
+
*/
|
|
220
299
|
function createCredentialProvider({ wallet, }) {
|
|
221
300
|
function getCredentials(type = 'VerifiableCredential') {
|
|
222
301
|
return wallet.getDocumentsByType(type);
|
|
223
302
|
}
|
|
224
303
|
return {
|
|
304
|
+
/**
|
|
305
|
+
* Imports a credential from a URI (supports OpenID credential offers)
|
|
306
|
+
* @memberof ICredentialProvider
|
|
307
|
+
* @param {Object} params - Import parameters
|
|
308
|
+
* @param {string} params.uri - The URI containing the credential offer
|
|
309
|
+
* @param {any} params.didProvider - DID provider instance for key management
|
|
310
|
+
* @param {Function} [params.getAuthCode] - Optional callback to handle authorization
|
|
311
|
+
* @returns {Promise<any>} The imported credential
|
|
312
|
+
* @throws {Error} If import fails
|
|
313
|
+
* @example
|
|
314
|
+
* const credential = await credentialProvider.importCredentialFromURI({
|
|
315
|
+
* uri: 'https://issuer.example.com/credential-offer',
|
|
316
|
+
* didProvider,
|
|
317
|
+
* getAuthCode: async (url) => getUserAuthCode(url)
|
|
318
|
+
* });
|
|
319
|
+
*/
|
|
225
320
|
importCredentialFromURI: async (params) => importCredentialFromURI({
|
|
226
321
|
...params,
|
|
227
322
|
wallet,
|
|
228
323
|
}),
|
|
324
|
+
/**
|
|
325
|
+
* Retrieves credentials from the wallet, optionally filtered by type
|
|
326
|
+
* @memberof ICredentialProvider
|
|
327
|
+
* @param {string} [type='VerifiableCredential'] - The credential type to filter by
|
|
328
|
+
* @returns {any[]} Array of credentials matching the specified type
|
|
329
|
+
* @example
|
|
330
|
+
* const allCredentials = credentialProvider.getCredentials();
|
|
331
|
+
* const certificates = credentialProvider.getCredentials('Certificate');
|
|
332
|
+
*/
|
|
229
333
|
getCredentials,
|
|
334
|
+
/**
|
|
335
|
+
* Gets the membership witness for a credential (used for BBS+ credentials)
|
|
336
|
+
* @memberof ICredentialProvider
|
|
337
|
+
* @param {string} credentialId - The credential ID to get the witness for
|
|
338
|
+
* @returns {Promise<any>} The membership witness data
|
|
339
|
+
* @example
|
|
340
|
+
* const witness = await credentialProvider.getMembershipWitness('credential-123');
|
|
341
|
+
*/
|
|
230
342
|
getMembershipWitness: async (credentialId) => getMembershipWitness({ credentialId, wallet }),
|
|
343
|
+
/**
|
|
344
|
+
* Retrieves a credential by its ID
|
|
345
|
+
* @memberof ICredentialProvider
|
|
346
|
+
* @param {string} id - The unique identifier of the credential
|
|
347
|
+
* @returns {any} The credential document
|
|
348
|
+
* @throws {Error} If credential is not found
|
|
349
|
+
* @example
|
|
350
|
+
* const credential = await credentialProvider.getById('credential-123');
|
|
351
|
+
*/
|
|
231
352
|
getById: (id) => wallet.getDocumentById(id),
|
|
353
|
+
/**
|
|
354
|
+
* Checks if a credential uses BBS+ signature
|
|
355
|
+
* @memberof ICredentialProvider
|
|
356
|
+
* @param {any} credential - The credential to check
|
|
357
|
+
* @returns {boolean} True if the credential uses BBS+ signature
|
|
358
|
+
* @example
|
|
359
|
+
* const isBBS = credentialProvider.isBBSPlusCredential(credential);
|
|
360
|
+
* if (isBBS) {
|
|
361
|
+
* console.log('This credential uses BBS+ signatures');
|
|
362
|
+
* }
|
|
363
|
+
*/
|
|
232
364
|
isBBSPlusCredential,
|
|
365
|
+
/**
|
|
366
|
+
* Validates a credential by verifying its cryptographic proof and status
|
|
367
|
+
* @memberof ICredentialProvider
|
|
368
|
+
* @param {any} credential - The credential to validate
|
|
369
|
+
* @param {boolean} [forceFetch=false] - Whether to force refresh the credential status
|
|
370
|
+
* @returns {Promise<Object>} Validation result
|
|
371
|
+
* @returns {string} returns.status - Validation status (verified, revoked, expired, invalid, pending)
|
|
372
|
+
* @returns {string} [returns.error] - Error message if validation failed
|
|
373
|
+
* @returns {string} [returns.warning] - Warning message if any
|
|
374
|
+
* @throws {Error} If validation fails
|
|
375
|
+
* @example
|
|
376
|
+
* const result = await credentialProvider.isValid(credential);
|
|
377
|
+
* if (result.status === 'verified') {
|
|
378
|
+
* console.log('Credential is valid');
|
|
379
|
+
* } else if (result.status === 'revoked') {
|
|
380
|
+
* console.log('Credential has been revoked');
|
|
381
|
+
* }
|
|
382
|
+
*/
|
|
233
383
|
isValid: async (credential) => isValid({
|
|
234
384
|
credential,
|
|
235
385
|
wallet,
|
|
236
386
|
}),
|
|
387
|
+
/**
|
|
388
|
+
* Gets the current status of a credential (cached, fast operation)
|
|
389
|
+
* @memberof ICredentialProvider
|
|
390
|
+
* @param {any} credential - The credential to check
|
|
391
|
+
* @returns {Promise<Object>} Current credential status
|
|
392
|
+
* @returns {string} returns.status - Current status of the credential
|
|
393
|
+
* @returns {string} [returns.error] - Error message if any
|
|
394
|
+
* @example
|
|
395
|
+
* const status = await credentialProvider.getCredentialStatus(credential);
|
|
396
|
+
* console.log(`Credential status: ${status.status}`);
|
|
397
|
+
*/
|
|
237
398
|
getCredentialStatus: async (credential) => {
|
|
238
399
|
(0, assert_1.default)(!!credential, 'credential is required');
|
|
239
400
|
if (isCredentialExpired(credential)) {
|
|
@@ -247,13 +408,53 @@ function createCredentialProvider({ wallet, }) {
|
|
|
247
408
|
error: statusDoc?.error,
|
|
248
409
|
};
|
|
249
410
|
},
|
|
411
|
+
/**
|
|
412
|
+
* Synchronizes credential status from the blockchain
|
|
413
|
+
* @memberof ICredentialProvider
|
|
414
|
+
* @param {Object} params - Sync parameters
|
|
415
|
+
* @param {string[]} [params.credentialIds] - Optional list of credential IDs to sync
|
|
416
|
+
* @param {boolean} [params.forceFetch=false] - Whether to force refresh from blockchain
|
|
417
|
+
* @returns {Promise<any[]>} Array of credential status documents
|
|
418
|
+
* @example
|
|
419
|
+
* // Sync all credentials
|
|
420
|
+
* await credentialProvider.syncCredentialStatus({});
|
|
421
|
+
*
|
|
422
|
+
* // Sync specific credentials
|
|
423
|
+
* await credentialProvider.syncCredentialStatus({
|
|
424
|
+
* credentialIds: ['cred-1', 'cred-2'],
|
|
425
|
+
* forceFetch: true
|
|
426
|
+
* });
|
|
427
|
+
*/
|
|
250
428
|
syncCredentialStatus: async (props) => {
|
|
251
429
|
return syncCredentialStatus({ wallet, ...props });
|
|
252
430
|
},
|
|
431
|
+
/**
|
|
432
|
+
* Adds a credential to the wallet
|
|
433
|
+
* @memberof ICredentialProvider
|
|
434
|
+
* @param {any} credential - The credential to add
|
|
435
|
+
* @returns {Promise<any>} The added credential document
|
|
436
|
+
* @example
|
|
437
|
+
* const addedCredential = await credentialProvider.addCredential({
|
|
438
|
+
* '@context': ['https://www.w3.org/2018/credentials/v1'],
|
|
439
|
+
* type: ['VerifiableCredential'],
|
|
440
|
+
* issuer: 'did:dock:issuer123',
|
|
441
|
+
* credentialSubject: { name: 'Alice' }
|
|
442
|
+
* });
|
|
443
|
+
*/
|
|
253
444
|
addCredential: credential => addCredential({ wallet, credential }),
|
|
445
|
+
/**
|
|
446
|
+
* Removes a credential and all its related documents from the wallet
|
|
447
|
+
* @memberof ICredentialProvider
|
|
448
|
+
* @param {any} credential - The credential to remove
|
|
449
|
+
* @returns {Promise<void>}
|
|
450
|
+
* @throws {Error} If credential is not found
|
|
451
|
+
* @example
|
|
452
|
+
* await credentialProvider.removeCredential(credential);
|
|
453
|
+
* // Or by ID
|
|
454
|
+
* await credentialProvider.removeCredential('credential-123');
|
|
455
|
+
*/
|
|
254
456
|
removeCredential: credential => removeCredential({ wallet, credential }),
|
|
255
457
|
// TODO: move import credential from json or URL to this provider
|
|
256
458
|
};
|
|
257
459
|
}
|
|
258
|
-
exports.createCredentialProvider = createCredentialProvider;
|
|
259
460
|
//# sourceMappingURL=credential-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential-provider.js","sourceRoot":"","sources":["../src/credential-provider.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"credential-provider.js","sourceRoot":"","sources":["../src/credential-provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAgBH,kDASC;AAYD,0DAmBC;AAMD,kDAKC;AAOD,0BAwFC;AAQD,sCAoCC;AAuID,4CAsBC;AA+BD,4DA2KC;AAnjBD,qFAA0F;AAG1F,oDAA4B;AAC5B,qFAAuF;AACvF,+CAAmE;AAKnE;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,UAAU;IAC5C,OAAO,CACL,CAAC,OAAO,UAAU,EAAE,KAAK,EAAE,IAAI,KAAK,QAAQ;QAC1C,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACtD,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACpC,UAAU,CAAC,UAAU,CAAC,CAAC,IAAI,CACzB,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,IAAI,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CACxD,CAAC,CACL,CAAC;AACJ,CAAC;AAQD;;;GAGG;AACI,KAAK,UAAU,uBAAuB,CAAC,EAC5C,GAAG,EACH,MAAM,EACN,WAAW,EACX,WAAW,GAGZ;IACC,gEAAgE;IAChE,gEAAgE;IAChE,0EAA0E;IAC1E,0DAA0D;IAC1D,MAAM,UAAU,GAAG,MAAM,IAAA,sCAA8B,EAAC;QACtD,WAAW;QACX,GAAG;QACH,WAAW;KACZ,CAAC,CAAC;IAEH,MAAM,aAAa,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,CAAC,CAAC;AAC5C,CAAC;AAED;;;GAGG;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C;QACnD;;;;;;;;;;WAUG;QACH,mBAAmB;QACnB;;;;;;;;;;;;;;;;;WAiBG;QACH,OAAO,EAAE,KAAK,EAAC,UAAU,EAAC,EAAE,CAC1B,OAAO,CAAC;YACN,UAAU;YACV,MAAM;SACP,CAAQ;QACX;;;;;;;;;;WAUG;QACH,mBAAmB,EAAE,KAAK,EAAE,UAAsB,EAAE,EAAE;YACpD,IAAA,gBAAM,EAAC,CAAC,CAAC,UAAU,EAAE,wBAAwB,CAAC,CAAC;YAE/C,IAAI,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;gBACpC,OAAO;oBACL,MAAM,EAAE,wBAAgB,CAAC,OAAO;iBACjC,CAAC;YACJ,CAAC;YAED,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC;YAE1E,OAAO;gBACL,MAAM,EAAE,SAAS,EAAE,MAAM,IAAI,wBAAgB,CAAC,OAAO;gBACrD,KAAK,EAAE,SAAS,EAAE,KAAK;aACxB,CAAC;QACJ,CAAC;QACD;;;;;;;;;;;;;;;;WAgBG;QACH,oBAAoB,EAAE,KAAK,EAAE,KAAiC,EAAE,EAAE;YAChE,OAAO,oBAAoB,CAAC,EAAC,MAAM,EAAE,GAAG,KAAK,EAAC,CAAC,CAAC;QAClD,CAAC;QACD;;;;;;;;;;;;WAYG;QACH,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,aAAa,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,CAAC;QAChE;;;;;;;;;;WAUG;QACH,gBAAgB,EAAE,UAAU,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAE,UAAU,EAAC,CAAC;QACtE,iEAAiE;KAClE,CAAC;AACJ,CAAC"}
|
package/lib/credentials/oidvc.js
CHANGED
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.acquireOpenIDCredentialFromURI = acquireOpenIDCredentialFromURI;
|
|
7
|
+
exports.getAuthURL = getAuthURL;
|
|
8
|
+
exports.decodeRequestJWT = decodeRequestJWT;
|
|
9
|
+
exports.getPresentationSubmision = getPresentationSubmision;
|
|
7
10
|
const credential_1 = require("@docknetwork/wallet-sdk-wasm/lib/services/credential");
|
|
8
11
|
const jwt_decode_1 = require("jwt-decode");
|
|
9
12
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -28,7 +31,6 @@ async function acquireOpenIDCredentialFromURI({ didProvider, uri, getAuthCode, }
|
|
|
28
31
|
}
|
|
29
32
|
return response.credential;
|
|
30
33
|
}
|
|
31
|
-
exports.acquireOpenIDCredentialFromURI = acquireOpenIDCredentialFromURI;
|
|
32
34
|
async function getAuthURL(uri, walletClientId = 'dock-wallet', requestedRedirectURI = 'dockwallet://vp') {
|
|
33
35
|
function buildOID4VPRequestURL(params, prefix = 'dockwallet://') {
|
|
34
36
|
return `${prefix}?${Object.keys(params)
|
|
@@ -64,7 +66,6 @@ async function getAuthURL(uri, walletClientId = 'dock-wallet', requestedRedirect
|
|
|
64
66
|
client_id: walletClientId,
|
|
65
67
|
}, metadata.authorization_endpoint);
|
|
66
68
|
}
|
|
67
|
-
exports.getAuthURL = getAuthURL;
|
|
68
69
|
async function decodeRequestJWT(uri) {
|
|
69
70
|
const searchParams = new URL(uri).searchParams;
|
|
70
71
|
const params = new URLSearchParams(searchParams);
|
|
@@ -73,7 +74,6 @@ async function decodeRequestJWT(uri) {
|
|
|
73
74
|
const decoded = (0, jwt_decode_1.jwtDecode)(jwt);
|
|
74
75
|
return decoded;
|
|
75
76
|
}
|
|
76
|
-
exports.decodeRequestJWT = decodeRequestJWT;
|
|
77
77
|
async function getPresentationSubmision({ credentials, presentationDefinition, holderDID, }) {
|
|
78
78
|
const presentation = await pex_1.pexService.presentationFrom({
|
|
79
79
|
presentationDefinition,
|
|
@@ -82,6 +82,5 @@ async function getPresentationSubmision({ credentials, presentationDefinition, h
|
|
|
82
82
|
});
|
|
83
83
|
return presentation?.presentation_submission;
|
|
84
84
|
}
|
|
85
|
-
exports.getPresentationSubmision = getPresentationSubmision;
|
|
86
85
|
pex_1.pexService.evaluatePresentation;
|
|
87
86
|
//# sourceMappingURL=oidvc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oidvc.js","sourceRoot":"","sources":["../../src/credentials/oidvc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oidvc.js","sourceRoot":"","sources":["../../src/credentials/oidvc.ts"],"names":[],"mappings":";;;;;AASA,wEA8BC;AAED,gCAmDC;AAED,4CAQC;AAED,4DAYC;AAlHD,qFAA0F;AAE1F,2CAAqC;AACrC,kDAA0B;AAC1B,uEAAyE;AACzE,6DAA4D;AAErD,KAAK,UAAU,8BAA8B,CAAC,EACnD,WAAW,EACX,GAAG,EACH,WAAW,GAKZ;IACC,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,WAAW,CAAC,cAAc,EAAE,CAAC;IAE/D,IAAI,QAAQ,GAAG,MAAM,iCAAoB,CAAC,oBAAoB,CAAC;QAC7D,GAAG;QACH,iBAAiB;KAClB,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACrG,CAAC;IAED,IAAI,QAAQ,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,iBAAiB,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACvE,QAAQ,GAAG,MAAM,iCAAoB,CAAC,oBAAoB,CAAC;YACzD,GAAG;YACH,iBAAiB;YACjB,iBAAiB;SAClB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC,UAAU,CAAC;AAC7B,C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AAE;wBACP,oBAAoB,EAAE,CAAC,YAAY,CAAC;qBACrC;iBACF;aACF,CAAC;YACJ,CAAC,CAAC,CAAC,OAAO,CAAC;KAChB,CAAC;IAEF,OAAO,qBAAqB,CAC1B;QACE,GAAG,aAAa;QAChB,SAAS,EAAE,cAAc;KAC1B,EACD,QAAQ,CAAC,sBAAsB,CAChC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,gBAAgB,CAAC,GAAW;IAChD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC/C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAC7C,MAAM,GAAG,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,IAAA,sBAAS,EAAC,GAAG,CAAC,CAAC;IAE/B,OAAO,OAAO,CAAC;AACjB,CAAC;AAEM,KAAK,UAAU,wBAAwB,CAAC,EAC7C,WAAW,EACX,sBAAsB,EACtB,SAAS,GACV;IACC,MAAM,YAAY,GAAG,MAAM,gBAAU,CAAC,gBAAgB,CAAC;QACrD,sBAAsB;QACtB,WAAW;QACX,SAAS;KACV,CAAC,CAAC;IAEH,OAAO,YAAY,EAAE,uBAAuB,CAAC;AAC/C,CAAC;AAED,gBAAU,CAAC,oBAAoB,CAAC"}
|
package/lib/did-provider.d.ts
CHANGED
|
@@ -1,69 +1,135 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @module did-provider
|
|
3
|
+
* @description DID (Decentralized Identifier) management functionality for the Truvera Wallet SDK.
|
|
4
|
+
* This module provides functions for creating, importing, exporting, and managing DIDs.
|
|
5
|
+
*/
|
|
6
|
+
import { IWallet, IDIDProvider } from './types';
|
|
7
|
+
export type { IDIDProvider };
|
|
8
|
+
/**
|
|
9
|
+
* Internal function to import a DID from an encrypted wallet JSON
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
2
12
|
export declare function importDID({ wallet, encryptedJSONWallet, password, }: {
|
|
3
13
|
wallet: IWallet;
|
|
4
14
|
encryptedJSONWallet: any;
|
|
5
15
|
password: string;
|
|
6
16
|
}): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Internal function to create a DID document from a keypair document
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
7
21
|
export declare const createDIDKeyDocument: (keypairDoc: any, didDocParams?: any) => Promise<{
|
|
8
|
-
didDocumentResolution:
|
|
22
|
+
didDocumentResolution: {
|
|
23
|
+
'@context': string[];
|
|
24
|
+
id: string;
|
|
25
|
+
type: string;
|
|
26
|
+
correlation: any[];
|
|
27
|
+
created: string;
|
|
28
|
+
expires: string;
|
|
29
|
+
name: any;
|
|
30
|
+
didDocument: any;
|
|
31
|
+
};
|
|
9
32
|
keypairDoc: any;
|
|
10
33
|
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Internal function to create a new DID:key with an associated keypair
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
11
38
|
export declare function createDIDKey({ wallet, name, derivePath, type }: {
|
|
12
39
|
wallet: any;
|
|
13
40
|
name: any;
|
|
14
41
|
derivePath?: any;
|
|
15
42
|
type?: any;
|
|
16
43
|
}): Promise<{
|
|
17
|
-
keyDoc:
|
|
18
|
-
|
|
44
|
+
keyDoc: {
|
|
45
|
+
controller: any;
|
|
46
|
+
type: any;
|
|
47
|
+
id: any;
|
|
48
|
+
publicKeyMultibase: string;
|
|
49
|
+
privateKeyMultibase: string;
|
|
50
|
+
privateKeyBase58: any;
|
|
51
|
+
publicKeyBase58: any;
|
|
52
|
+
};
|
|
53
|
+
didDocumentResolution: {
|
|
54
|
+
'@context': string[];
|
|
55
|
+
id: string;
|
|
56
|
+
type: string;
|
|
57
|
+
correlation: any[];
|
|
58
|
+
created: string;
|
|
59
|
+
expires: string;
|
|
60
|
+
name: any;
|
|
61
|
+
didDocument: any;
|
|
62
|
+
};
|
|
19
63
|
}>;
|
|
20
64
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @param param0
|
|
24
|
-
* @returns
|
|
65
|
+
* Internal function to retrieve all DIDs stored in the wallet
|
|
66
|
+
* @private
|
|
25
67
|
*/
|
|
26
68
|
export declare function getAll({ wallet }: {
|
|
27
69
|
wallet: any;
|
|
28
70
|
}): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Internal function to get the default DID from the wallet
|
|
73
|
+
* @private
|
|
74
|
+
*/
|
|
29
75
|
export declare function getDefaultDID({ wallet }: {
|
|
30
76
|
wallet: any;
|
|
31
77
|
}): Promise<any>;
|
|
78
|
+
/**
|
|
79
|
+
* Internal function to retrieve all keypairs associated with DIDs
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
32
82
|
export declare function getDIDKeyPairs({ wallet }: {
|
|
33
83
|
wallet: any;
|
|
34
84
|
}): Promise<any[]>;
|
|
35
85
|
export declare function ensureDID({ wallet }: {
|
|
36
86
|
wallet: any;
|
|
37
87
|
}): Promise<{
|
|
38
|
-
keyDoc:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
type?: string;
|
|
50
|
-
}): Promise<any>;
|
|
51
|
-
editDID(params: {
|
|
88
|
+
keyDoc: {
|
|
89
|
+
controller: any;
|
|
90
|
+
type: any;
|
|
91
|
+
id: any;
|
|
92
|
+
publicKeyMultibase: string;
|
|
93
|
+
privateKeyMultibase: string;
|
|
94
|
+
privateKeyBase58: any;
|
|
95
|
+
publicKeyBase58: any;
|
|
96
|
+
};
|
|
97
|
+
didDocumentResolution: {
|
|
98
|
+
'@context': string[];
|
|
52
99
|
id: string;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
100
|
+
type: string;
|
|
101
|
+
correlation: any[];
|
|
102
|
+
created: string;
|
|
103
|
+
expires: string;
|
|
104
|
+
name: any;
|
|
105
|
+
didDocument: any;
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a DID provider instance bound to a wallet
|
|
110
|
+
* @param {Object} params - Provider configuration
|
|
111
|
+
* @param {IWallet} params.wallet - The wallet instance to bind the provider to
|
|
112
|
+
* @returns {IDIDProvider} A DID provider instance with all DID management methods
|
|
113
|
+
* @see {@link IDIDProvider} - The interface defining all available DID provider methods
|
|
114
|
+
* @example
|
|
115
|
+
* import { createDIDProvider } from '@docknetwork/wallet-sdk-core';
|
|
116
|
+
*
|
|
117
|
+
* const didProvider = createDIDProvider({wallet});
|
|
118
|
+
*
|
|
119
|
+
* // Create a new DID
|
|
120
|
+
* const {keyDoc, didDocumentResolution} = await didProvider.createDIDKey({
|
|
121
|
+
* name: 'My DID'
|
|
122
|
+
* });
|
|
123
|
+
*
|
|
124
|
+
* // Get all DIDs
|
|
125
|
+
* const allDIDs = await didProvider.getAll();
|
|
126
|
+
*
|
|
127
|
+
* // Export a DID
|
|
128
|
+
* const exportedDID = await didProvider.exportDID({
|
|
129
|
+
* id: didDocumentResolution.id,
|
|
130
|
+
* password: 'mypassword'
|
|
131
|
+
* });
|
|
132
|
+
*/
|
|
67
133
|
export declare function createDIDProvider({ wallet }: {
|
|
68
134
|
wallet: any;
|
|
69
135
|
}): IDIDProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"did-provider.d.ts","sourceRoot":"","sources":["../src/did-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"did-provider.d.ts","sourceRoot":"","sources":["../src/did-provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,OAAO,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAC,YAAY,EAAC,CAAC;AAI3B;;;GAGG;AACH,wBAAsB,SAAS,CAAC,EAC9B,MAAM,EACN,mBAAmB,EACnB,QAAQ,GACT,EAAE;IACD,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,EAAE,GAAG,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;CAClB,gBAuCA;AAwDD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,YAAY,GAAG,EACf,eAAc,GAAQ;;;;;;;;;;;;EAuBvB,CAAC;AAEF;;;GAGG;AACH,wBAAsB,YAAY,CAAC,EAAC,MAAM,EAAE,IAAI,EAAE,UAAoB,EAAE,IAAc,EAAC;;;;;CAAA;;;;;;;;;;;;;;;;;;;;GAiBtF;AAED;;;GAGG;AACH,wBAAsB,MAAM,CAAC,EAAC,MAAM,EAAC;;CAAA,gBAIpC;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,EAAC,MAAM,EAAC;;CAAA,gBAI3C;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,EAAC,MAAM,EAAC;;CAAA,kBAS5C;AAGD,wBAAsB,SAAS,CAAC,EAAC,MAAM,EAAC;;CAAA;;;;;;;;;;;;;;;;;;;;GAMvC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,iBAAiB,CAAC,EAAC,MAAM,EAAC;;CAAA,GAAG,YAAY,CAwIxD"}
|