@verii/metadata-registration 1.1.0-pre.1765263305 → 1.1.0-pre.1765354771
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/package.json +10 -10
- package/src/metadata-registry.js +14 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/metadata-registration",
|
|
3
|
-
"version": "1.1.0-pre.
|
|
3
|
+
"version": "1.1.0-pre.1765354771",
|
|
4
4
|
"description": "Package allows interacting with the smart contracts, based on ethers.js",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"lint:fix": "eslint --fix --ext .js ."
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@verii/base-contract-io": "1.1.0-pre.
|
|
21
|
-
"@verii/blockchain-functions": "1.1.0-pre.
|
|
22
|
-
"@verii/common-functions": "1.1.0-pre.
|
|
23
|
-
"@verii/contract-permissions": "1.1.0-pre.
|
|
24
|
-
"@verii/cose-key": "1.1.0-pre.
|
|
25
|
-
"@verii/crypto": "1.1.0-pre.
|
|
26
|
-
"@verii/jwt": "1.1.0-pre.
|
|
20
|
+
"@verii/base-contract-io": "1.1.0-pre.1765354771",
|
|
21
|
+
"@verii/blockchain-functions": "1.1.0-pre.1765354771",
|
|
22
|
+
"@verii/common-functions": "1.1.0-pre.1765354771",
|
|
23
|
+
"@verii/contract-permissions": "1.1.0-pre.1765354771",
|
|
24
|
+
"@verii/cose-key": "1.1.0-pre.1765354771",
|
|
25
|
+
"@verii/crypto": "1.1.0-pre.1765354771",
|
|
26
|
+
"@verii/jwt": "1.1.0-pre.1765354771",
|
|
27
27
|
"eth-url-parser": "1.0.4",
|
|
28
28
|
"lodash": "4.17.21"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@spencejs/spence-config": "0.10.2",
|
|
32
|
-
"@verii/tests-helpers": "1.1.0-pre.
|
|
32
|
+
"@verii/tests-helpers": "1.1.0-pre.1765354771",
|
|
33
33
|
"date-fns": "4.1.0",
|
|
34
34
|
"expect": "30.2.0",
|
|
35
35
|
"nanoid": "5.1.6"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"lib"
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "95b0dfb9c8d00b85e3c0ca240ea38048505a8681"
|
|
43
43
|
}
|
package/src/metadata-registry.js
CHANGED
|
@@ -245,8 +245,7 @@ const initMetadataRegistry = async (
|
|
|
245
245
|
|
|
246
246
|
const multiToken = ':multi:';
|
|
247
247
|
if (did.indexOf(multiToken) === -1) {
|
|
248
|
-
|
|
249
|
-
return [{ accountId, listId, index, contentHash }];
|
|
248
|
+
return [parseSingleVelocityDid(did)];
|
|
250
249
|
}
|
|
251
250
|
|
|
252
251
|
const [, entriesPart] = did.split(multiToken);
|
|
@@ -255,6 +254,10 @@ const initMetadataRegistry = async (
|
|
|
255
254
|
return { accountId, listId, index, contentHash };
|
|
256
255
|
}, entriesPart.split(';'));
|
|
257
256
|
};
|
|
257
|
+
const parseSingleVelocityDid = (did) => {
|
|
258
|
+
const [, , , accountId, listId, index, contentHash] = did.split(':');
|
|
259
|
+
return { accountId, listId, index, contentHash };
|
|
260
|
+
};
|
|
258
261
|
|
|
259
262
|
const resolvePublicKey = async ({ id, entry, secret }) => {
|
|
260
263
|
log.info({ id, entry, secret }, 'resolvePublicKey');
|
|
@@ -367,8 +370,14 @@ const initMetadataRegistry = async (
|
|
|
367
370
|
|
|
368
371
|
const credentialEntries = await Promise.all(
|
|
369
372
|
mapWithIndex(async (entry, i) => {
|
|
370
|
-
const
|
|
371
|
-
|
|
373
|
+
const credential = find((c) => {
|
|
374
|
+
const credentialIndexEntry = parseSingleVelocityDid(c.id);
|
|
375
|
+
return (
|
|
376
|
+
credentialIndexEntry.accountId === indexEntries[i].accountId &&
|
|
377
|
+
credentialIndexEntry.listId === indexEntries[i].listId &&
|
|
378
|
+
credentialIndexEntry.index === indexEntries[i].index
|
|
379
|
+
);
|
|
380
|
+
}, credentials);
|
|
372
381
|
const secret =
|
|
373
382
|
indexEntries[i].contentHash != null
|
|
374
383
|
? await deriveEncryptionSecretFromPassword(
|
|
@@ -377,7 +386,7 @@ const initMetadataRegistry = async (
|
|
|
377
386
|
: await deriveEncryptionSecret(credential);
|
|
378
387
|
return {
|
|
379
388
|
entry,
|
|
380
|
-
id,
|
|
389
|
+
id: credential.id,
|
|
381
390
|
credentialType: credential.credentialType,
|
|
382
391
|
secret,
|
|
383
392
|
};
|
|
@@ -447,14 +456,6 @@ const initMetadataRegistry = async (
|
|
|
447
456
|
return tx.wait();
|
|
448
457
|
};
|
|
449
458
|
|
|
450
|
-
const toDID = ({ accountId, listId, index, contentHash }) => {
|
|
451
|
-
if (contentHash != null) {
|
|
452
|
-
return `did:velocity:v2:${accountId}:${listId}:${index}:${contentHash}`;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return `did:velocity:v2:${accountId}:${listId}:${index}`;
|
|
456
|
-
};
|
|
457
|
-
|
|
458
459
|
const pullCreatedMetadataListEvents = pullEvents('CreatedMetadataList');
|
|
459
460
|
|
|
460
461
|
const pullAddedCredentialMetadataEvents = pullEvents(
|