Skip to main content

tlsn_core/
lib.rs

1//! TLSNotary core library.
2//!
3//! # Platform Support
4//!
5//! This crate depends on `rand`, which requires `getrandom` for OS-level
6//! randomness. On targets where `getrandom` has no built-in backend (e.g.,
7//! custom or embedded targets), set:
8//!
9//! ```text
10//! RUSTFLAGS='--cfg getrandom_backend="unsupported"'
11//! ```
12//!
13//! This allows compilation to succeed. Note that
14//! [`Blinded::new`](hash::Blinded::new) requires a working RNG and will panic
15//! on unsupported targets.
16
17#![deny(missing_docs, unreachable_pub, unused_must_use)]
18#![deny(clippy::all)]
19#![forbid(unsafe_code)]
20
21pub mod connection;
22#[cfg(any(test, feature = "fixtures"))]
23pub mod fixtures;
24pub mod hash;
25pub mod merkle;
26pub mod transcript;
27pub mod webpki;
28pub use rangeset;
29pub mod config;
30pub(crate) mod display;
31
32use serde::{Deserialize, Serialize};
33
34use crate::{
35    connection::ServerName,
36    transcript::{PartialTranscript, TranscriptCommitment, TranscriptSecret},
37};
38
39/// Prover output.
40#[derive(Serialize, Deserialize)]
41pub struct ProverOutput {
42    /// Transcript commitments.
43    pub transcript_commitments: Vec<TranscriptCommitment>,
44    /// Transcript commitment secrets.
45    pub transcript_secrets: Vec<TranscriptSecret>,
46}
47
48opaque_debug::implement!(ProverOutput);
49
50/// Verifier output.
51#[derive(Serialize, Deserialize)]
52pub struct VerifierOutput {
53    /// Server identity.
54    pub server_name: Option<ServerName>,
55    /// Transcript data.
56    pub transcript: Option<PartialTranscript>,
57    /// Transcript commitments.
58    pub transcript_commitments: Vec<TranscriptCommitment>,
59}
60
61opaque_debug::implement!(VerifierOutput);