use rand::rngs::OsRng;
use secp256k1::{Secp256k1, Message};

// https://docs.rs/secp256k1/0.17.2/secp256k1/
fn main() {
    let secp = Secp256k1::new();
    let mut rng = OsRng::new().expect("OsRng");
    let (secret_key, public_key) = secp.generate_keypair(&mut rng);
    let message = Message::from_slice(&[0xab; 32]).expect("32 bytes");

    let sig = secp.sign(&message, &secret_key);
    println!("{}", secret_key);
    println!("{:?}", secret_key);
    println!("{}", public_key);
    println!("{:?}", public_key);
    println!("{}", sig);
    assert!(secp.verify(&message, &sig, &public_key).is_ok());
}
