Skip to content

Commit

Permalink
add server auth argument to http client
Browse files Browse the repository at this point in the history
  • Loading branch information
bddap committed Jul 8, 2019
1 parent 21dd3d5 commit f52a8d2
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions impls/src/adapters/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]),
}

0 comments on commit f52a8d2

Please sign in to comment.