mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-09 14:48:13 -05:00
fix: expose network setting type in WASM (#880)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::types::NetworkSetting;
|
||||
use serde::Deserialize;
|
||||
use tlsn_common::config::{NetworkSetting, ProtocolConfig};
|
||||
use tlsn_common::config::ProtocolConfig;
|
||||
use tsify_next::Tsify;
|
||||
|
||||
#[derive(Debug, Tsify, Deserialize)]
|
||||
#[tsify(from_wasm_abi)]
|
||||
pub struct ProverConfig {
|
||||
@@ -38,7 +38,7 @@ impl From<ProverConfig> for tlsn_prover::ProverConfig {
|
||||
builder.defer_decryption_from_start(value);
|
||||
}
|
||||
|
||||
builder.network(value.network);
|
||||
builder.network(value.network.into());
|
||||
let protocol_config = builder.build().unwrap();
|
||||
|
||||
let mut builder = tlsn_prover::ProverConfig::builder();
|
||||
|
||||
@@ -324,3 +324,21 @@ impl From<&tlsn_core::signing::VerifyingKey> for VerifyingKey {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Tsify, Deserialize)]
|
||||
#[tsify(from_wasm_abi)]
|
||||
pub enum NetworkSetting {
|
||||
/// Prefers a bandwidth-heavy protocol.
|
||||
Bandwidth,
|
||||
/// Prefers a latency-heavy protocol.
|
||||
Latency,
|
||||
}
|
||||
|
||||
impl From<NetworkSetting> for tlsn_common::config::NetworkSetting {
|
||||
fn from(value: NetworkSetting) -> Self {
|
||||
match value {
|
||||
NetworkSetting::Bandwidth => Self::Bandwidth,
|
||||
NetworkSetting::Latency => Self::Latency,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user