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

getSharedSecret() #687

Closed
mikedilger opened this issue Nov 16, 2022 · 4 comments
Closed

getSharedSecret() #687

mikedilger opened this issue Nov 16, 2022 · 4 comments

Comments

@mikedilger
Copy link

Is there a way I can replicate https://github.com/paulmillr/noble-secp256k1 getSharedSecret() function using this crate?

If not, can we add a function for that? It's used in the nostr protocol. It's basically a normalized public key multiplied by a normalied private key, but the devil is in the details (and if I try to write it, there will be even more devils in the details).

@tarcieri
Copy link
Member

@mikedilger
Copy link
Author

mikedilger commented Nov 17, 2022

Thanks. Unfortunately I can't get a SecretKey from a schnorr::SigningKey on which to run .to_nonzero_scalar(), and I can't get a NonZeroScalar directly from a schnorr::SigningKey even though it is right in there privately. And if I try to go into bytes and back let field_bytes = signing_key.to_bytes(); let nonzero_scalar = NonZeroScalar::from_repr(field_bytes) the bounds are not satisfied.

Can we have a schnorr::SigningKey.inner() or something?

@tarcieri
Copy link
Member

#690 adds an accessor method, however it's on the v0.12 release track and therefore won't be available until the next minor release

@mikedilger
Copy link
Author

Thanks! In the meantime I created an identical type into which I transmute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants