@dxos/credentials 0.5.8 → 0.5.9-main.0a0e87d

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.
@@ -87,15 +87,7 @@ var truncateKey = (key) => {
87
87
  // packages/core/halo/credentials/src/presentations/signing.ts
88
88
  var getPresentationProofPayload = (credentials, proof) => {
89
89
  const copy = {
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
- }),
90
+ credentials: credentials.map((credential) => removeEmptyParentCredentialIds(credential)),
99
91
  proof: {
100
92
  ...proof,
101
93
  value: new Uint8Array(),
@@ -104,6 +96,21 @@ var getPresentationProofPayload = (credentials, proof) => {
104
96
  };
105
97
  return Buffer.from(canonicalStringify(copy));
106
98
  };
99
+ var removeEmptyParentCredentialIds = (credential) => {
100
+ const copy = {
101
+ ...credential,
102
+ proof: credential.proof ? {
103
+ ...credential.proof,
104
+ chain: credential.proof.chain ? {
105
+ credential: removeEmptyParentCredentialIds(credential.proof.chain.credential)
106
+ } : void 0
107
+ } : void 0
108
+ };
109
+ if (copy.parentCredentialIds?.length === 0) {
110
+ delete copy.parentCredentialIds;
111
+ }
112
+ return copy;
113
+ };
107
114
 
108
115
  // packages/core/halo/credentials/src/credentials/assertions.ts
109
116
  var getCredentialAssertion = (credential) => credential.subject.assertion;