pub struct Builder<'builder> { /* private fields */ }
Expand description
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
sourceimpl<'builder> Builder<'builder>
impl<'builder> Builder<'builder>
sourcepub fn new(params: NoiseParams) -> Self
pub fn new(params: NoiseParams) -> Self
Create a Builder with the default crypto resolver.
sourcepub fn with_resolver(params: NoiseParams, resolver: BoxedCryptoResolver) -> Self
pub fn with_resolver(params: NoiseParams, resolver: BoxedCryptoResolver) -> Self
Create a Builder with a custom crypto resolver.
sourcepub fn psk(self, location: u8, key: &'builder [u8]) -> Self
pub fn psk(self, location: u8, key: &'builder [u8]) -> Self
Specify a PSK (only used with NoisePSK
base parameter)
sourcepub fn local_private_key(self, key: &'builder [u8]) -> Self
pub fn local_private_key(self, key: &'builder [u8]) -> Self
Your static private key (can be generated with generate_keypair()
).
sourcepub fn prologue(self, key: &'builder [u8]) -> Self
pub fn prologue(self, key: &'builder [u8]) -> Self
Arbitrary data to be hashed in to the handshake hash value.
sourcepub fn remote_public_key(self, pub_key: &'builder [u8]) -> Self
pub fn remote_public_key(self, pub_key: &'builder [u8]) -> Self
The responder’s static public key.
sourcepub fn generate_keypair(&self) -> Result<Keypair, Error>
pub fn generate_keypair(&self) -> Result<Keypair, Error>
Generate a new asymmetric keypair (for use as a static key).
sourcepub fn build_initiator(self) -> Result<HandshakeState, Error>
pub fn build_initiator(self) -> Result<HandshakeState, Error>
Build a HandshakeState
for the side who will initiate the handshake (send the first message)
sourcepub fn build_responder(self) -> Result<HandshakeState, Error>
pub fn build_responder(self) -> Result<HandshakeState, Error>
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more