mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-09 14:48:13 -05:00
chore(wasm): expose client auth config to js (#927)
This commit is contained in:
@@ -7,12 +7,13 @@ use tsify_next::Tsify;
|
||||
pub struct ProverConfig {
|
||||
pub server_name: String,
|
||||
pub max_sent_data: usize,
|
||||
pub max_sent_records: Option<usize>,
|
||||
pub max_recv_data_online: Option<usize>,
|
||||
pub max_recv_data: usize,
|
||||
pub defer_decryption_from_start: Option<bool>,
|
||||
pub max_sent_records: Option<usize>,
|
||||
pub max_recv_records_online: Option<usize>,
|
||||
pub defer_decryption_from_start: Option<bool>,
|
||||
pub network: NetworkSetting,
|
||||
pub client_auth: Option<(Vec<Vec<u8>>, Vec<u8>)>,
|
||||
}
|
||||
|
||||
impl From<ProverConfig> for tlsn_prover::ProverConfig {
|
||||
@@ -41,10 +42,21 @@ impl From<ProverConfig> for tlsn_prover::ProverConfig {
|
||||
builder.network(value.network.into());
|
||||
let protocol_config = builder.build().unwrap();
|
||||
|
||||
let mut builder = tlsn_prover::TlsConfig::builder();
|
||||
if let Some(cert_key) = value.client_auth {
|
||||
// Try to parse as PEM-encoded.
|
||||
if builder.client_auth_pem(cert_key.clone()).is_err() {
|
||||
// Otherwise assume DER encoding.
|
||||
builder.client_auth(cert_key);
|
||||
}
|
||||
}
|
||||
let tls_config = builder.build().unwrap();
|
||||
|
||||
let mut builder = tlsn_prover::ProverConfig::builder();
|
||||
builder
|
||||
.server_name(value.server_name.as_ref())
|
||||
.protocol_config(protocol_config);
|
||||
.protocol_config(protocol_config)
|
||||
.tls_config(tls_config);
|
||||
|
||||
builder.build().unwrap()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user