recoverPublicKey

fun recoverPublicKey(sig: ByteVector64, message: ByteArray): Pair<PublicKey, PublicKey>

Recover public keys from a signature and the message that was signed. This method will return 2 public keys, and the signature can be verified with both, but only one of them matches that private key that was used to generate the signature.

Return

a (pub1, pub2) tuple where pub1 and pub2 are candidates public keys. If you have the recovery id then use pub1 if the recovery id is even and pub2 if it is odd

Parameters

sig

signature

message

message that was signed


fun recoverPublicKey(    sig: ByteVector64,     message: ByteArray,     recid: Int): PublicKey

Recover public keys from a signature, the message that was signed, and the recovery id (i.e. the sign of the recovered public key)

Return

the recovered public key

Parameters

sig

signature

message

that was signed