Skip to main content

certran_logs/ctlog/v1/
model.rs

1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug)]
4pub struct AddChainResponse {
5    /// The version of the SignedCertificateTimestamp
6    /// structure, in decimal.  A compliant v1 implementation MUST NOT
7    /// expect this to be 0 (i.e., v1).
8    pub sct_version: u8,
9
10    /// The log ID, base64 encoded.  Since log clients who request an
11    /// SCT for inclusion in TLS handshakes are not required to verify
12    /// it, we do not assume they know the ID of the log.
13    pub id: String,
14
15    /// The SCT timestamp, in decimal.
16    pub timestamp: u64,
17
18    /// An opaque type for future expansion.  It is likely
19    /// that not all participants will need to understand data in this
20    /// field.  Logs should set this to the empty string.  Clients
21    /// should decode the base64-encoded data and include it in the
22    /// SCT.
23    pub extensions: String,
24
25    /// The SCT signature, base64 encoded.
26    pub signature: String,
27}
28
29#[derive(Serialize, Deserialize, Debug)]
30pub struct GetSthResponse {
31    /// The size of the tree, in entries, in decimal.
32    pub tree_size: u64,
33
34    /// The timestamp, in decimal.
35    pub timestamp: u64,
36
37    /// The Merkle Tree Hash of the tree, in base64.
38    pub sha256_root_hash: String,
39
40    /// A TreeHeadSignature for the above data.
41    pub tree_head_signature: String,
42}
43
44#[derive(Serialize, Deserialize, Debug)]
45pub struct GetSthConsistencyResponse {
46    /// An array of Merkle Tree nodes, base64 encoded.
47    pub consistency: Vec<String>,
48}
49
50#[derive(Serialize, Deserialize, Debug)]
51pub struct GetProofByHashResponse {
52    /// The 0-based index of the end entity corresponding to
53    /// the "hash" parameter.
54    pub leaf_index: u64,
55
56    /// An array of base64-encoded Merkle Tree nodes proving
57    /// the inclusion of the chosen certificate.
58    pub audit_path: Vec<String>,
59}
60
61#[derive(Serialize, Deserialize, Debug, Clone)]
62pub struct Entry {
63    /// The base64-encoded MerkleTreeLeaf structure.
64    pub leaf_input: String,
65
66    /// The base64-encoded unsigned data pertaining to the
67    /// log entry.  In the case of an X509ChainEntry, this is the
68    /// "certificate_chain".  In the case of a PrecertChainEntry,
69    /// this is the whole "PrecertChainEntry".
70    pub extra_data: String,
71}
72
73#[derive(Serialize, Deserialize, Debug)]
74pub struct GetEntriesResponse {
75    /// An array of entries.
76    ///
77    /// see [Entry] for more details.
78    pub entries: Vec<Entry>,
79}
80
81#[derive(Serialize, Deserialize, Debug)]
82pub struct GetRootsResponse {
83    /// An array of base64-encoded root certificates that
84    /// are acceptable to the log.
85    pub certificates: Vec<String>,
86}
87
88#[derive(Serialize, Deserialize, Debug)]
89pub struct GetEntryAndProofResponse {
90    /// The base64-encoded MerkleTreeLeaf structure.
91    pub leaf_input: String,
92
93    /// The base64-encoded unsigned data, same as in [Entry].
94    pub extra_data: String,
95
96    /// An array of base64-encoded Merkle Tree nodes proving
97    /// the inclusion of the chosen certificate.
98    pub audit_path: Vec<String>,
99}