Conversation
Replace custom ECIES (secp256k1 ECDH + XChaCha20-Poly1305) with standard JWE Compact Serialization (ECDH-ES + A256GCM) per the W3C VC-JOSE-COSE spec. Built using existing @noble primitives to maintain browser compatibility (Web Crypto doesn't support secp256k1). Backward compatible: legacy ciphertext is auto-detected and decrypted via decryptMessageLegacy/decryptBytesLegacy methods. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pull Request Test Coverage Report for Build 22152092432Details
💛 - Coveralls |
The decrypt methods now accept an optional legacyPubKey parameter, centralizing format detection. Removes decryptMessageCompat and decryptBytesCompat from keymaster. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request replaces the custom ECIES encryption scheme (secp256k1 ECDH + XChaCha20-Poly1305) with standard W3C JWE Compact Serialization (ECDH-ES + A256GCM) to align with the W3C VC-JOSE-COSE specification. The implementation maintains backward compatibility by auto-detecting legacy ciphertext format and providing explicit legacy decryption methods.
Changes:
- Implements JWE Compact Serialization with ECDH-ES key agreement and A256GCM encryption using @noble primitives
- Updates cipher API to use single recipient public key parameter (removing sender private key requirement)
- Migrates message metadata (sender, created) from encrypted payload to DID document controller/metadata fields
- Provides backward compatibility through legacy decryption methods and optional legacyPubKey parameter
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cipher/src/jwe.ts | New JWE implementation with buildJweCompact/parseJweCompact functions |
| packages/cipher/src/concat-kdf.ts | Concat KDF implementation per NIST SP 800-56A and RFC 7518 |
| packages/cipher/src/cipher-base.ts | Updated cipher interface with new encryption API and backward compatibility |
| packages/cipher/src/types.ts | Updated type signatures for encryption methods and added legacy methods |
| packages/keymaster/src/keymaster.ts | Updated all encryption/decryption call sites to new API, changed message metadata storage |
| packages/keymaster/src/types.ts | Made EncryptedMessage sender/created fields optional |
| tests/cipher/jwe.test.ts | Comprehensive tests for JWE implementation and KDF |
| tests/keymaster/crypto.test.ts | Updated tests to verify new metadata storage approach |
| services/gatekeeper/client/src/App.js | Updated decryptMessage call with reordered parameters |
| apps/react-wallet/src/contexts/WalletProvider.tsx | Updated decryptMessage call with reordered parameters |
| apps/chrome-extension/src/contexts/WalletProvider.tsx | Updated decryptMessage call with reordered parameters |
| python/keymaster_sdk/tests/test_keymaster_sdk.py | Updated test to check controller field instead of encrypted.sender |
| jest.config.js | Added module mappings for new JWE and KDF files |
| package.json | Version bump to 0.3.0 with updated description |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace custom ECIES (secp256k1 ECDH + XChaCha20-Poly1305) with standard JWE Compact Serialization (ECDH-ES + A256GCM) per the W3C VC-JOSE-COSE spec. Built using existing @noble primitives to maintain browser compatibility (Web Crypto doesn't support secp256k1).
Backward compatible: legacy ciphertext is auto-detected and decrypted via decryptMessageLegacy/decryptBytesLegacy methods.