bcoin-org / bcrypto

JS crypto library
Other
99 stars 41 forks source link

Return recovery with signatures. #13

Closed nodech closed 5 years ago

nodech commented 5 years ago

Adds two new api calls signRecoverable and signRecoverableDER.

It only adds these methods to secp256k1. Even though elliptic.js can returns recovery for all curves, bcrypto_ecdsa is based on OpenSSL.

Because bcrypto/secp256k1 is using different implementation that supports recovery, decided to expose these methods only for lib/secp256k1.

Addresses: https://github.com/bcoin-org/bcrypto/issues/4

chjj commented 5 years ago

Hmm, I was considering just having sign return the recovery param by default, but that would be a breaking API change and I don't feel like finding every sign call we ever made and changing it.

It'd be really nice to expose this for all the EC backends. I think I could merge this and then work on the other backends.