-
Notifications
You must be signed in to change notification settings - Fork 85
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 ed25519 to curve25519 conversion helpers #217
Conversation
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.
The methods should at least indicate that they're converting from the Edwards ("Ed25519") to Montgomery ("Curve25519", "X25519") forms.
Unfortunately this gem uses the now outdated "Curve25519" naming which is a bit ambiguous (as Curve25519 is also often used to describe the curve regardless of what form it's expressed in).
All that said, maybe to_curve25519_private_key
and to_curve25519_public_key
?
Yes, that would be less ambiguous for sure, updated method names and added |
it "can be converted to curve25519 private key" do | ||
expect(subject.to_private_key).to be_a_kind_of(RbNaCl::PrivateKey) | ||
end |
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.
It'd be good to find some test vectors and ensure the output is correct for both methods
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.
added test vectors (generated by pynacl
).
…ersion... generated these values using pynacl
Looks good, thanks! |
thanks for your work here. I was trying this on main branch with the following code:
and was running into Is there anything I'm missing here? Thanks for your help! |
Hi @nlsrchtr I tested your example and it's working, please make sure you're using the correct version of |
Don't know if it's the right place to add these helpers or If I did any unintended mistakes or more tests need to be added!
If this need to be moved to
Util
module or somewhere else, just let me know.https://libsodium.gitbook.io/doc/advanced/ed25519-curve25519 should be read for anyone who uses this (we already used this in one of our projects).
Resolves #204.