@dxos/credentials 0.5.2-main.ff937a8 → 0.5.2-next.41b4fdd
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/dist/lib/browser/index.mjs +13 -4
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +13 -4
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/types/src/credentials/credential-factory.d.ts.map +1 -1
- package/dist/types/src/credentials/signing.d.ts.map +1 -1
- package/dist/types/src/presentations/signing.d.ts.map +1 -1
- package/package.json +16 -16
- package/src/credentials/credential-factory.ts +1 -4
- package/src/credentials/signing.ts +3 -0
- package/src/presentations/signing.ts +7 -1
- package/src/presentations/verifier.test.ts +46 -0
|
@@ -34,6 +34,9 @@ var getCredentialProofPayload = (credential) => {
|
|
|
34
34
|
chain: void 0
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
+
if (copy.parentCredentialIds?.length === 0) {
|
|
38
|
+
delete copy.parentCredentialIds;
|
|
39
|
+
}
|
|
37
40
|
delete copy.id;
|
|
38
41
|
return Buffer.from(canonicalStringify(copy));
|
|
39
42
|
};
|
|
@@ -84,7 +87,15 @@ var truncateKey = (key) => {
|
|
|
84
87
|
// packages/core/halo/credentials/src/presentations/signing.ts
|
|
85
88
|
var getPresentationProofPayload = (credentials, proof) => {
|
|
86
89
|
const copy = {
|
|
87
|
-
credentials
|
|
90
|
+
credentials: credentials.map((credential) => {
|
|
91
|
+
const copy2 = {
|
|
92
|
+
...credential
|
|
93
|
+
};
|
|
94
|
+
if (copy2.parentCredentialIds?.length === 0) {
|
|
95
|
+
delete copy2.parentCredentialIds;
|
|
96
|
+
}
|
|
97
|
+
return copy2;
|
|
98
|
+
}),
|
|
88
99
|
proof: {
|
|
89
100
|
...proof,
|
|
90
101
|
value: new Uint8Array(),
|
|
@@ -217,6 +228,7 @@ var createCredential = async ({ signer, issuer, subject, assertion, signingKey,
|
|
|
217
228
|
id: subject,
|
|
218
229
|
assertion
|
|
219
230
|
},
|
|
231
|
+
parentCredentialIds,
|
|
220
232
|
proof: {
|
|
221
233
|
type: SIGNATURE_TYPE_ED25519,
|
|
222
234
|
creationDate: /* @__PURE__ */ new Date(),
|
|
@@ -225,9 +237,6 @@ var createCredential = async ({ signer, issuer, subject, assertion, signingKey,
|
|
|
225
237
|
nonce
|
|
226
238
|
}
|
|
227
239
|
};
|
|
228
|
-
if ((parentCredentialIds?.length ?? 0) > 0) {
|
|
229
|
-
credential.parentCredentialIds = parentCredentialIds;
|
|
230
|
-
}
|
|
231
240
|
const signedPayload = getCredentialProofPayload(credential);
|
|
232
241
|
credential.proof.value = await signer.sign(signingKey ?? issuer, signedPayload);
|
|
233
242
|
if (chain) {
|