diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e4325a5..a05027a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # jsonld-signatures ChangeLog +## 11.3.2 - 2024-11-xx + +### Fixed +- Ensure `proof.@context` is unmodified for JCS Data Integrity Cryptosuites. + ## 11.3.1 - 2024-10-02 ### Fixed diff --git a/lib/ProofSet.js b/lib/ProofSet.js index ae911e39..3f2b5d8f 100644 --- a/lib/ProofSet.js +++ b/lib/ProofSet.js @@ -224,10 +224,14 @@ function _getProofs({document}) { // shallow copy proofs and add document context or SECURITY_CONTEXT_URL const context = document['@context'] || constants.SECURITY_CONTEXT_URL; - proofSet = proofSet.map(proof => ({ - '@context': context, - ...proof - })); + proofSet = proofSet.map(proof => { + const {cryptosuite} = proof; + // JCS Data Integrity Suites require unmodified proofs + if(cryptosuite?.includes?.('-jcs-')) { + return proof; + } + return {'@context': context, ...proof}; + }); return proofSet; }