1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
use bamboo_rs_core_ed25519_yasmf::entry::is_lipmaa_required;
use crate::entry::{LogId, SeqNum, Signature};
use crate::hash::Hash;
use crate::identity::PublicKey;
pub trait AsEntry {
fn public_key(&self) -> &PublicKey;
fn log_id(&self) -> &LogId;
fn seq_num(&self) -> &SeqNum;
fn skiplink(&self) -> Option<&Hash>;
fn backlink(&self) -> Option<&Hash>;
fn payload_size(&self) -> u64;
fn payload_hash(&self) -> &Hash;
fn signature(&self) -> &Signature;
fn seq_num_backlink(&self) -> Option<SeqNum> {
self.seq_num().backlink_seq_num()
}
fn seq_num_skiplink(&self) -> Option<SeqNum> {
self.seq_num().skiplink_seq_num()
}
fn is_skiplink_required(&self) -> bool {
is_lipmaa_required(self.seq_num().as_u64())
}
}
pub trait AsEncodedEntry {
fn hash(&self) -> Hash;
#[allow(clippy::wrong_self_convention)]
fn into_bytes(&self) -> Vec<u8>;
fn size(&self) -> u64;
#[allow(clippy::wrong_self_convention)]
fn into_hex(&self) -> String {
hex::encode(self.into_bytes())
}
}