Skip to content

Commit

Permalink
remove incomplete substring proof API
Browse files Browse the repository at this point in the history
  • Loading branch information
sinui0 committed Feb 6, 2024
1 parent 5839d72 commit b053ce5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 32 deletions.
3 changes: 1 addition & 2 deletions tlsn/tlsn-core/src/proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ mod substrings;

pub use session::{default_cert_verifier, SessionInfo, SessionProof, SessionProofError};
pub use substrings::{
SubstringProve, SubstringsProof, SubstringsProofBuilder, SubstringsProofBuilderError,
SubstringsProofError,
SubstringsProof, SubstringsProofBuilder, SubstringsProofBuilderError, SubstringsProofError,
};

use serde::{Deserialize, Serialize};
Expand Down
13 changes: 0 additions & 13 deletions tlsn/tlsn-core/src/proof/substrings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use utils::range::{RangeDisjoint, RangeSet, RangeUnion, ToRangeSet};

/// A trait for proving of typed data contained within a transcript.
pub trait SubstringProve<T> {
/// The error type.
type Error;

/// Proves that the provided value is contained within the transcript.
fn prove(
&mut self,
builder: &mut SubstringsProofBuilder<'_>,
value: &T,
) -> Result<(), Self::Error>;
}

/// An error for [`SubstringsProofBuilder`]
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
Expand Down
23 changes: 6 additions & 17 deletions tlsn/tlsn-formats/src/http/session.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use tlsn_core::{
proof::{SessionProof, SubstringProve, SubstringsProof, SubstringsProofBuilderError},
NotarizedSession,
};
use tlsn_core::{proof::SessionProof, NotarizedSession};

use crate::http::HttpTranscript;

Expand All @@ -27,21 +24,13 @@ impl NotarizedHttpSession {
&self.session
}

/// Returns the HTTP transcript.
pub fn transcript(&self) -> &HttpTranscript {
&self.transcript
}

/// Returns a proof for the TLS session.
pub fn session_proof(&self) -> SessionProof {
self.session.session_proof()
}

/// Builds a substring proof with the provided prover.
pub fn substring_proof<P: SubstringProve<HttpTranscript>>(
&self,
prover: &mut P,
) -> Result<SubstringsProof, P::Error>
where
P::Error: From<SubstringsProofBuilderError>,
{
let mut builder = self.session.data().build_substrings_proof();
prover.prove(&mut builder, &self.transcript)?;
builder.build().map_err(P::Error::from)
}
}

0 comments on commit b053ce5

Please sign in to comment.