This PR introduces the concept of signatures from which the public key can be recovered (just requires a special header byte to be set). This is the way bitcoin serializes signatures and we need to replicate this behavior.
If you just want the plain old (r, s) of the signature all you have to do is slice the first byte off. Nothing else is different.
I've also added the PublicKey.recover(hash, signature) method, which re-obtains the canonical public key from (hash, signature).
This PR introduces the concept of signatures from which the public key can be recovered (just requires a special header byte to be set). This is the way bitcoin serializes signatures and we need to replicate this behavior.
If you just want the plain old
(r, s)
of the signature all you have to do is slice the first byte off. Nothing else is different.I've also added the
PublicKey.recover(hash, signature)
method, which re-obtains the canonical public key from (hash, signature).