pub fn initiator(
        my_privkey: &NoisePrivKey,
        their_pubkey: &NoisePubKey,
    ) -> Result<(KKHandshakeActOne, KKMessageActOne), Error> {
        // Build the initial initiator state
        let builder = Builder::with_resolver(
            "Noise_KK_25519_ChaChaPoly_SHA256"
                .parse()
                .expect("Valid params"),
            Box::new(SodiumResolver::default()),
        );
        let mut state = builder
            .local_private_key(&my_privkey.0)
            .remote_public_key(&their_pubkey.0)
            .build_initiator()
            .map_err(|e| Error::Noise(format!("Failed to build state for initiator: {:?}", e)))?;

        // Write the first message
        let mut msg = [0u8; KK_MSG_1_SIZE];
        state
            .write_message(HANDSHAKE_MESSAGE, &mut msg)
            .map_err(|e| {
                Error::Noise(format!(
                    "Failed to write first message for initiator: {:?}",
                    e
                ))
            })?;

        Ok((KKHandshakeActOne { state }, KKMessageActOne(msg)))
    }
/// Start the first act of the handshake as an initiator (sharing e, es, ss)
Start the first act of the handshake as an initiator (sharing e, es, ss)
Start the first act of the handshake as an initiator ( sharing e es ss )
pub fn initiator(
        my_privkey: &NoisePrivKey,
        their_pubkey: &NoisePubKey,
    ) -> Result<(KKHandshakeActOne, KKMessageActOne), Error> {
        // Build the initial initiator state
        let builder = Builder::with_resolver(
            "Noise_KK_25519_ChaChaPoly_SHA256"
                .parse()
                .expect("Valid params"),
            Box::new(SodiumResolver::default()),
        );
        let mut state = builder
            .local_private_key(&my_privkey.0)
            .remote_public_key(&their_pubkey.0)
            .build_initiator()
            .map_err(|e| Error::Noise(format!("Failed to build state for initiator: {:?}", e)))?;
        // Write the first message
        let mut msg = [0u8; KK_MSG_1_SIZE];
        state
            .write_message(HANDSHAKE_MESSAGE, &mut msg)
            .map_err(|e| {
                Error::Noise(format!(
                    "Failed to write first message for initiator: {:?}",
                    e
                ))
            })?;
        Ok((KKHandshakeActOne { state }, KKMessageActOne(msg)))
    }
pub fn initiator ( my_privkey : & NoisePrivKey , their_pubkey : & NoisePubKey , ) -> Result < ( KKHandshakeActOne , KKMessageActOne ) , Error > { // Build the initial initiator state let builder = Builder :: with_resolver ( " " . parse ( ) . expect ( " " ) , Box :: new ( SodiumResolver :: default ( ) ) , ) ; let mut state = builder . local_private_key ( & my_privkey . 0 ) . remote_public_key ( & their_pubkey . 0 ) . build_initiator ( ) . map_err ( | e | Error :: Noise ( format ! ( " " e ) ) ) ? ; // Write the first message let mut msg = [ 0u8 ; KK_MSG_1_SIZE ] ; state . write_message ( HANDSHAKE_MESSAGE , & mut msg ) . map_err ( | e | { Error :: Noise ( format ! ( " " e ) ) } ) ? ; Ok ( ( KKHandshakeActOne { state } , KKMessageActOne ( msg ) ) ) }
Start the first act of the handshake as an initiator (sharing e, es, ss)
Start the first act of the handshake as an initiator ( sharing e es ss )
my_privkey
&NoisePrivKey
their_pubkey
&NoisePubKey
my_privkey
&NoisePrivKey
their_pubkey
&NoisePubKey