Struct schnorr_fun::KeyPair[][src]

pub struct KeyPair { /* fields omitted */ }

A secret and public key-pair for generating Schnorr signatures.

The KeyPair struct is exists because it is more efficient to pre-compute the public key and pass it in rather pass it in when signing with the same key multiple times.

Create a KeyPair from a Schnorr instance.

let my_secret_key = Scalar::random(&mut rand::thread_rng());
let my_keypair = schnorr.new_keypair(my_secret_key);

Implementations

impl KeyPair[src]

pub fn secret_key(&self) -> &Scalar[src]

Returns a reference to the secret key.

pub fn public_key(&self) -> &XOnly[src]

Returns a reference to the public key.

pub fn as_tuple(&self) -> (&Scalar, &XOnly)[src]

Gets a reference to the key-pair as a tuple

Example

let (secret_key, public_key) = keypair.as_tuple();

pub fn verification_key(&self) -> Point<EvenY>[src]

Returns the full Point<EvenY> for the public key which is used in verify.

This is just a descriptive short version of:

let verification_key = keypair.public_key().to_point();

Trait Implementations

impl AsRef<XOnly> for KeyPair[src]

impl Clone for KeyPair[src]

impl Debug for KeyPair[src]

Auto Trait Implementations

impl RefUnwindSafe for KeyPair

impl Send for KeyPair

impl Sync for KeyPair

impl Unpin for KeyPair

impl UnwindSafe for KeyPair

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Mark for T[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.