[][src]Struct snow::Builder

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

Generates a Session and also validate 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();

Methods

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: Box<dyn CryptoResolver>
) -> 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, SnowError>[src]

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

pub fn build_initiator(self) -> Result<Session, SnowError>[src]

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

pub fn build_responder(self) -> Result<Session, SnowError>[src]

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

Auto Trait Implementations

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

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

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self