pub struct ContactMessage {
pub mlkem_encapsulation_key: Vec<u8>,
pub ecies_public_key: Vec<u8>,
pub channel_id: u64,
pub nonce: u64,
pub transport_protocol: Option<TransportProtocol>,
pub timestamp: Option<Timestamp>,
}Expand description
ContactMessage is the only DeRec protocol message that is not wrapped inside a DeRecMessage.
This message is exchanged out-of-band before pairing begins. It provides the minimum information required for another party to initiate contact and send the first protocol message for a new pairing session.
Unlike normal DeRec protocol messages, a ContactMessage:
- is not wrapped in a DeRecMessage
- is not signed
- is not encrypted
- is not delivered through an already-established DeRec channel
Because it is exchanged before any secure channel exists, this message should only contain bootstrap information needed to establish that channel. It is typically transferred through a trusted or user-mediated mechanism.
Typical exchange mechanisms include:
- QR codes displayed by either the Owner or Helper and scanned by the other party
- distribution inside an application controlled by one of the parties
- transmission over an already-existing communication channel when the parties have a prior relationship
The recipient of this message uses its contents to construct and send the initial pairing request. In particular, the ContactMessage conveys:
- the public encryption key material needed to protect the first inbound pairing message
- a channel identifier that the recipient must echo in subsequent protocol messages sent to this contact
- a nonce that binds the pairing attempt to the out-of-band contact exchange
- the transport information required to deliver the pairing request
The nonce may be transmitted together with the rest of the message or delivered separately by the application, depending on the authentication and pairing UX.
Fields§
§mlkem_encapsulation_key: Vec<u8>Serialized ML-KEM-768 encapsulation key.
This public key is used by the sender of the first protocol message to establish confidentiality for the initial pairing exchange.
The exact cryptographic processing and message construction are defined by the DeRec pairing protocol and its implementation.
ecies_public_key: Vec<u8>Serialized ECIES public key.
This public key is used as part of the encryption scheme for the initial pairing message sent to the creator of this contact.
Together with mlkemEncapsulationKey, this field provides the public
encryption material needed before the peers have established a secure
DeRec channel.
channel_id: u64Channel identifier associated with this contact.
This value identifies the communication channel that the creator of this ContactMessage expects to use for the new pairing. After receiving this contact, the initiating party includes this channelId in subsequent protocol messages sent to the contact creator.
The recipient uses this identifier to determine which local key material and pairing state should be used when processing the message.
If an implementation generates multiple pending contact records or multiple encryption key pairs for different pairing attempts, it should retain the mapping from channelId to the corresponding local state so it can process inbound messages without trial decryption across all keys.
This value MUST be unique within the scope required by the implementation to disambiguate concurrent or stored pairing sessions.
nonce: u64Random nonce used to bind the pairing request to this contact exchange.
The initiator includes this value in the pairing request so the creator of the ContactMessage can confirm that the request corresponds to the same out-of-band contact information that was just shared.
This helps the application detect mismatched, stale, or spoofed pairing attempts during the bootstrap phase.
Applications may choose to reveal this nonce only after sufficient out-of-band authentication has taken place.
transport_protocol: Option<TransportProtocol>Transport information used to reach the creator of this contact.
This specifies both:
- the endpoint to which the first protocol message should be sent
- the transport protocol that determines how that endpoint is interpreted and used
The initiating party uses this field to deliver the initial pairing request. Subsequent protocol exchanges may continue using the same transport information or updated transport details, depending on the protocol and application behavior.
timestamp: Option<Timestamp>Timestamp indicating when the sender created this message.
This value is expressed in UTC and can be used for:
- replay detection
- timeout handling
- logging and observability
Trait Implementations§
Source§impl Clone for ContactMessage
impl Clone for ContactMessage
Source§fn clone(&self) -> ContactMessage
fn clone(&self) -> ContactMessage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContactMessage
impl Debug for ContactMessage
Source§impl Default for ContactMessage
impl Default for ContactMessage
Source§impl Hash for ContactMessage
impl Hash for ContactMessage
Source§impl Message for ContactMessage
impl Message for ContactMessage
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
fn encode(&self, buf: &mut impl BufMut) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
fn encode_length_delimited(
&self,
buf: &mut impl BufMut,
) -> Result<(), EncodeError>where
Self: Sized,
Source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Source§fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
fn decode_length_delimited(buf: impl Buf) -> Result<Self, DecodeError>where
Self: Default,
Source§fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self. Read moreSource§fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
fn merge_length_delimited(&mut self, buf: impl Buf) -> Result<(), DecodeError>where
Self: Sized,
self.