From f52a8d2c7cdfb8583af5716ad621eb560811d6ee Mon Sep 17 00:00:00 2001 From: Andrew Dirksen Date: Fri, 5 Jul 2019 16:58:42 -0700 Subject: [PATCH] add server auth argument to http client --- impls/src/adapters/http.rs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/impls/src/adapters/http.rs b/impls/src/adapters/http.rs index fbefcc89..4ea96cef 100644 --- a/impls/src/adapters/http.rs +++ b/impls/src/adapters/http.rs @@ -165,11 +165,25 @@ impl WalletCommAdapter for HTTPWalletCommAdapter { } } -pub fn post(url: &str, api_secret: Option, input: &IN) -> Result +pub fn post( + url: &str, + server_auth: &ServerAuth, + api_secret: Option, + input: &IN, +) -> Result where IN: Serialize, { - let req = api::client::create_post_request(url, api_secret, input)?; - let res = api::client::send_request(req)?; - Ok(res) + // need to configure https client to use a custom TlsServerVerifier that checks to server pk + // against ServerAuth + unimplemented!() + // let req = api::client::create_post_request(url, api_secret, input)?; + // let res = api::client::send_request(req)?; + // Ok(res) +} + +/// Setting to enable or disable server authentication using the servers know public key. +enum ServerAuth { + AllowUnauthenticated, + AllowPublicKey([u8; 32]), }