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
- Transport Layer: TLS certificate provides connection-level identity
- 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: VerifyingKeyThe 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: SocketAddrThe remote network address of the client
connected_at: SystemTimeTimestamp when the connection was established
Implementations§
Source§impl ConnectionInfo
impl ConnectionInfo
Sourcepub fn new(
transport_public_key: VerifyingKey,
remote_address: SocketAddr,
) -> ConnectionInfo
pub fn new( transport_public_key: VerifyingKey, remote_address: SocketAddr, ) -> ConnectionInfo
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 certificateremote_address- The remote network address of the client
§Returns
A new ConnectionInfo with empty verified keys set and current timestamp
Sourcepub fn with_verified_keys(
transport_public_key: VerifyingKey,
verified_keys: HashSet<VerifyingKey>,
remote_address: SocketAddr,
) -> ConnectionInfo
pub fn with_verified_keys( transport_public_key: VerifyingKey, verified_keys: HashSet<VerifyingKey>, remote_address: SocketAddr, ) -> ConnectionInfo
Create a new ConnectionInfo with verified keys
§Parameters
transport_public_key- The public key from the client’s TLS certificateverified_keys- Set of keys verified during handshakeremote_address- The remote network address of the client
§Returns
A new ConnectionInfo with the provided verified keys and current timestamp
Sourcepub fn add_verified_key(&mut self, public_key: VerifyingKey)
pub fn add_verified_key(&mut self, public_key: VerifyingKey)
Sourcepub fn has_verified_key(&self, public_key: &VerifyingKey) -> bool
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())
));
}Sourcepub fn verified_key_count(&self) -> usize
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
Sourcepub fn verified_keys_hex(&self) -> Vec<String>
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..."]Sourcepub fn verified_keys(&self) -> &HashSet<VerifyingKey>
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
impl Clone for ConnectionInfo
Source§fn clone(&self) -> ConnectionInfo
fn clone(&self) -> ConnectionInfo
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more