OpenZeppelin / OpenZeppelin/compact-contracts
crypto: add a Field plaintext pad to EcdhMask
Open
@0xisk is already working on this.
Since Sep 7, 2026.
0-high
effort: 2-S
enhancement
feat:crypto
- Dominant language
- TypeScript
- Stars
- 55
- Forks
- 29
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 25
Description
🧐 Motivation
Note delivery needs to hand a recipient a (value, nonce) pair under one ECDH. EcdhMask.encrypt only pads a Uint<128>, and the nonce is a Field. A separate crypto/NoteDelivery module would duplicate the KDF for one extra plaintext type.
📝 Details
contracts/src/crypto/EcdhMask.compact
- Add
encryptField/decryptField(or a pair variant sharing one ephemeral) with the same identity and zero-ephemeral guards asencrypt. - Document the hiding margin: the pad is below
2^248, so a full-widthFieldplaintext does not get the marginUint<128>values have. - Mock re-export and tests follow
MockEcdhMask/EcdhMask.test.ts.
Replaces the crypto/NoteDelivery draft from #679. The note structs, OZ:note:* tags and wallet-side recovery move to the Delivery extension (#727).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.