@dxos/credentials 0.8.4-main.d05539e30a → 0.8.4-main.d9fc60f731

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.
@@ -60,13 +60,21 @@ var getCredentialProofPayload = (credential) => {
60
60
  delete copy.parentCredentialIds;
61
61
  }
62
62
  delete copy.id;
63
- const assertion = copy.subject?.assertion;
64
- if (assertion) {
65
- for (const key of Object.keys(assertion)) {
66
- if (Array.isArray(assertion[key]) && assertion[key].length === 0) {
67
- delete assertion[key];
63
+ const originalAssertion = copy.subject?.assertion;
64
+ if (originalAssertion) {
65
+ const normalizedAssertion = {
66
+ ...originalAssertion
67
+ };
68
+ for (const key of Object.keys(normalizedAssertion)) {
69
+ const val = normalizedAssertion[key];
70
+ if (val === void 0 || val === null || val === 0 || val === "" || val === false || Array.isArray(val) && val.length === 0) {
71
+ delete normalizedAssertion[key];
68
72
  }
69
73
  }
74
+ copy.subject = {
75
+ ...copy.subject,
76
+ assertion: normalizedAssertion
77
+ };
70
78
  }
71
79
  return Buffer.from(canonicalStringify(copy));
72
80
  };