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

How to use the D type? #636

Open
BlowaterNostr opened this issue Aug 1, 2023 · 1 comment
Open

How to use the D type? #636

BlowaterNostr opened this issue Aug 1, 2023 · 1 comment

Comments

@BlowaterNostr
Copy link

BlowaterNostr commented Aug 1, 2023

I have this code

    let pri_key = SecretKey::random(&mut rand::thread_rng());
    let pub_key = PublicKey::from_secret_key(&pri_key);
    let shared = SharedSecret::new(&pub_key, &pri_key);

get

type annotations needed
cannot satisfy `_: digest::digest::Digest`

for line

let shared = SharedSecret::new(&pub_key, &pri_key);

How do I fix it?

New to Rust

@apoelstra
Copy link
Member

Hi @BlowaterNostr, welcome to Rust. What version of this library are you using? It looks like there is no SecretKey::random method, and PublicKey::from_secret_key takes two arguments (one is a context object) rather than one.

You can see our API documentation at docs.rs.

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