New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add signMessage and verifyMessage functions #794
Conversation
intelliot
commented
Sep 6, 2017
- Sign an arbitrary string with a private key
- Verify a signature with a public key
src/offline/sign-message.js
Outdated
validate.signMessage({message, privateKey}) | ||
|
||
const signingData = binary.encode({ | ||
message: message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to work: binary.encode
expects ledger entry, or transaction json, as spoken by rippled. It silently discards fields, so you're probably turning the message into a signingData of empty bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably just want to encode the message as utf-8 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With some kind of Hash Prefix
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Not sure how to select a Hash Prefix
. Perhaps just encoding as utf-8 and using its hex representation is sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoelKatz is the chief crypto guy @ ripple :)
Tell him your use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Sign an arbitrary string (message) with a private key - Message is encoded in UTF-8 before signing - Verify a signature with a public key
bf51a6e
to
8646180
Compare
There's not much demand/priority for this feature and it needs to be updated to resolve merge conflicts. If anyone wants to pick this up and open a new PR, feel free. |