[][src]Module secp256k1_zkp::schnorrsig

Schnorrsig

Support for bip-schnorr compliant signatures

extern crate secp256k1;
extern crate secp256k1_zkp_dev;
extern crate rand;

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

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);
assert!(secp.verify(&message, &sig, &public_key).is_ok());

The above code requires secp256k1 to be compiled with the rand feature enabled, to get access to generate_keypair Alternately, keys can be parsed from slices.

Structs

ScratchSpace

The purpose of this rewriteable structure is to replace dynamic memory allocations in the libsecp256k1-zkp library. See its documentation for further information.

Enums

Error

A schnorrsig error

SysError

A Schnorrsig error. This does not implement std:error::Error because it's not available with no_std.

Traits

Sign

Schnorrsig signing trait

Verify

Schnorrsig verification trait

Type Definitions

Signature

A Schnorr signature