add server auth argument to http client

This commit is contained in:
Andrew Dirksen 2019-07-05 16:58:42 -07:00
parent 21dd3d5377
commit f52a8d2c7c

View file

@ -165,11 +165,25 @@ impl WalletCommAdapter for HTTPWalletCommAdapter {
}
}
pub fn post<IN>(url: &str, api_secret: Option<String>, input: &IN) -> Result<String, api::Error>
pub fn post<IN>(
url: &str,
server_auth: &ServerAuth,
api_secret: Option<String>,
input: &IN,
) -> Result<String, api::Error>
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]),
}