[−][src]Struct snow::Builder
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]
params: NoiseParams,
resolver: Box<dyn CryptoResolver>
) -> Self
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
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self