rust-secp256k1-zkp
rust-secp256k1-zkp copied to clipboard
Add Bindings for Schnorr Adaptor Signatures
This PR introduces Rust bindings for the Schnorr adaptor signature functionality added in: https://github.com/BlockstreamResearch/secp256k1-zkp/pull/299. The secp256k1-zkp PR is pending review from the maintainers, but I don’t expect the user-facing APIs to change much. Hence, I’m opening the bindings PR here.
Changes:
- Provides FFI interfaces to the corresponding libsecp256k1-zkp functions:
secp256k1_schnorr_adaptor_presignsecp256k1_schnorr_adaptor_extractsecp256k1_schnorr_adaptor_adaptsecp256k1_schnorr_adaptor_extract_sec
- Introduces a dedicated module for adaptor signature bindings:
- adds the
zkp::schnorr_adaptor::SchnorrAdaptorPreSignaturewrapper type. - Implements methods to:
- Create pre-signatures with
presign. - Extract the adaptor point via
extract_adaptor. - Adapt a pre-signature to a valid Schnorr signature using
adapt. - Extract the secret adaptor through
extract_secadaptor.
- Create pre-signatures with
- Includes a correctness test to ensure proper functionality.
- adds the
Note: The overall diff might appear large because the first commit (528f610) updates the secp256k1-zkp-sys vendor with the Schnorr adaptor module (since those changes haven’t been merged upstream yet). The code changes relevant to the bindings are in commits 2 and 3.
Nice, thanks!! I reviewed the code, though I don't think we should merge it until upstream merges theirs and we can vendor it from the main repo.