komputing / KEthereum

Kotlin library for Ethereum
MIT License
344 stars 72 forks source link

EIP191 signature to PublicKey conversion #127

Closed vchernetskyi993 closed 2 years ago

vchernetskyi993 commented 2 years ago

KEthereum already has SignatureData to PublicKey conversion (org.kethereum.crypto.SignKt#signedMessageToKey), but I've stumbled on the need to convert EIP-191 personal signature to PublicKey (see this sample repo for use case https://github.com/vchernetskyi993/ethereum-server-auth).

From my perspective, these two new functions HexString.toSignatureData and personallySignedMessageToKey should be in the KEthereum code base, since they are quite re-usable across projects. Therefore, this PR.

@ligi please, review and tell me your thoughts (it's my first commit to your repo, so sorry in advance for any inaccuracies)

vchernetskyi993 commented 2 years ago

Thanks - in general a nice contribution! Just some nits and I would not use personallySignedbut personalSigned

renamed

ligi commented 2 years ago

Thanks!