INNER CODE UNIT · Rust
establish_outbound_channel
matrix-org/vodozemac · src/ecies/mod.rs:205
pub fn establish_outbound_channel(
self,
their_public_key: Curve25519PublicKey,
initial_plaintext: &[u8],
) -> Result<OutboundCreationResult, Error> {
let our_public_key = self.public_key();
let shared_secret = self.secret_key.diffie_hellman(&their_public_key.inner);
if shared_secret.was_contributory() {
let mut ecies = EstablishedEcies::new(
&shared_secret,
our_public_key,
their_public_key,
&self.application_info_prefix,
Role::Initiator,
);
let message = ecies.encrypt(initial_plaintext);