Skip to content

Commit

Permalink
Add fix for jcs suites.
Browse files Browse the repository at this point in the history
  • Loading branch information
gannan08 committed Nov 6, 2024
1 parent bd54d46 commit 664e41b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 8 additions & 4 deletions lib/ProofSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 && cryptosuite.includes('-jcs-')) {
return proof;
}
return {'@context': context, ...proof};
});

return proofSet;
}
Expand Down

0 comments on commit 664e41b

Please sign in to comment.