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]
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)