1use serde::{Deserialize, Serialize};
2
3use crate::{
4 connection::{ServerCertOpening, ServerIdentityProof, ServerName},
5 index::Index,
6 transcript::{
7 encoding::EncodingTree, hash::PlaintextHashSecret, Transcript, TranscriptProofBuilder,
8 },
9};
10
11#[derive(Clone, Serialize, Deserialize)]
13pub struct Secrets {
14 pub(crate) server_name: ServerName,
15 pub(crate) server_cert_opening: ServerCertOpening,
16 pub(crate) encoding_tree: Option<EncodingTree>,
17 pub(crate) plaintext_hashes: Index<PlaintextHashSecret>,
18 pub(crate) transcript: Transcript,
19}
20
21opaque_debug::implement!(Secrets);
22
23impl Secrets {
24 pub fn server_name(&self) -> &ServerName {
26 &self.server_name
27 }
28
29 pub fn transcript(&self) -> &Transcript {
31 &self.transcript
32 }
33
34 pub fn identity_proof(&self) -> ServerIdentityProof {
36 ServerIdentityProof::new(self.server_name.clone(), self.server_cert_opening.clone())
37 }
38
39 pub fn transcript_proof_builder(&self) -> TranscriptProofBuilder<'_> {
41 TranscriptProofBuilder::new(
42 &self.transcript,
43 self.encoding_tree.as_ref(),
44 &self.plaintext_hashes,
45 )
46 }
47}