Skip to content

Claude/symmetric key proofs lgsx g#28

Merged
sweis merged 5 commits intomainfrom
claude/symmetric-key-proofs-lgsxG
Feb 26, 2026
Merged

Claude/symmetric key proofs lgsx g#28
sweis merged 5 commits intomainfrom
claude/symmetric-key-proofs-lgsxG

Conversation

@sweis
Copy link
Copy Markdown
Owner

@sweis sweis commented Feb 26, 2026

No description provided.

ECVRF was added to enable "verification with only a key hash," but VRF
verification fundamentally requires the full public key (RFC 9381), making
it functionally identical to Ed25519 which the project already supports.

Removes: vrf-r255 dependency, Algorithm::EcVrf, KeyIdType::FullKeyHash,
KeyIdentifier::FullKeyHash, SignedToken.proof field, and all ECVRF signing/
verification/key/CLI/serialization code and tests (-681 lines).

106 tests pass (89 unit + 4 reference + 13 integration).

https://claude.ai/code/session_01LJyL1uYXD1JHMq8Q3v7shM
Replaces the removed ECVRF with a true symmetric key proof using Groth16
zero-knowledge SNARKs on BN254 (arkworks ecosystem). The prover demonstrates
knowledge of key K such that SHA-256(K) = key_hash and HMAC-SHA256(K,
SHA-256(payload)) = signature, without revealing K.

Circuit design:
- Fixed-size R1CS circuit with SHA-256 gadgets for key hash and HMAC
- Public inputs: key_hash + payload_hash + hmac_output (96 bytes / 768 bits)
- Private witness: 32-byte symmetric key
- 128-byte compressed Groth16 proof

Changes:
- New src/snark.rs: circuit, setup/prove/verify, key serialization (7 tests)
- types.rs: Algorithm::Groth16Sha256, KeyIdType::FullKeyHash, proof field
- sign.rs: sign_groth16() function
- verify.rs: verify_groth16() function
- serialize.rs: FullKeyHash + proof field serialization/deserialization
- keys.rs: Groth16Sha256 key validation
- main.rs: Groth16 display in inspect, algorithm handling in CLI
- Cargo.toml: arkworks v0.5 dependencies

96 tests pass (89 existing + 7 SNARK tests).

https://claude.ai/code/session_01LJyL1uYXD1JHMq8Q3v7shM
The Groth16 SNARK tests take ~4 min (SHA-256 circuit setup is expensive).
Split the test job so fast tests always run, and SNARK tests only trigger
on changes to src/snark.rs. SNARK tests run single-threaded with 64MB stack
to avoid OOM from parallel circuit setups.

Also update Makefile with separate test/test-snark targets.

https://claude.ai/code/session_01LJyL1uYXD1JHMq8Q3v7shM
Replace all ECVRF references with Groth16-SHA256. Add a library API
section with setup/sign/verify and key serialization examples since
Groth16 requires trusted setup and is not available via the CLI.

https://claude.ai/code/session_01LJyL1uYXD1JHMq8Q3v7shM
Ignore RUSTSEC-2024-0388 (derivative) and RUSTSEC-2024-0436 (paste),
both unmaintained informational warnings for transitive dependencies
inside the arkworks ecosystem (ark-crypto-primitives, ark-ff). No
replacement available until arkworks migrates upstream.

https://claude.ai/code/session_01LJyL1uYXD1JHMq8Q3v7shM
@sweis sweis merged commit 6ab9578 into main Feb 26, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants