- Status: Accepted
- Date: 2026-11-13
- Amends: ADR-0007
Context
FEAT-03 (QuantLayer Identity) must verify wallet ownership (EIP-712, secp256k1 recovery, Keccak-256), verify Ed25519/ES256K signatures for proof of possession and authorization, derive identifiers with SHA-256, and generate unpredictable nonces. ADR-0007 deferred all cryptographic implementation.
Decision
- No hand-written primitives. Hashing, curve arithmetic and signature
verification come from
@noble/hashesand@noble/curves(v2): audited, dependency-free, constant-time-oriented, and the same code that underpins viem and ethers. - They are used in exactly two packages:
@quantlayer-protocol/crypto-classical— implements the@quantlayer-protocol/cryptoports: SHA-256 / Keccak-256HashFunctions, a verify-only Ed25519/ES256KSignatureVerifier, secp256k1 public-key recovery, and a CSPRNGRandomSource. It exposes no signing API.@quantlayer-protocol/evm— EIP-55, CAIP-10eip155accounts, EIP-712 typed-data hashing and an EIP-712/EIP-1271AccountOwnershipVerifier. It usescrypto-classicalfor primitives; its EIP-712 encoder is protocol encoding verified against the specification's own test vectors.
- Strict verification parameters: Ed25519 with RFC 8032 strict decoding (no ZIP-215 leniency); ECDSA with low-S enforced (EIP-2) everywhere; exact public-key and signature lengths.
- Post-quantum algorithms remain behind the
SignatureVerifierport, to be provided byrust/quantlayer-pqcvia WASM (ADR-0007 unchanged for PQC). Unknown algorithms fail closed withUNSUPPORTED_ALGORITHM. - Layering:
crypto-classical→ {shared, core, crypto};evm→ {shared, core, crypto, crypto-classical, identity} (an adapter depends on the domain port it implements).
Consequences
- Real signatures are verified in tests against published vectors (RFC 8032, FIPS 180, EIP-55, EIP-712).
- Adding a classical algorithm means extending
crypto-classicalonly. - Library upgrades are security-relevant changes and must be reviewed as such.