Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: improve signature api There are some footguns in the `SchnorrSignature::sign` method that this PR seeks to mitigate. Firstly, it's not clear in the function docs that the nonce and pubkey are assumed to have been bound by the caller in the challenge. The docs are updated to make this clearer. Secondly, we deprecate the sign method and the utility module's sign method in favour of: - `sign_raw`, which is identical to the current sign method, but with a name that conveys the risk associated with using it. - `sign_message`, which does what many clients might have thought `sign` does, which correctly binds a nonce and public key to the message being signed in the challenge construction. - Matching `verify_*` methods. Tests and docs have been updated to reflect the changes. * feat!: update wasm and ffi to use domain separated hashes The WASM and FFI library now use the domain-separated hashing algorithm to generate challenges for signatures. * feat: allow passing of secret by reference The old API took ownership of the secret. This isn't necessary from an API point of view. It's more ergonomic to take a reference. The nonce still gives up ownerhip, since this should never be re-used. * fix clippy lints * fix: benchmarks * chore: change bench message to [u8] In response to review comment * feat: allow custom domains on schnorr sig This commit adds support for providing custom domain separation tags to SchnorrSignature. This is done by including a 3rd generic type to the SchnorrSignature struct definition. The provision is optional. By default, the domain hash separator uses SchnorrSigChallenge as the domain separation tag. The `RsitrettoSchnorr` type alias is updated to include the default domain separation tag, to keep backward compatibility. To provide a custom hasher, update usages of `RistrettoSchnorr` t `RistrettoSchnorrWithDomain` * fix: update ffi method docs and function sig There were some small inconsistencies between the docstrings and method sigs in the ffi module. The `verify` function also had the sig and nonce being mutable, which is incorrect, since they're input parameters in this case. * fix: update wasm tests to use correct type alias * docs: add missing docs and export new type Export `RistrettoSchnorrWithDomain` and add the missing docs clippy was complaining about * fix: test arguments
- Loading branch information
Showing
10 changed files
with
322 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.