mirror of
https://github.com/tlsnotary/tlsn-js.git
synced 2026-01-09 20:47:55 -05:00
reorganized projects + debug data at prover side
This commit is contained in:
@@ -133,8 +133,8 @@ async fn prover<T: AsyncWrite + AsyncRead + Send + Unpin + 'static>(
|
||||
// Create proof for the Verifier.
|
||||
info!("Create proof for the Verifier");
|
||||
let mut prover = prover_task.await.unwrap().unwrap().start_prove();
|
||||
redact_and_reveal_received_data(&mut prover);
|
||||
redact_and_reveal_sent_data(&mut prover);
|
||||
redact_and_reveal_received_data(&mut prover);
|
||||
prover.prove().await.unwrap();
|
||||
|
||||
// Finalize.
|
||||
@@ -148,6 +148,7 @@ fn redact_and_reveal_received_data(prover: &mut Prover<Prove>) {
|
||||
|
||||
// Get the homeworld from the received data.
|
||||
let received_string = String::from_utf8(prover.recv_transcript().data().to_vec()).unwrap();
|
||||
debug!("Received data: {}", received_string);
|
||||
let re = Regex::new(r#""homeworld"\s?:\s?"(.*?)""#).unwrap();
|
||||
let homeworld_match = re.captures(&received_string).unwrap().get(1).unwrap();
|
||||
|
||||
@@ -166,6 +167,8 @@ fn redact_and_reveal_sent_data(prover: &mut Prover<Prove>) {
|
||||
let sent_string = String::from_utf8(prover.sent_transcript().data().to_vec()).unwrap();
|
||||
let secret_start = sent_string.find(SECRET).unwrap();
|
||||
|
||||
debug!("Send data: {}", sent_string);
|
||||
|
||||
// Reveal everything except for the SECRET.
|
||||
_ = prover.reveal(0..secret_start, Direction::Sent);
|
||||
_ = prover.reveal(
|
||||
@@ -130,8 +130,8 @@ pub async fn interactive_prover(
|
||||
})?
|
||||
.map_err(|e| JsValue::from_str(&format!("Could not get Prover: {:?}", e)))?;
|
||||
let mut prover = prover.start_prove();
|
||||
redact_and_reveal_received_data(&mut prover);
|
||||
redact_and_reveal_sent_data(&mut prover);
|
||||
redact_and_reveal_received_data(&mut prover);
|
||||
prover.prove().await.unwrap();
|
||||
|
||||
// Finalize.
|
||||
@@ -146,6 +146,7 @@ fn redact_and_reveal_received_data(prover: &mut Prover<Prove>) {
|
||||
|
||||
// Get the homeworld from the received data.
|
||||
let received_string = String::from_utf8(prover.recv_transcript().data().to_vec()).unwrap();
|
||||
debug!("Received data: {}", received_string);
|
||||
let re = Regex::new(r#""homeworld"\s?:\s?"(.*?)""#).unwrap();
|
||||
let commit_hash_match = re.captures(&received_string).unwrap().get(1).unwrap();
|
||||
|
||||
@@ -163,6 +164,7 @@ fn redact_and_reveal_sent_data(prover: &mut Prover<Prove>) {
|
||||
|
||||
let sent_string = String::from_utf8(prover.sent_transcript().data().to_vec()).unwrap();
|
||||
let secret_start = sent_string.find(SECRET).unwrap();
|
||||
debug!("Send data: {}", sent_string);
|
||||
|
||||
// Reveal everything except for the SECRET.
|
||||
_ = prover.reveal(0..secret_start, Direction::Sent);
|
||||
|
||||
Reference in New Issue
Block a user