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
#[derive(Clone)]
pub struct Key {
pub fingerprint: String,
pub user_ids: Vec<String>,
}
impl Key {
pub fn fingerprint(&self, short: bool) -> String {
if short {
&self.fingerprint[self.fingerprint.len() - 16..]
} else {
&self.fingerprint
}
.trim()
.to_uppercase()
}
pub fn display_user(&self) -> String {
self.user_ids.join("; ")
}
pub fn into_key(self) -> crate::crypto::Key {
crate::crypto::Key::Gpg(self)
}
}
impl PartialEq for Key {
fn eq(&self, other: &Self) -> bool {
self.fingerprint.trim().to_uppercase() == other.fingerprint.trim().to_uppercase()
}
}