iden3 / go-iden3-crypto

Go implementation of some cryptographic primitives (that fit inside the SNARK field) and compatible with circomlib
Apache License 2.0
117 stars 38 forks source link

fix bbjj api: return err when hash fails while sign/verify #57

Closed arnaucube closed 11 months ago

arnaucube commented 1 year ago

In the babyjubjub package, when inputting a msg that didn't fit in a finite field element, the poseidon.Hash method was failing due the value not fitting inside the finite field, but the error was not returned and the end user only saw false without knowing why. Updated the interface of the sign & verify methods so that the error is returned and users can know that the method has failed due the inputted msg not fitting inside the finite field used by the babyjubjub.

This modifies the interface of the babyjubjub package, so will affect other projects/repos using this library, maybe worth doing a new tag/release with this change mentioned in the changelog.

OBrezhniev commented 1 year ago

Thank you for contributing, Arnau!