add ecdhMask#655
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThis PR adds a new stateless ECDH-based one-time-pad crypto module (EcdhMask) with kdf, encrypt, and decrypt circuits operating over Jubjub points and field elements, plus a test-only mock wrapper contract and a comprehensive Vitest test suite validating correctness, confidentiality, and edge cases. ChangesECDH Mask Module
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant EncryptCircuit
participant KdfCircuit
participant DecryptCircuit
Caller->>EncryptCircuit: encrypt(recipientPk, value, e, domain)
EncryptCircuit->>EncryptCircuit: assert recipientPk not identity, e != 0
EncryptCircuit->>EncryptCircuit: ephemeralPk = g^e, sShared = recipientPk^e
EncryptCircuit->>KdfCircuit: kdf(sShared, domain)
KdfCircuit-->>EncryptCircuit: mask
EncryptCircuit-->>Caller: Ciphertext{ephemeralPk, ct = value + mask}
Caller->>DecryptCircuit: decrypt(ciphertext, ekScalar, domain)
DecryptCircuit->>DecryptCircuit: sShared = ephemeralPk^ekScalar
DecryptCircuit->>KdfCircuit: kdf(sShared, domain)
KdfCircuit-->>DecryptCircuit: mask
DecryptCircuit-->>Caller: value = ct - mask
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Fixes #654
Summary by CodeRabbit