@cooperation/vc-storage 1.0.12 → 1.0.13
Sign up to get free protection for your applications and to get access to all the features.
@@ -87,17 +87,12 @@ export class CredentialEngine {
|
|
87
87
|
}
|
88
88
|
}
|
89
89
|
async findKeysAndDIDs() {
|
90
|
-
// find the DID document for the current user
|
91
90
|
const keyPairs = (await this.storage.getAllFilesByType('KEYPAIRs'));
|
92
|
-
console.log('🚀 ~ CredentialEngine ~ findDid ~ keyPairs:', keyPairs[0].data);
|
93
91
|
const DIDs = (await this.storage.getAllFilesByType('DIDs'));
|
94
|
-
console.log('🚀 ~ CredentialEngine ~ findKeysAndDIDs ~ DIDs:', DIDs);
|
95
|
-
console.log('🚀 ~ CredentialEngine ~ findKeysAndDIDs ~ DIDs:', DIDs[0]);
|
96
92
|
if (DIDs.length === 0 || keyPairs.length === 0)
|
97
93
|
return null;
|
98
94
|
const keyPair = keyPairs[0].data;
|
99
95
|
const didDocument = DIDs[0].data.didDocument;
|
100
|
-
console.log('🚀 ~ CredentialEngine ~ findKeysAndDIDs ~ didDocument:', didDocument);
|
101
96
|
return {
|
102
97
|
didDocument,
|
103
98
|
keyPair,
|
@@ -277,20 +277,24 @@ export class GoogleDriveStorage {
|
|
277
277
|
// Fetch all 'VC-timestamp' subfolders under 'VCs'
|
278
278
|
const vcSubfolders = await this.findFolders(targetFolderId);
|
279
279
|
// Retrieve all 'VC.json' files from each 'VC-timestamp' subfolder
|
280
|
-
const fileContents =
|
281
|
-
for (const folder of vcSubfolders) {
|
280
|
+
const fileContents = await Promise.all(vcSubfolders.map(async (folder) => {
|
282
281
|
const files = await this.findFilesUnderFolder(folder.id);
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
282
|
+
return Promise.all(files.map(async (file) => {
|
283
|
+
return await this.retrieve(file.id);
|
284
|
+
}));
|
285
|
+
}));
|
286
|
+
// for (const folder of vcSubfolders) {
|
287
|
+
// const files = await this.findFilesUnderFolder(folder.id);
|
288
|
+
// // Fetch the content of each file
|
289
|
+
// for (const file of files) {
|
290
|
+
// try {
|
291
|
+
// const content = await this.retrieve(file.id);
|
292
|
+
// fileContents.push(content);
|
293
|
+
// } catch (error) {
|
294
|
+
// console.error(`Error retrieving content for file ${file.id}:`, error);
|
295
|
+
// }
|
296
|
+
// }
|
297
|
+
// }
|
294
298
|
return fileContents;
|
295
299
|
}
|
296
300
|
// Step 3: Generic handling for other types
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@cooperation/vc-storage",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.0.
|
4
|
+
"version": "1.0.13",
|
5
5
|
"description": "Sign and store your verifiable credentials.",
|
6
6
|
"main": "dist/index.js",
|
7
7
|
"types": "dist/types/index.d.ts",
|
@@ -21,6 +21,7 @@
|
|
21
21
|
"@digitalbazaar/ed25519-verification-key-2020": "^4.1.0",
|
22
22
|
"@digitalbazaar/vc": "^6.3.0",
|
23
23
|
"ethers": "^6.13.2",
|
24
|
+
"ts-node": "^10.9.2",
|
24
25
|
"tsc": "^2.0.4",
|
25
26
|
"uuid": "^10.0.0"
|
26
27
|
},
|