@docknetwork/wallet-sdk-core 1.5.14 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generate-docs.js +33 -0
- package/jsdoc.conf.json +28 -0
- package/lib/biometric-provider.d.ts +123 -31
- 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 +7 -3
- package/lib/cloud-wallet.d.ts.map +1 -1
- package/lib/cloud-wallet.js +29 -18
- 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 +214 -13
- package/lib/credential-provider.js.map +1 -1
- package/lib/credentials/oidvc.js +6 -7
- 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 +186 -28
- package/lib/did-provider.js.map +1 -1
- package/lib/ecosystem-tools.js +5 -6
- 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 +146 -20
- 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.d.ts +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 +610 -14
- 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 +0 -1
- package/lib/verification-controller.d.ts.map +1 -1
- package/lib/verification-controller.js +12 -5
- 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 +3 -3
- package/lib/wallet-to-wallet-verification/walletToWalletVerificationProvider.js.map +1 -1
- package/lib/wallet-wasm.d.ts.map +1 -1
- package/lib/wallet-wasm.js +13 -14
- 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 +174 -28
- package/lib/wallet.js.map +1 -1
- package/package.json +17 -9
- package/src/biometric-provider.ts +157 -42
- package/src/cloud-wallet.ts +13 -0
- 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 +148 -34
- 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 +666 -11
- package/src/verification-controller.test.ts +1 -2
- package/src/verification-controller.ts +9 -1
- package/src/wallet-wasm.ts +1 -3
- package/src/wallet.ts +173 -24
- package/tsconfig.build.tsbuildinfo +1 -1
package/lib/wallet.js
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @module wallet
|
|
4
|
+
* @description Core wallet functionality for the Dock Wallet SDK.
|
|
5
|
+
* This module provides the main wallet creation and management functions.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
8
|
+
exports.WalletEvents = void 0;
|
|
9
|
+
exports.ensureDocumentContext = ensureDocumentContext;
|
|
10
|
+
exports.createWallet = createWallet;
|
|
11
|
+
const types_1 = require("./types");
|
|
12
|
+
Object.defineProperty(exports, "WalletEvents", { enumerable: true, get: function () { return types_1.WalletEvents; } });
|
|
4
13
|
const wallet_wasm_1 = require("./wallet-wasm");
|
|
5
14
|
const events_1 = require("events");
|
|
6
|
-
const wallet_1 = require("@docknetwork/wallet-sdk-wasm/
|
|
7
|
-
const helpers_1 = require("@docknetwork/wallet-sdk-data-store/
|
|
15
|
+
const wallet_1 = require("@docknetwork/wallet-sdk-wasm/src/services/wallet");
|
|
16
|
+
const helpers_1 = require("@docknetwork/wallet-sdk-data-store/src/helpers");
|
|
8
17
|
const did_provider_1 = require("./did-provider");
|
|
9
18
|
function once(emitter, eventName) {
|
|
10
19
|
return new Promise(resolve => emitter.once(eventName, resolve));
|
|
11
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Ensures a document has the proper @context for Universal Wallet compatibility
|
|
23
|
+
* @param {Object} document - The document to add context to
|
|
24
|
+
* @returns {Object} The document with @context added if it was missing
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
12
27
|
function ensureDocumentContext(document) {
|
|
13
28
|
if (document['@context']) {
|
|
14
29
|
return document;
|
|
@@ -18,26 +33,27 @@ function ensureDocumentContext(document) {
|
|
|
18
33
|
'@context': ['https://w3id.org/wallet/v1'],
|
|
19
34
|
};
|
|
20
35
|
}
|
|
21
|
-
exports.ensureDocumentContext = ensureDocumentContext;
|
|
22
|
-
exports.WalletEvents = {
|
|
23
|
-
ready: 'ready',
|
|
24
|
-
error: 'error',
|
|
25
|
-
migrated: 'migrated',
|
|
26
|
-
statusUpdated: 'status-updated',
|
|
27
|
-
documentAdded: 'document-added',
|
|
28
|
-
documentUpdated: 'document-updated',
|
|
29
|
-
documentRemoved: 'document-removed',
|
|
30
|
-
walletDeleted: 'wallet-deleted',
|
|
31
|
-
walletImported: 'wallet-imported',
|
|
32
|
-
networkUpdated: 'network-updated',
|
|
33
|
-
networkConnected: 'network-connected',
|
|
34
|
-
networkError: 'network-error',
|
|
35
|
-
};
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Creates a new wallet instance with the provided data store.
|
|
38
|
+
* The wallet provides secure storage and management of DIDs, credentials, keys, and other documents.
|
|
39
|
+
*
|
|
40
|
+
* @param {CreateWalletProps} props - Configuration options for wallet creation
|
|
41
|
+
* @param {DataStore} props.dataStore - The data store implementation to use for persistence
|
|
42
|
+
* @returns {Promise<IWallet>} A promise that resolves to the created wallet instance
|
|
43
|
+
* @see {@link IWallet} - The interface defining all available wallet methods
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* import { createWallet } from '@docknetwork/wallet-sdk-core';
|
|
47
|
+
* import { createDataStore } from '@docknetwork/wallet-sdk-data-store';
|
|
38
48
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
49
|
+
* const dataStore = await createDataStore();
|
|
50
|
+
* const wallet = await createWallet({ dataStore });
|
|
51
|
+
*
|
|
52
|
+
* // The wallet implements the IWallet interface
|
|
53
|
+
* await wallet.addDocument(myCredential);
|
|
54
|
+
* const documents = await wallet.getAllDocuments();
|
|
55
|
+
*
|
|
56
|
+
* @throws {Error} If the data store is not properly initialized
|
|
41
57
|
*/
|
|
42
58
|
async function createWallet({ dataStore, }) {
|
|
43
59
|
let status;
|
|
@@ -55,57 +71,169 @@ async function createWallet({ dataStore, }) {
|
|
|
55
71
|
dataStore,
|
|
56
72
|
});
|
|
57
73
|
},
|
|
74
|
+
/**
|
|
75
|
+
* Deletes the entire wallet and all its documents
|
|
76
|
+
* @memberof IWallet
|
|
77
|
+
* @returns {Promise<void>}
|
|
78
|
+
* @fires WalletEvents.walletDeleted
|
|
79
|
+
*/
|
|
58
80
|
deleteWallet: async () => {
|
|
59
81
|
await dataStore.documents.removeAllDocuments();
|
|
60
|
-
eventEmitter.emit(
|
|
82
|
+
eventEmitter.emit(types_1.WalletEvents.walletDeleted);
|
|
61
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* Sets the wallet status
|
|
86
|
+
* @memberof IWallet
|
|
87
|
+
* @param {string} newStatus - The new status to set
|
|
88
|
+
*/
|
|
62
89
|
setStatus(newStatus) {
|
|
63
90
|
status = newStatus;
|
|
64
91
|
},
|
|
92
|
+
/**
|
|
93
|
+
* Sets the active network for the wallet
|
|
94
|
+
* @memberof IWallet
|
|
95
|
+
* @param {string} networkId - The network identifier to switch to
|
|
96
|
+
* @returns {Promise<void>}
|
|
97
|
+
* @fires WalletEvents.networkUpdated
|
|
98
|
+
*/
|
|
65
99
|
setNetwork: async (networkId) => {
|
|
66
100
|
await dataStore.setNetwork(networkId);
|
|
67
|
-
eventEmitter.emit(
|
|
101
|
+
eventEmitter.emit(types_1.WalletEvents.networkUpdated, networkId);
|
|
68
102
|
},
|
|
103
|
+
/**
|
|
104
|
+
* Gets the current network ID
|
|
105
|
+
* @memberof IWallet
|
|
106
|
+
* @returns {string} The current network identifier
|
|
107
|
+
*/
|
|
69
108
|
getNetworkId: () => {
|
|
70
109
|
return dataStore.networkId;
|
|
71
110
|
},
|
|
111
|
+
/**
|
|
112
|
+
* Retrieves a document by its ID
|
|
113
|
+
* @memberof IWallet
|
|
114
|
+
* @param {string} id - The unique identifier of the document
|
|
115
|
+
* @returns {Promise<WalletDocument>} The document with the specified ID
|
|
116
|
+
* @throws {Error} If document is not found
|
|
117
|
+
*/
|
|
72
118
|
getDocumentById: (id) => dataStore.documents.getDocumentById(id),
|
|
119
|
+
/**
|
|
120
|
+
* Retrieves all documents stored in the wallet
|
|
121
|
+
* @memberof IWallet
|
|
122
|
+
* @returns {Promise<WalletDocument[]>} Array of all documents in the wallet
|
|
123
|
+
*/
|
|
73
124
|
getAllDocuments: () => dataStore.documents.getAllDocuments(),
|
|
125
|
+
/**
|
|
126
|
+
* Retrieves multiple documents by their IDs
|
|
127
|
+
* @memberof IWallet
|
|
128
|
+
* @param {string[]} idList - Array of document IDs to retrieve
|
|
129
|
+
* @returns {Promise<WalletDocument[]>} Array of documents matching the provided IDs
|
|
130
|
+
*/
|
|
74
131
|
getDocumentsById: (idList) => dataStore.documents.getDocumentsById(idList),
|
|
132
|
+
/**
|
|
133
|
+
* Retrieves all documents of a specific type
|
|
134
|
+
* @memberof IWallet
|
|
135
|
+
* @param {string} type - The document type to filter by (e.g., 'VerifiableCredential', 'DIDDocument')
|
|
136
|
+
* @returns {Promise<WalletDocument[]>} Array of documents matching the specified type
|
|
137
|
+
*/
|
|
75
138
|
getDocumentsByType: (type) => dataStore.documents.getDocumentsByType(type),
|
|
139
|
+
/**
|
|
140
|
+
* Adds a new document to the wallet
|
|
141
|
+
* @memberof IWallet
|
|
142
|
+
* @param {any} json - The document to add (must have valid JSON-LD structure)
|
|
143
|
+
* @param {any} [options] - Optional parameters for document creation
|
|
144
|
+
* @returns {Promise<WalletDocument>} The created document with generated metadata
|
|
145
|
+
* @fires WalletEvents.documentAdded
|
|
146
|
+
* @example
|
|
147
|
+
* const credential = {
|
|
148
|
+
* "@context": ["https://www.w3.org/2018/credentials/v1"],
|
|
149
|
+
* "type": ["VerifiableCredential"],
|
|
150
|
+
* "issuer": "did:dock:123",
|
|
151
|
+
* "credentialSubject": { "name": "John Doe" }
|
|
152
|
+
* };
|
|
153
|
+
* const addedDoc = await wallet.addDocument(credential);
|
|
154
|
+
*/
|
|
76
155
|
addDocument: (json) => {
|
|
77
156
|
return dataStore.documents.addDocument(json).then(result => {
|
|
78
|
-
eventEmitter.emit(
|
|
157
|
+
eventEmitter.emit(types_1.WalletEvents.documentAdded, result);
|
|
79
158
|
return result;
|
|
80
159
|
});
|
|
81
160
|
},
|
|
161
|
+
/**
|
|
162
|
+
* Updates an existing document
|
|
163
|
+
* @memberof IWallet
|
|
164
|
+
* @param {any} document - The document with updated data (must include ID)
|
|
165
|
+
* @param {any} [options] - Optional parameters for document update
|
|
166
|
+
* @returns {Promise<WalletDocument>} The updated document
|
|
167
|
+
* @fires WalletEvents.documentUpdated
|
|
168
|
+
* @throws {Error} If document doesn't exist
|
|
169
|
+
*/
|
|
82
170
|
updateDocument: (document) => {
|
|
83
171
|
return dataStore.documents.updateDocument(document).then(result => {
|
|
84
|
-
eventEmitter.emit(
|
|
172
|
+
eventEmitter.emit(types_1.WalletEvents.documentUpdated, result);
|
|
85
173
|
return result;
|
|
86
174
|
});
|
|
87
175
|
},
|
|
176
|
+
/**
|
|
177
|
+
* Removes a document from the wallet
|
|
178
|
+
* @memberof IWallet
|
|
179
|
+
* @param {string} id - The ID of the document to remove
|
|
180
|
+
* @param {any} [options] - Optional parameters for document removal
|
|
181
|
+
* @returns {Promise<void>}
|
|
182
|
+
* @fires WalletEvents.documentRemoved
|
|
183
|
+
* @throws {Error} If document is not found
|
|
184
|
+
*/
|
|
88
185
|
removeDocument: async (id) => {
|
|
89
186
|
const document = await wallet.getDocumentById(id);
|
|
90
187
|
return dataStore.documents.removeDocument(id).then(result => {
|
|
91
|
-
eventEmitter.emit(
|
|
188
|
+
eventEmitter.emit(types_1.WalletEvents.documentRemoved, document);
|
|
92
189
|
return result;
|
|
93
190
|
});
|
|
94
191
|
},
|
|
192
|
+
/**
|
|
193
|
+
* Gets all documents correlated to a specific document
|
|
194
|
+
* @memberof IWallet
|
|
195
|
+
* @param {string} documentId - The ID of the document to find correlations for
|
|
196
|
+
* @returns {Promise<WalletDocument[]>} Array of correlated documents
|
|
197
|
+
*/
|
|
95
198
|
getDocumentCorrelations: (documentId) => {
|
|
96
199
|
return dataStore.documents.getDocumentCorrelations(documentId);
|
|
97
200
|
},
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves the keypair associated with an account
|
|
203
|
+
* @memberof IWallet
|
|
204
|
+
* @param {string} accountId - The account ID to get the keypair for
|
|
205
|
+
* @returns {Promise<any>} The keypair associated with the account
|
|
206
|
+
*/
|
|
98
207
|
getAccountKeyPair: async (accountId) => {
|
|
99
208
|
const correlations = await dataStore.documents.getDocumentCorrelations(accountId);
|
|
100
209
|
const keyPair = correlations.find(correlation => correlation.type === 'KeyringPair');
|
|
101
210
|
return keyPair?.value;
|
|
102
211
|
},
|
|
212
|
+
/**
|
|
213
|
+
* Decrypts and retrieves documents from an encrypted wallet without importing
|
|
214
|
+
* @memberof IWallet
|
|
215
|
+
* @param {any} json - The encrypted wallet JSON
|
|
216
|
+
* @param {string} password - Password to decrypt the wallet
|
|
217
|
+
* @returns {Promise<any>} Array of decrypted documents
|
|
218
|
+
*/
|
|
103
219
|
getDocumentsFromEncryptedWallet: async (json, password) => {
|
|
104
220
|
return wallet_1.walletService.getDocumentsFromEncryptedWallet({
|
|
105
221
|
encryptedJSONWallet: json,
|
|
106
222
|
password,
|
|
107
223
|
});
|
|
108
224
|
},
|
|
225
|
+
/**
|
|
226
|
+
* Imports documents from an encrypted Universal Wallet 2020 JSON
|
|
227
|
+
* @memberof IWallet
|
|
228
|
+
* @param {any} json - The encrypted wallet JSON
|
|
229
|
+
* @param {string} password - Password to decrypt the wallet
|
|
230
|
+
* @returns {Promise<void>}
|
|
231
|
+
* @see {@link https://w3c-ccg.github.io/universal-wallet-interop-spec/}
|
|
232
|
+
* @example
|
|
233
|
+
* // Import from encrypted wallet backup
|
|
234
|
+
* const walletBackup = { ... }; // encrypted wallet JSON
|
|
235
|
+
* await wallet.importUniversalWalletJSON(walletBackup, 'mypassword');
|
|
236
|
+
*/
|
|
109
237
|
importUniversalWalletJSON: async (json, password) => {
|
|
110
238
|
const documents = await wallet_1.walletService.getDocumentsFromEncryptedWallet({
|
|
111
239
|
encryptedJSONWallet: json,
|
|
@@ -117,6 +245,14 @@ async function createWallet({ dataStore, }) {
|
|
|
117
245
|
});
|
|
118
246
|
return documents;
|
|
119
247
|
},
|
|
248
|
+
/**
|
|
249
|
+
* Exports specified documents as an encrypted JSON (test)
|
|
250
|
+
* @memberof IWallet
|
|
251
|
+
* @param {Object} params - Export parameters
|
|
252
|
+
* @param {any[]} params.documents - Documents to export
|
|
253
|
+
* @param {string} params.password - Password for encryption
|
|
254
|
+
* @returns {Promise<any>} Encrypted wallet JSON
|
|
255
|
+
*/
|
|
120
256
|
exportDocuments: async (params) => {
|
|
121
257
|
const documents = params.documents.map(ensureDocumentContext);
|
|
122
258
|
return wallet_1.walletService.exportDocuments({
|
|
@@ -124,6 +260,17 @@ async function createWallet({ dataStore, }) {
|
|
|
124
260
|
password: params.password,
|
|
125
261
|
});
|
|
126
262
|
},
|
|
263
|
+
/**
|
|
264
|
+
* Exports the entire wallet as an encrypted Universal Wallet 2020 JSON
|
|
265
|
+
* @memberof IWallet
|
|
266
|
+
* @param {string} password - Password for encryption
|
|
267
|
+
* @returns {any} Encrypted Universal Wallet JSON representation
|
|
268
|
+
* @see {@link https://w3c-ccg.github.io/universal-wallet-interop-spec/}
|
|
269
|
+
* @example
|
|
270
|
+
* // Create encrypted backup of entire wallet
|
|
271
|
+
* const backup = await wallet.exportUniversalWalletJSON('mypassword');
|
|
272
|
+
* // Save backup to file or cloud storage
|
|
273
|
+
*/
|
|
127
274
|
exportUniversalWalletJSON: async (password) => {
|
|
128
275
|
let documents = await dataStore.documents.getAllDocuments(true);
|
|
129
276
|
const result = await wallet.exportDocuments({
|
|
@@ -137,12 +284,11 @@ async function createWallet({ dataStore, }) {
|
|
|
137
284
|
await (0, did_provider_1.ensureDID)({
|
|
138
285
|
wallet,
|
|
139
286
|
});
|
|
140
|
-
[
|
|
287
|
+
[types_1.WalletEvents.networkUpdated, types_1.WalletEvents.walletDeleted].forEach(event => eventEmitter.on(event, () => {
|
|
141
288
|
(0, did_provider_1.ensureDID)({
|
|
142
289
|
wallet,
|
|
143
290
|
});
|
|
144
291
|
}));
|
|
145
292
|
return wallet;
|
|
146
293
|
}
|
|
147
|
-
exports.createWallet = createWallet;
|
|
148
294
|
//# sourceMappingURL=wallet.js.map
|
package/lib/wallet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AA6BH,sDASC;AAyBD,oCA+PC;AA5TD,mCAAiE;AAkB/D,6FAlBkC,oBAAY,OAkBlC;AAfd,+CAA6C;AAC7C,mCAAoC;AACpC,6EAA+E;AAC/E,4EAA8F;AAC9F,iDAAyC;AAGzC,SAAS,IAAI,CAAC,OAAqB,EAAE,SAAiB;IACpD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAClE,CAAC;AASD;;;;;GAKG;AACH,SAAgB,qBAAqB,CAAC,QAAQ;IAC5C,IAAI,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,OAAO;QACL,GAAG,QAAQ;QACX,UAAU,EAAE,CAAC,4BAA4B,CAAC;KAC3C,CAAC;AACJ,CAAC;AAGD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACI,KAAK,UAAU,YAAY,CAAC,EACjC,SAAS,GACS;IAClB,I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,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YAEhE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC;gBAC1C,SAAS;gBACT,QAAQ;aACT,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC;KACS,CAAC;IAEb,MAAM,IAAA,4BAAc,EAAC,MAAM,CAAC,CAAC;IAE7B,MAAM,IAAA,wBAAS,EAAC;QACd,MAAM;KACP,CAAC,CAAC;IAEH,CAAC,oBAAY,CAAC,cAAc,EAAE,oBAAY,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CACxE,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;QAC1B,IAAA,wBAAS,EAAC;YACR,MAAM;SACP,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,35 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docknetwork/wallet-sdk-core",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"license": "https://github.com/docknetwork/
|
|
3
|
+
"version": "1.7.0",
|
|
4
|
+
"license": "https://github.com/docknetwork/wallet-sdk/LICENSE",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/docknetwork/
|
|
7
|
+
"url": "https://github.com/docknetwork/wallet-sdk",
|
|
8
8
|
"directory": "packages/core"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"test": "jest",
|
|
12
12
|
"prepublishOnly": "npm run build",
|
|
13
|
-
"build": "rm -rf lib && rm -rf tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && node ../../scripts/fix-build-imports.js ./lib"
|
|
13
|
+
"build": "rm -rf lib && rm -rf tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json && node ../../scripts/fix-build-imports.js ./lib",
|
|
14
|
+
"docs": "node generate-docs.js",
|
|
15
|
+
"docs:clean": "rm -rf ../../jsdocs/core.md ../../jsdocs/core/",
|
|
16
|
+
"docs:build": "npm run docs:clean && npm run docs"
|
|
14
17
|
},
|
|
15
18
|
"peerDependencies": {
|
|
16
|
-
"
|
|
19
|
+
"@docknetwork/wallet-sdk-data-store": "^1.5.14",
|
|
17
20
|
"reflect-metadata": "^0.1.13",
|
|
18
21
|
"sqlite3": "^5.0.2",
|
|
19
|
-
"
|
|
22
|
+
"typeorm": "^0.3.15"
|
|
20
23
|
},
|
|
21
24
|
"dependencies": {
|
|
22
25
|
"@docknetwork/wallet-sdk-wasm": "^1.5.14",
|
|
23
26
|
"futoin-hkdf": "^1.5.3"
|
|
24
27
|
},
|
|
25
28
|
"devDependencies": {
|
|
29
|
+
"@babel/parser": "^7.28.4",
|
|
30
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
26
31
|
"@docknetwork/wallet-sdk-data-store": "^1.5.14",
|
|
32
|
+
"better-docs": "^2.7.3",
|
|
27
33
|
"jest": "29.1.0",
|
|
34
|
+
"jsdoc": "^4.0.2",
|
|
35
|
+
"jsdoc-babel": "^0.5.0",
|
|
36
|
+
"reflect-metadata": "^0.1.13",
|
|
37
|
+
"sqlite3": "^5.0.2",
|
|
28
38
|
"ts-jest": "29.1.0",
|
|
29
39
|
"ts-node": "^10.9.1",
|
|
30
|
-
"typescript": "^5.0.4",
|
|
31
40
|
"typeorm": "^0.3.15",
|
|
32
|
-
"
|
|
33
|
-
"reflect-metadata": "^0.1.13"
|
|
41
|
+
"typescript": "^5.9.2"
|
|
34
42
|
}
|
|
35
43
|
}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module biometric-provider
|
|
3
|
+
* @description Biometric plugin for the Truvera Wallet SDK.
|
|
4
|
+
* This module provides functions for biometric enrollment, matching, and identity verification processes.
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import {WalletDocument} from '@docknetwork/wallet-sdk-wasm/src/types';
|
|
2
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
IWallet,
|
|
10
|
+
BiometricsProviderConfigs,
|
|
11
|
+
IDVProcessOptions,
|
|
12
|
+
BiometricPlugin,
|
|
13
|
+
IDVProvider,
|
|
14
|
+
IDVProviderFactory,
|
|
15
|
+
IBiometricProvider,
|
|
16
|
+
} from './types';
|
|
17
|
+
export type {
|
|
18
|
+
BiometricsProviderConfigs,
|
|
19
|
+
IDVProcessOptions,
|
|
20
|
+
BiometricPlugin,
|
|
21
|
+
IDVProvider,
|
|
22
|
+
IDVProviderFactory,
|
|
23
|
+
IBiometricProvider,
|
|
24
|
+
};
|
|
3
25
|
import {
|
|
4
26
|
createCredentialProvider,
|
|
5
27
|
Credential,
|
|
@@ -9,49 +31,107 @@ import assert from 'assert';
|
|
|
9
31
|
import {EventEmitter} from 'events';
|
|
10
32
|
import {createDIDProvider} from './did-provider';
|
|
11
33
|
|
|
12
|
-
export type BiometricsProviderConfigs<E> = {
|
|
13
|
-
// Generic configs used by the biometric provider
|
|
14
|
-
enrollmentCredentialType: string;
|
|
15
|
-
biometricMatchCredentialType: string;
|
|
16
|
-
// IDV specific configs, it depends on the IDV provider and its implementation
|
|
17
|
-
idvConfigs: E;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export interface IDVProcessOptions {
|
|
21
|
-
onDeepLink?: () => void;
|
|
22
|
-
onMessage?: () => void;
|
|
23
|
-
onError?: (error: Error) => void;
|
|
24
|
-
onCancel?: () => void;
|
|
25
|
-
onComplete?: (credential: any) => void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface BiometricPlugin {
|
|
29
|
-
onEnroll(walletDID: string): Promise<WalletDocument>;
|
|
30
|
-
onMatch(
|
|
31
|
-
walletDID: string,
|
|
32
|
-
enrollmentCredential: Credential,
|
|
33
|
-
): Promise<WalletDocument>;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
34
|
let currentConfigs: BiometricsProviderConfigs<unknown> = null;
|
|
37
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Sets the global biometric provider configurations for the SDK
|
|
38
|
+
* @param {BiometricsProviderConfigs<unknown>} configs - The biometric provider configurations to set
|
|
39
|
+
* @param {string} configs.enrollmentCredentialType - The credential type for enrollment
|
|
40
|
+
* @param {string} configs.biometricMatchCredentialType - The credential type for biometric matching
|
|
41
|
+
* @param {any} [configs.idvProvider] - Optional IDV provider configuration
|
|
42
|
+
* @example
|
|
43
|
+
* import { setConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
|
|
44
|
+
*
|
|
45
|
+
* setConfigs({
|
|
46
|
+
* enrollmentCredentialType: 'BiometricEnrollment',
|
|
47
|
+
* biometricMatchCredentialType: 'BiometricMatch',
|
|
48
|
+
* idvProvider: myIDVProviderConfig
|
|
49
|
+
* });
|
|
50
|
+
*/
|
|
38
51
|
export function setConfigs(configs: BiometricsProviderConfigs<unknown>) {
|
|
39
52
|
currentConfigs = configs;
|
|
40
53
|
}
|
|
41
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the biometric plugin is enabled by verifying if biometric match credential type is configured
|
|
57
|
+
* @returns {boolean} True if biometric match credential type is configured, false otherwise
|
|
58
|
+
* @example
|
|
59
|
+
* import { isBiometricPluginEnabled, setConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
|
|
60
|
+
*
|
|
61
|
+
* // Before configuration
|
|
62
|
+
* console.log(isBiometricPluginEnabled()); // false
|
|
63
|
+
*
|
|
64
|
+
* // After configuration
|
|
65
|
+
* setConfigs({
|
|
66
|
+
* enrollmentCredentialType: 'BiometricEnrollment',
|
|
67
|
+
* biometricMatchCredentialType: 'BiometricMatch'
|
|
68
|
+
* });
|
|
69
|
+
* console.log(isBiometricPluginEnabled()); // true
|
|
70
|
+
*/
|
|
42
71
|
export function isBiometricPluginEnabled() {
|
|
43
72
|
return !!currentConfigs?.biometricMatchCredentialType;
|
|
44
73
|
}
|
|
45
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Asserts that biometric provider configurations are available
|
|
77
|
+
* @throws {Error} If biometric provider configs are not set
|
|
78
|
+
* @example
|
|
79
|
+
* import { assertConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
|
|
80
|
+
*
|
|
81
|
+
* try {
|
|
82
|
+
* assertConfigs();
|
|
83
|
+
* console.log('Biometric configs are available');
|
|
84
|
+
* } catch (error) {
|
|
85
|
+
* console.error('Biometric configs missing:', error.message);
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
46
88
|
export function assertConfigs() {
|
|
47
89
|
assert(!!currentConfigs, 'Missing biometric provider configs');
|
|
48
90
|
}
|
|
49
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Gets the current biometric provider configurations
|
|
94
|
+
* @returns {BiometricsProviderConfigs<unknown>} The current biometric provider configurations
|
|
95
|
+
* @throws {Error} If biometric provider configs are not set
|
|
96
|
+
* @example
|
|
97
|
+
* import { getBiometricConfigs } from '@docknetwork/wallet-sdk-core/biometric-provider';
|
|
98
|
+
*
|
|
99
|
+
* try {
|
|
100
|
+
* const configs = getBiometricConfigs();
|
|
101
|
+
* console.log('Enrollment credential type:', configs.enrollmentCredentialType);
|
|
102
|
+
* console.log('Match credential type:', configs.biometricMatchCredentialType);
|
|
103
|
+
* } catch (error) {
|
|
104
|
+
* console.error('Failed to get configs:', error.message);
|
|
105
|
+
* }
|
|
106
|
+
*/
|
|
50
107
|
export function getBiometricConfigs() {
|
|
51
108
|
assertConfigs();
|
|
52
109
|
return currentConfigs;
|
|
53
110
|
}
|
|
54
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Checks if a proof request requires biometric credentials
|
|
114
|
+
* @param {any} proofRequest - The proof request to analyze
|
|
115
|
+
* @returns {boolean} True if the proof request requires biometric credentials
|
|
116
|
+
* @example
|
|
117
|
+
* import { hasProofOfBiometrics } from '@docknetwork/wallet-sdk-core/biometric-provider';
|
|
118
|
+
*
|
|
119
|
+
* const proofRequest = {
|
|
120
|
+
* input_descriptors: [{
|
|
121
|
+
* constraints: {
|
|
122
|
+
* fields: [{
|
|
123
|
+
* path: ['$.credentialSubject.biometric.id']
|
|
124
|
+
* }, {
|
|
125
|
+
* path: ['$.credentialSubject.biometric.created']
|
|
126
|
+
* }]
|
|
127
|
+
* }
|
|
128
|
+
* }]
|
|
129
|
+
* };
|
|
130
|
+
*
|
|
131
|
+
* if (hasProofOfBiometrics(proofRequest)) {
|
|
132
|
+
* console.log('This proof request requires biometric verification');
|
|
133
|
+
* }
|
|
134
|
+
*/
|
|
55
135
|
export function hasProofOfBiometrics(proofRequest) {
|
|
56
136
|
const fields = proofRequest.input_descriptors
|
|
57
137
|
?.map(input => input.constraints?.fields)
|
|
@@ -72,24 +152,33 @@ export const IDV_EVENTS = {
|
|
|
72
152
|
onComplete: 'onComplete',
|
|
73
153
|
};
|
|
74
154
|
|
|
75
|
-
export interface IDVProvider {
|
|
76
|
-
enroll(
|
|
77
|
-
walletDID: string,
|
|
78
|
-
proofRequest: any,
|
|
79
|
-
): Promise<{enrollmentCredential: Credential; matchCredential: Credential}>;
|
|
80
|
-
match(
|
|
81
|
-
walletDID: string,
|
|
82
|
-
enrollmentCredential: Credential,
|
|
83
|
-
proofRequest: any,
|
|
84
|
-
): Promise<{
|
|
85
|
-
matchCredential: Credential;
|
|
86
|
-
}>;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface IDVProviderFactory {
|
|
90
|
-
create(eventEmitter: EventEmitter, wallet: IWallet): IDVProvider;
|
|
91
|
-
}
|
|
92
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Creates a biometric provider instance for identity verification and biometric credential management
|
|
158
|
+
* @param {Object} params - Provider configuration
|
|
159
|
+
* @param {IWallet} params.wallet - The wallet instance to use for credential storage
|
|
160
|
+
* @param {IDVProviderFactory} params.idvProviderFactory - Factory for creating IDV provider instances
|
|
161
|
+
* @returns {IBiometricProvider} A biometric provider instance with identity verification methods
|
|
162
|
+
* @throws {Error} If wallet or idvProviderFactory is not provided
|
|
163
|
+
* @see {@link IBiometricProvider} - The interface defining all available biometric provider methods
|
|
164
|
+
* @example
|
|
165
|
+
* import { createBiometricProvider } from '@docknetwork/wallet-sdk-core';
|
|
166
|
+
*
|
|
167
|
+
* const biometricProvider = createBiometricProvider({
|
|
168
|
+
* wallet,
|
|
169
|
+
* idvProviderFactory: myIDVFactory
|
|
170
|
+
* });
|
|
171
|
+
*
|
|
172
|
+
* // Start identity verification process
|
|
173
|
+
* const result = await biometricProvider.startIDV(proofRequest);
|
|
174
|
+
* console.log('Enrollment credential:', result.enrollmentCredential);
|
|
175
|
+
* console.log('Match credential:', result.matchCredential);
|
|
176
|
+
*
|
|
177
|
+
* // Listen for IDV events
|
|
178
|
+
* biometricProvider.eventEmitter.on('onComplete', (data) => {
|
|
179
|
+
* console.log('IDV process completed:', data);
|
|
180
|
+
* });
|
|
181
|
+
*/
|
|
93
182
|
export function createBiometricProvider({
|
|
94
183
|
wallet,
|
|
95
184
|
idvProviderFactory,
|
|
@@ -103,6 +192,24 @@ export function createBiometricProvider({
|
|
|
103
192
|
const idvProvider = idvProviderFactory.create(eventEmitter, wallet);
|
|
104
193
|
|
|
105
194
|
|
|
195
|
+
/**
|
|
196
|
+
* Starts the identity verification process using biometric credentials
|
|
197
|
+
* @memberof IBiometricProvider
|
|
198
|
+
* @param {any} proofRequest - The proof request containing biometric requirements
|
|
199
|
+
* @returns {Promise<{enrollmentCredential: Credential, matchCredential: Credential}>} The enrollment and match credentials
|
|
200
|
+
* @throws {Error} If IDV process fails or biometric configs are missing
|
|
201
|
+
* @example
|
|
202
|
+
* const result = await biometricProvider.startIDV({
|
|
203
|
+
* input_descriptors: [{
|
|
204
|
+
* constraints: {
|
|
205
|
+
* fields: [{
|
|
206
|
+
* path: ['$.credentialSubject.biometric.id'],
|
|
207
|
+
* purpose: 'Biometric ID verification'
|
|
208
|
+
* }]
|
|
209
|
+
* }
|
|
210
|
+
* }]
|
|
211
|
+
* });
|
|
212
|
+
*/
|
|
106
213
|
async function startIDV(proofRequest: any): Promise<{
|
|
107
214
|
enrollmentCredential: Credential;
|
|
108
215
|
matchCredential: Credential;
|
|
@@ -167,7 +274,15 @@ export function createBiometricProvider({
|
|
|
167
274
|
}
|
|
168
275
|
|
|
169
276
|
return {
|
|
277
|
+
/**
|
|
278
|
+
* Starts the identity verification process using biometric credentials
|
|
279
|
+
* @memberof IBiometricProvider
|
|
280
|
+
*/
|
|
170
281
|
startIDV,
|
|
282
|
+
/**
|
|
283
|
+
* Event emitter for IDV process events (onDeepLink, onMessage, onError, onCancel, onComplete)
|
|
284
|
+
* @memberof IBiometricProvider
|
|
285
|
+
*/
|
|
171
286
|
eventEmitter,
|
|
172
287
|
};
|
|
173
288
|
}
|
package/src/cloud-wallet.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module cloud-wallet
|
|
3
|
+
* @description Cloud wallet functionality for the Truvera Wallet SDK.
|
|
4
|
+
* This module provides the main cloud wallet creation and management functions.
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import {
|
|
2
8
|
DataStore,
|
|
3
9
|
DataStoreEvents,
|
|
@@ -227,6 +233,13 @@ export async function getKeyMappingMasterKey(
|
|
|
227
233
|
equals: {
|
|
228
234
|
'content.id': identifier
|
|
229
235
|
}
|
|
236
|
+
}).catch(error => {
|
|
237
|
+
if (error.message && error.message.includes('does not exist')) {
|
|
238
|
+
logger.error('KeyMappingVault does not exist, skipping find');
|
|
239
|
+
return { documents: [] };
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
throw error;
|
|
230
243
|
});
|
|
231
244
|
|
|
232
245
|
if (!result.documents || result.documents.length === 0) {
|