Commit
Author: Dirkjan Ochtman [dirkjan@ochtman.nl]
Hash: e3f11d83e09329f72cb3e2a008b4b8bc23961653
Timestamp: Fri, 09 Dec 2022 10:38:42 +0000 (2 years ago)

+19 -19 +/-3 browse
Expand names of VerifySignature methods
1diff --git a/src/arc/mod.rs b/src/arc/mod.rs
2index 5ad709a..79baf71 100644
3--- a/src/arc/mod.rs
4+++ b/src/arc/mod.rs
5 @@ -82,37 +82,37 @@ impl Default for ChainValidation {
6 }
7
8 impl<'x> VerifySignature for Signature<'x> {
9- fn b(&self) -> &[u8] {
10+ fn signature(&self) -> &[u8] {
11 &self.b
12 }
13
14- fn a(&self) -> Algorithm {
15+ fn algorithm(&self) -> Algorithm {
16 self.a
17 }
18
19- fn s(&self) -> &str {
20+ fn selector(&self) -> &str {
21 &self.s
22 }
23
24- fn d(&self) -> &str {
25+ fn domain(&self) -> &str {
26 &self.d
27 }
28 }
29
30 impl<'x> VerifySignature for Seal<'x> {
31- fn b(&self) -> &[u8] {
32+ fn signature(&self) -> &[u8] {
33 &self.b
34 }
35
36- fn a(&self) -> Algorithm {
37+ fn algorithm(&self) -> Algorithm {
38 self.a
39 }
40
41- fn s(&self) -> &str {
42+ fn selector(&self) -> &str {
43 &self.s
44 }
45
46- fn d(&self) -> &str {
47+ fn domain(&self) -> &str {
48 &self.d
49 }
50 }
51 diff --git a/src/common/verify.rs b/src/common/verify.rs
52index 25fdac5..1399ed8 100644
53--- a/src/common/verify.rs
54+++ b/src/common/verify.rs
55 @@ -11,17 +11,17 @@
56 use crate::{common::crypto::Algorithm, dkim::DomainKey};
57
58 pub(crate) trait VerifySignature {
59- fn s(&self) -> &str;
60+ fn selector(&self) -> &str;
61
62- fn d(&self) -> &str;
63+ fn domain(&self) -> &str;
64
65- fn b(&self) -> &[u8];
66+ fn signature(&self) -> &[u8];
67
68- fn a(&self) -> Algorithm;
69+ fn algorithm(&self) -> Algorithm;
70
71 fn domain_key(&self) -> String {
72- let s = self.s();
73- let d = self.d();
74+ let s = self.selector();
75+ let d = self.domain();
76 let mut key = String::with_capacity(s.len() + d.len() + 13);
77 key.push_str(s);
78 key.push_str("._domainkey.");
79 @@ -31,6 +31,6 @@ pub(crate) trait VerifySignature {
80 }
81
82 fn verify(&self, record: &DomainKey, hh: &[u8]) -> crate::Result<()> {
83- record.p.verify(hh, self.b(), self.a())
84+ record.p.verify(hh, self.signature(), self.algorithm())
85 }
86 }
87 diff --git a/src/dkim/mod.rs b/src/dkim/mod.rs
88index 65374ed..cafe4fc 100644
89--- a/src/dkim/mod.rs
90+++ b/src/dkim/mod.rs
91 @@ -138,19 +138,19 @@ impl From<Algorithm> for HashAlgorithm {
92 }
93
94 impl<'x> VerifySignature for Signature<'x> {
95- fn b(&self) -> &[u8] {
96+ fn signature(&self) -> &[u8] {
97 &self.b
98 }
99
100- fn a(&self) -> Algorithm {
101+ fn algorithm(&self) -> Algorithm {
102 self.a
103 }
104
105- fn s(&self) -> &str {
106+ fn selector(&self) -> &str {
107 &self.s
108 }
109
110- fn d(&self) -> &str {
111+ fn domain(&self) -> &str {
112 &self.d
113 }
114 }