I found rust-secp256k1 and it seems to be what I need, but there are no examples in the documentation.
I tried to use this crate in my code:
extern crate secp256k1;
use secp256k1::key::SecretKey;
fn main() {
let context = secp256k1::Secp256k1::without_caps();
let private_key: String = String::from("d500266f7d37f0957564e4ce1a1dcc8bb3408383634774a2f4a94a35f4bc53e0");
let secret_key = SecretKey::new(&context, &mut private_key);
println!("{:?}", secret_key);
}
I got an error:
error[E0277]: the trait bound `std::string::String: secp256k1::rand::Rng` is not satisfied
--> src/main.rs:10:22
|
10 | let secret_key = SecretKey::new(&context, &mut private_key);
| ^^^^^^^^^^^^^^ the trait `secp256k1::rand::Rng` is not implemented for `std::string::String`
|
= note: required by `secp256k1::key::SecretKey::new`