pub fn encode_message_3<B: AsRef<[u8]>>(&mut self, payload: B) -> OckamResult<Vec<u8>> {
        let t = &mut self.0;
        let static_secret = t
            .identity_key
            .take()
            .ok_or_else(|| Error::InvalidState.into())?;

        let static_public = t
            .identity_public_key
            .clone()
            .ok_or_else(|| Error::InvalidState.into())?;

        let remote_ephemeral_public_key = t
            .remote_ephemeral_public_key
            .clone()
            .ok_or_else(|| Error::InvalidState.into())?;

        let mut encrypted_s_and_tag = t.encrypt_and_mix_hash(static_public.as_ref())?;
        t.dh(&static_secret, remote_ephemeral_public_key.as_ref())?;
        t.identity_key = Some(static_secret);
        let mut encrypted_payload_and_tag = t.encrypt_and_mix_hash(payload)?;
        encrypted_s_and_tag.append(&mut encrypted_payload_and_tag);
        Ok(encrypted_s_and_tag)
    }
/// Encode the final message to be sent
Encode the final message to be sent
Encode the final message to be sent
pub fn encode_message_3<B: AsRef<[u8]>>(&mut self, payload: B) -> OckamResult<Vec<u8>> {
        let t = &mut self.0;
        let static_secret = t
            .identity_key
            .take()
            .ok_or_else(|| Error::InvalidState.into())?;
        let static_public = t
            .identity_public_key
            .clone()
            .ok_or_else(|| Error::InvalidState.into())?;
        let remote_ephemeral_public_key = t
            .remote_ephemeral_public_key
            .clone()
            .ok_or_else(|| Error::InvalidState.into())?;
        let mut encrypted_s_and_tag = t.encrypt_and_mix_hash(static_public.as_ref())?;
        t.dh(&static_secret, remote_ephemeral_public_key.as_ref())?;
        t.identity_key = Some(static_secret);
        let mut encrypted_payload_and_tag = t.encrypt_and_mix_hash(payload)?;
        encrypted_s_and_tag.append(&mut encrypted_payload_and_tag);
        Ok(encrypted_s_and_tag)
    }
pub fn encode_message_3 < B : AsRef < [ u8 ] > > ( & mut self , payload : B ) -> OckamResult < Vec < u8 > > { let t = & mut self . 0 ; let static_secret = t . identity_key . take ( ) . ok_or_else ( | | Error :: InvalidState . into ( ) ) ? ; let static_public = t . identity_public_key . clone ( ) . ok_or_else ( | | Error :: InvalidState . into ( ) ) ? ; let remote_ephemeral_public_key = t . remote_ephemeral_public_key . clone ( ) . ok_or_else ( | | Error :: InvalidState . into ( ) ) ? ; let mut encrypted_s_and_tag = t . encrypt_and_mix_hash ( static_public . as_ref ( ) ) ? ; t . dh ( & static_secret , remote_ephemeral_public_key . as_ref ( ) ) ? ; t . identity_key = Some ( static_secret ) ; let mut encrypted_payload_and_tag = t . encrypt_and_mix_hash ( payload ) ? ; encrypted_s_and_tag . append ( & mut encrypted_payload_and_tag ) ; Ok ( encrypted_s_and_tag ) }
Encode the final message to be sent
Encode the final message to be sent
&mut self
payload
B
&mut self
payload
B