Struct snow::Builder[][src]

pub struct Builder<'builder> { /* fields omitted */ }

Generates a HandshakeState and also validates that all the prerequisites for the given parameters are satisfied.

Examples

let noise = Builder::new("Noise_XX_25519_ChaChaPoly_BLAKE2s".parse().unwrap())
    .local_private_key(&my_long_term_key)
    .remote_public_key(&their_pub_key)
    .prologue("noise is just swell".as_bytes())
    .build_initiator()
    .unwrap();

Implementations

impl<'builder> Builder<'builder>[src]

pub fn new(params: NoiseParams) -> Self[src]

Create a Builder with the default crypto resolver.

pub fn with_resolver(params: NoiseParams, resolver: BoxedCryptoResolver) -> Self[src]

Create a Builder with a custom crypto resolver.

pub fn psk(self, location: u8, key: &'builder [u8]) -> Self[src]

Specify a PSK (only used with NoisePSK base parameter)

pub fn local_private_key(self, key: &'builder [u8]) -> Self[src]

Your static private key (can be generated with generate_keypair()).

pub fn prologue(self, key: &'builder [u8]) -> Self[src]

Arbitrary data to be hashed in to the handshake hash value.

pub fn remote_public_key(self, pub_key: &'builder [u8]) -> Self[src]

The responder’s static public key.

pub fn generate_keypair(&self) -> Result<Keypair, Error>[src]

Generate a new asymmetric keypair (for use as a static key).

pub fn build_initiator(self) -> Result<HandshakeState, Error>[src]

Build a HandshakeState for the side who will initiate the handshake (send the first message)

pub fn build_responder(self) -> Result<HandshakeState, Error>[src]

Build a HandshakeState for the side who will be responder (receive the first message)

Auto Trait Implementations

impl<'builder> !RefUnwindSafe for Builder<'builder>

impl<'builder> Send for Builder<'builder>

impl<'builder> !Sync for Builder<'builder>

impl<'builder> Unpin for Builder<'builder>

impl<'builder> !UnwindSafe for Builder<'builder>

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> Same<T> for T[src]

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]