ConnectionInfo

Struct ConnectionInfo 

Source
pub struct ConnectionInfo {
    pub transport_public_key: VerifyingKey,
    pub verified_keys: HashSet<VerifyingKey>,
    pub remote_address: SocketAddr,
    pub connected_at: SystemTime,
}
Expand description

Connection information with verified cryptographic keys

This structure tracks both transport-level and application-level authentication for active connections in the Zoe protocol. It provides the foundation for connection-scoped message authentication across multiple key algorithms.

§Authentication Layers

  1. Transport Layer: TLS certificate provides connection-level identity
  2. Application Layer: Verified keys provide message-level authentication

The separation allows for different keys to be used for different purposes while maintaining a clear security model across Ed25519 and ML-DSA algorithms.

Fields§

§transport_public_key: VerifyingKey

The public key from the client’s TLS certificate

This key identifies the client at the transport layer and is used for QUIC connection authentication. It remains constant for the lifetime of the connection. Supports Ed25519, ML-DSA-44, ML-DSA-65, ML-DSA-87.

§verified_keys: HashSet<VerifyingKey>

Set of public keys verified during challenge handshake

These keys were proven during the initial handshake and can be used for message-level authentication. The set is populated during the challenge phase and remains immutable for the connection lifetime.

Supports all key algorithms: Ed25519, ML-DSA-44, ML-DSA-65, ML-DSA-87. Use has_verified_key() for membership testing.

§remote_address: SocketAddr

The remote network address of the client

§connected_at: SystemTime

Timestamp when the connection was established

Implementations§

Source§

impl ConnectionInfo

Source

pub fn new( transport_public_key: VerifyingKey, remote_address: SocketAddr, ) -> Self

Create a new ConnectionInfo with the given transport public key and remote address

§Parameters
  • transport_public_key - The public key from the client’s TLS certificate
  • remote_address - The remote network address of the client
§Returns

A new ConnectionInfo with empty verified keys set and current timestamp

Source

pub fn with_verified_keys( transport_public_key: VerifyingKey, verified_keys: HashSet<VerifyingKey>, remote_address: SocketAddr, ) -> Self

Create a new ConnectionInfo with verified keys

§Parameters
  • transport_public_key - The public key from the client’s TLS certificate
  • verified_keys - Set of keys verified during handshake
  • remote_address - The remote network address of the client
§Returns

A new ConnectionInfo with the provided verified keys and current timestamp

Source

pub fn add_verified_key(&mut self, public_key: VerifyingKey)

Add a verified key to this connection

§Parameters
  • public_key - The public key to add
Source

pub fn has_verified_key(&self, public_key: &VerifyingKey) -> bool

Check if a specific public key has been verified for this connection

This is the primary method for checking message authentication permissions. Services should call this before processing messages that require specific key possession proofs.

§Parameters
  • public_key - The public key to check
§Returns

true if the key was successfully verified during handshake, false otherwise

§Example
use zoe_wire_protocol::ConnectionInfo;
use std::net::SocketAddr;

// In a message service handler
if !connection_info.has_verified_key(required_key) {
    return Err(format!(
        "Verification required for key: {}",
        hex::encode(required_key.id())
    ));
}
Source

pub fn verified_key_count(&self) -> usize

Get the number of verified keys for this connection

Useful for logging and debugging connection capabilities.

§Returns

The count of keys that were successfully verified during handshake

Source

pub fn verified_keys_hex(&self) -> Vec<String>

Get all verified public keys as hex strings (for logging/debugging)

Returns a vector of hex-encoded key IDs for human-readable logging. Uses the key’s ID (which is a hash for ML-DSA keys or the key bytes for Ed25519).

§Returns

Vector of hex strings representing the key IDs of each verified key

§Example
use zoe_wire_protocol::ConnectionInfo;

let key_previews = connection_info.verified_keys_hex();
println!("Connection has verified keys: {:?}", key_previews);
// Output: ["a1b2c3d4e5f6g7h8...", "9a8b7c6d5e4f3g2h..."]
Source

pub fn verified_keys(&self) -> &HashSet<VerifyingKey>

Get a reference to the verified keys set

§Returns

A reference to the HashSet containing all verified keys

Trait Implementations§

Source§

impl Clone for ConnectionInfo

Source§

fn clone(&self) -> ConnectionInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConnectionInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

§

impl<T> Classify for T

§

type Classified = T

§

fn classify(self) -> T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

§

impl<T> Declassify for T

§

type Declassified = T

§

fn declassify(self) -> T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> DartSafe for T

§

impl<T> TaskRetFutTrait for T
where T: Send,