@arcblock/vc 1.25.6 → 1.26.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/lib/index.js +26 -23
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -111,7 +111,7 @@ async function create({
|
|
|
111
111
|
throw new Error('Unsupported signer type when create verifiable credential');
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
const signature = wallet.sign(stringify(vcObj));
|
|
114
|
+
const signature = await wallet.sign(stringify(vcObj));
|
|
115
115
|
const proof = {
|
|
116
116
|
type: proofTypes[typeInfo.pk],
|
|
117
117
|
created: issuanceDate,
|
|
@@ -253,7 +253,7 @@ async function verifyPresentation({ presentation, trustedIssuers, challenge, ign
|
|
|
253
253
|
return true;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
function createCredentialList({ claims, issuer, issuanceDate }) {
|
|
256
|
+
async function createCredentialList({ claims, issuer, issuanceDate }) {
|
|
257
257
|
if (!claims || !Array.isArray(claims)) {
|
|
258
258
|
throw new Error('Can not create credential list with empty claim list');
|
|
259
259
|
}
|
|
@@ -271,27 +271,30 @@ function createCredentialList({ claims, issuer, issuanceDate }) {
|
|
|
271
271
|
|
|
272
272
|
const issued = issuanceDate || new Date().toISOString();
|
|
273
273
|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
274
|
+
const results = await Promise.all(
|
|
275
|
+
claims.map(async (x) => {
|
|
276
|
+
const vc = { claim: x };
|
|
277
|
+
|
|
278
|
+
vc.id = fromPublicKeyHash(wallet.hash(stringify(vc.claim)), vcType);
|
|
279
|
+
vc.issued = issued;
|
|
280
|
+
vc.issuer = {
|
|
281
|
+
id: issuerDid,
|
|
282
|
+
pk: toBase58(wallet.publicKey),
|
|
283
|
+
name: name || issuerDid,
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const signature = await wallet.sign(stringify(vc));
|
|
287
|
+
vc.proof = {
|
|
288
|
+
type: proofTypes[typeInfo.pk],
|
|
289
|
+
created: issued,
|
|
290
|
+
proofPurpose: 'assertionMethod',
|
|
291
|
+
jws: toBase64(signature),
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
return vc;
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
return results;
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
// eslint-disable-next-line require-await
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/vc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "Javascript lib to work with ArcBlock Verifiable Credentials",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"arcblock",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"is-absolute-url": "^3.0.3",
|
|
41
41
|
"json-stable-stringify": "^1.0.1",
|
|
42
42
|
"lodash": "^4.17.21",
|
|
43
|
-
"@arcblock/did": "1.
|
|
44
|
-
"@ocap/mcrypto": "1.
|
|
45
|
-
"@ocap/util": "1.
|
|
46
|
-
"@ocap/wallet": "1.
|
|
43
|
+
"@arcblock/did": "1.26.0",
|
|
44
|
+
"@ocap/mcrypto": "1.26.0",
|
|
45
|
+
"@ocap/util": "1.26.0",
|
|
46
|
+
"@ocap/wallet": "1.26.0"
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
49
|
"lint": "eslint tests lib",
|