@@ -135,10 +135,6 @@ impl AttestedTlsServer {
135135 pub async fn handle_connection (
136136 & self ,
137137 inbound : TcpStream ,
138- // acceptor: TlsAcceptor,
139- // cert_chain: Vec<CertificateDer<'static>>,
140- // attestation_generator: AttestationGenerator,
141- // attestation_verifier: AttestationVerifier,
142138 ) -> Result <
143139 (
144140 tokio_rustls:: server:: TlsStream < tokio:: net:: TcpStream > ,
@@ -224,10 +220,11 @@ pub struct AttestedTlsClient {
224220}
225221
226222impl std:: fmt:: Debug for AttestedTlsClient {
227- // TODO add other fields
228223 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
229224 f. debug_struct ( "AttestedTlsClient" )
230225 . field ( "attestation_verifier" , & self . attestation_verifier )
226+ . field ( "attestation_generator" , & self . attestation_generator )
227+ . field ( "cert_chain" , & self . cert_chain )
231228 . finish ( )
232229 }
233230}
@@ -297,7 +294,7 @@ impl AttestedTlsClient {
297294 } )
298295 }
299296
300- /// Connect to the attested-tls-server, do TLS handshake and remote attestation
297+ /// Connect to an attested-tls-server, do TLS handshake and attestation exchange
301298 pub async fn connect (
302299 & self ,
303300 target : String ,
@@ -376,7 +373,7 @@ impl AttestedTlsClient {
376373 }
377374}
378375
379- /// Just get the attested remote certificate, with no client authentication
376+ /// A client which just gets the attested remote certificate, with no client authentication
380377pub async fn get_tls_cert (
381378 server_name : String ,
382379 attestation_verifier : AttestationVerifier ,
@@ -405,6 +402,7 @@ pub async fn get_tls_cert(
405402 get_tls_cert_with_config ( server_name, attestation_verifier, client_config. into ( ) ) . await
406403}
407404
405+ // TODO this could use AttestedTlsClient to avoid repeating code
408406pub ( crate ) async fn get_tls_cert_with_config (
409407 server_name : String ,
410408 attestation_verifier : AttestationVerifier ,
@@ -497,10 +495,6 @@ pub enum AttestedTlsError {
497495 IntConversion ( #[ from] TryFromIntError ) ,
498496 #[ error( "Bad host name: {0}" ) ]
499497 BadDnsName ( #[ from] tokio_rustls:: rustls:: pki_types:: InvalidDnsNameError ) ,
500- #[ error( "HTTP: {0}" ) ]
501- Hyper ( #[ from] hyper:: Error ) ,
502- #[ error( "JSON: {0}" ) ]
503- Json ( #[ from] serde_json:: Error ) ,
504498 #[ error( "Serialization: {0}" ) ]
505499 Serialization ( #[ from] parity_scale_codec:: Error ) ,
506500 #[ error( "Protocol negotiation failed - remote peer does not support this protocol" ) ]
0 commit comments