pub struct TtkClient { /* private fields */ }Expand description
HTTP/3 client for communicating with TTKServer over QUIC.
Implementations§
Source§impl TtkClient
Connecting to the server and issuing requests.
impl TtkClient
Connecting to the server and issuing requests.
Sourcepub async fn connect(
server_addr: SocketAddr,
server_name: &str,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn connect( server_addr: SocketAddr, server_name: &str, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Connect to the TTKServer at the specified server_addr with the given SNI server_name,
accepting only genuine AWS Nitro attestation (see EnclaveCertVerifier::new).
Sourcepub async fn connect_with_verifier(
server_addr: SocketAddr,
server_name: &str,
verifier: EnclaveCertVerifier,
) -> Result<Self, Box<dyn Error + Send + Sync>>
pub async fn connect_with_verifier( server_addr: SocketAddr, server_name: &str, verifier: EnclaveCertVerifier, ) -> Result<Self, Box<dyn Error + Send + Sync>>
Connect to the TTKServer using a custom attestation verifier policy.
Sourcepub fn server_addr(&self) -> SocketAddr
pub fn server_addr(&self) -> SocketAddr
Return the server address this client is connected to.
Sourcepub fn server_name(&self) -> &str
pub fn server_name(&self) -> &str
Return the SNI server name configured for this client.
Sourcepub fn peer_cert(&self) -> Option<&CertificateDer<'static>>
pub fn peer_cert(&self) -> Option<&CertificateDer<'static>>
Retrieve the peer’s certificate DER bytes if captured.
Sourcepub fn peer_cert_sha256(&self) -> Option<[u8; 32]>
pub fn peer_cert_sha256(&self) -> Option<[u8; 32]>
Retrieve the SHA-256 digest of the peer certificate.
Sourcepub fn peer_cert_sha256_hex(&self) -> Option<String>
pub fn peer_cert_sha256_hex(&self) -> Option<String>
Retrieve the SHA-256 digest of the peer certificate as a hex string.
Sourcepub async fn get(
&mut self,
path: &str,
) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>
pub async fn get( &mut self, path: &str, ) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>
Send an HTTP/3 GET request to the specified path.
Sourcepub async fn post(
&mut self,
path: &str,
body: &[u8],
) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>
pub async fn post( &mut self, path: &str, body: &[u8], ) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>
Send an HTTP/3 POST request with the given body to the specified path.
Sourcepub async fn post_json<T: Serialize + ?Sized>(
&mut self,
path: &str,
value: &T,
) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>
pub async fn post_json<T: Serialize + ?Sized>( &mut self, path: &str, value: &T, ) -> Result<ClientResponse, Box<dyn Error + Send + Sync>>
Send an HTTP/3 POST request with value serialized as a JSON body to the specified path.