Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

intelliot
Copy link
Collaborator

  • Sign an arbitrary string with a private key
  • Verify a signature with a public key

validate.signMessage({message, privateKey})

const signingData = binary.encode({
message: message
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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 ?

Copy link
Contributor

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 ?

Copy link
Collaborator Author

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?

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps just encoding as utf-8 and using its hex representation is sufficient?

Perhaps, but I don't know what you're doing, and I'm not a crypto guy.

Ask @justmoon or @JoelKatz

- Sign an arbitrary string (message) with a private key
- Message is encoded in UTF-8 before signing
- Verify a signature with a public key
@intelliot
Copy link
Collaborator Author

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.

@intelliot intelliot closed this Oct 8, 2019
@mvadari mvadari deleted the sign-verify-message branch July 27, 2021 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants