mirror of
https://github.com/tlsnotary/tlsn.git
synced 2026-01-08 22:28:15 -05:00
feat(tlsn): serializable config (#968)
This commit is contained in:
@@ -24,7 +24,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Configuration to prove information to the verifier.
|
/// Configuration to prove information to the verifier.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct ProveConfig {
|
pub struct ProveConfig {
|
||||||
server_identity: bool,
|
server_identity: bool,
|
||||||
transcript: Option<PartialTranscript>,
|
transcript: Option<PartialTranscript>,
|
||||||
@@ -163,7 +163,7 @@ enum ProveConfigBuilderErrorRepr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration to verify information from the prover.
|
/// Configuration to verify information from the prover.
|
||||||
#[derive(Debug, Default, Clone)]
|
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
|
||||||
pub struct VerifyConfig {}
|
pub struct VerifyConfig {}
|
||||||
|
|
||||||
impl VerifyConfig {
|
impl VerifyConfig {
|
||||||
@@ -210,6 +210,7 @@ pub struct ProvePayload {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Prover output.
|
/// Prover output.
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct ProverOutput {
|
pub struct ProverOutput {
|
||||||
/// Transcript commitments.
|
/// Transcript commitments.
|
||||||
pub transcript_commitments: Vec<TranscriptCommitment>,
|
pub transcript_commitments: Vec<TranscriptCommitment>,
|
||||||
@@ -220,6 +221,7 @@ pub struct ProverOutput {
|
|||||||
opaque_debug::implement!(ProverOutput);
|
opaque_debug::implement!(ProverOutput);
|
||||||
|
|
||||||
/// Verifier output.
|
/// Verifier output.
|
||||||
|
#[derive(Serialize, Deserialize)]
|
||||||
pub struct VerifierOutput {
|
pub struct VerifierOutput {
|
||||||
/// Server identity.
|
/// Server identity.
|
||||||
pub server_name: Option<ServerName>,
|
pub server_name: Option<ServerName>,
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ pub enum TranscriptSecret {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration for transcript commitments.
|
/// Configuration for transcript commitments.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct TranscriptCommitConfig {
|
pub struct TranscriptCommitConfig {
|
||||||
encoding_hash_alg: HashAlgId,
|
encoding_hash_alg: HashAlgId,
|
||||||
has_encoding: bool,
|
has_encoding: bool,
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ impl ProtocolConfig {
|
|||||||
|
|
||||||
/// Protocol configuration validator used by checker (i.e. verifier) to perform
|
/// Protocol configuration validator used by checker (i.e. verifier) to perform
|
||||||
/// compatibility check with the peer's (i.e. the prover's) configuration.
|
/// compatibility check with the peer's (i.e. the prover's) configuration.
|
||||||
#[derive(derive_builder::Builder, Clone, Debug)]
|
#[derive(derive_builder::Builder, Clone, Debug, Serialize, Deserialize)]
|
||||||
pub struct ProtocolConfigValidator {
|
pub struct ProtocolConfigValidator {
|
||||||
/// Maximum number of bytes that can be sent.
|
/// Maximum number of bytes that can be sent.
|
||||||
max_sent_data: usize,
|
max_sent_data: usize,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use mpc_tls::Config;
|
use mpc_tls::Config;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use tlsn_core::{
|
use tlsn_core::{
|
||||||
connection::ServerName,
|
connection::ServerName,
|
||||||
webpki::{CertificateDer, PrivateKeyDer, RootCertStore},
|
webpki::{CertificateDer, PrivateKeyDer, RootCertStore},
|
||||||
@@ -7,7 +8,7 @@ use tlsn_core::{
|
|||||||
use crate::config::{NetworkSetting, ProtocolConfig};
|
use crate::config::{NetworkSetting, ProtocolConfig};
|
||||||
|
|
||||||
/// Configuration for the prover.
|
/// Configuration for the prover.
|
||||||
#[derive(Debug, Clone, derive_builder::Builder)]
|
#[derive(Debug, Clone, derive_builder::Builder, Serialize, Deserialize)]
|
||||||
pub struct ProverConfig {
|
pub struct ProverConfig {
|
||||||
/// The server DNS name.
|
/// The server DNS name.
|
||||||
#[builder(setter(into))]
|
#[builder(setter(into))]
|
||||||
@@ -66,7 +67,7 @@ impl ProverConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Configuration for the prover's TLS connection.
|
/// Configuration for the prover's TLS connection.
|
||||||
#[derive(Default, Debug, Clone)]
|
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct TlsConfig {
|
pub struct TlsConfig {
|
||||||
/// Root certificates.
|
/// Root certificates.
|
||||||
root_store: Option<RootCertStore>,
|
root_store: Option<RootCertStore>,
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
use std::fmt::{Debug, Formatter, Result};
|
use std::fmt::{Debug, Formatter, Result};
|
||||||
|
|
||||||
use crate::config::{NetworkSetting, ProtocolConfig, ProtocolConfigValidator};
|
|
||||||
use mpc_tls::Config;
|
use mpc_tls::Config;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
use tlsn_core::webpki::RootCertStore;
|
use tlsn_core::webpki::RootCertStore;
|
||||||
|
|
||||||
|
use crate::config::{NetworkSetting, ProtocolConfig, ProtocolConfigValidator};
|
||||||
|
|
||||||
/// Configuration for the [`Verifier`](crate::tls::Verifier).
|
/// Configuration for the [`Verifier`](crate::tls::Verifier).
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(derive_builder::Builder)]
|
#[derive(derive_builder::Builder, Serialize, Deserialize)]
|
||||||
#[builder(pattern = "owned")]
|
#[builder(pattern = "owned")]
|
||||||
pub struct VerifierConfig {
|
pub struct VerifierConfig {
|
||||||
protocol_config_validator: ProtocolConfigValidator,
|
protocol_config_validator: ProtocolConfigValidator,
|
||||||
|
|||||||
Reference in New Issue
Block a user