Skip to content

Commit e3d1d0f

Browse files
Merge PR #14
2 parents 8eff265 + f2b3510 commit e3d1d0f

4 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/crypto.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ pub struct PublicKey {
1515

1616
impl PublicKey {
1717
/// Verify that `sig` is a valid signature on `data` from this key.
18+
///
19+
/// # Panics
20+
///
21+
/// Panics if the public key bytes are not a valid Ed25519 public key.
1822
pub fn verify_signature(&self, data: impl AsRef<[u8]>, sig: &Signature) -> bool {
1923
let verifier = ed25519_dalek::VerifyingKey::from_bytes(&self.bytes).unwrap();
2024
let signature = ed25519_dalek::Signature::from(&sig.bytes);

src/log.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
use crate::crypto::{Hash, PublicKey, Signature};
44

5-
#[derive(Debug, Clone, PartialEq)]
65
/// A signed tree head, as returned by the get-tree-head endpoint.
6+
#[derive(Debug, Clone, PartialEq)]
77
pub struct SignedTreeHead {
88
pub size: u64,
99
pub root_hash: Hash,
@@ -19,23 +19,23 @@ pub struct WitnessCosignature {
1919
pub cosignature: Signature,
2020
}
2121

22-
#[derive(Debug, Clone, PartialEq)]
2322
/// An inclusion proof, as returned by the get-inclusion-proof endpoint.
23+
#[derive(Debug, Clone, PartialEq)]
2424
pub struct InclusionProof {
2525
pub leaf_index: u64,
2626
pub node_hashes: Vec<Hash>,
2727
}
2828

29-
#[derive(Debug, Clone, PartialEq)]
3029
/// A protoleaf, which is the data submitted to the add-leaf endpoint of a Sigsum log.
30+
#[derive(Debug, Clone, PartialEq)]
3131
pub struct Protoleaf {
3232
pub message: Hash,
3333
pub signature: Signature,
3434
pub public_key: PublicKey,
3535
}
3636

37-
#[derive(Debug, Clone, PartialEq)]
3837
/// A tree leaf, as stored in a sigsum log.
38+
#[derive(Debug, Clone, PartialEq)]
3939
pub struct Leaf {
4040
pub digest: Hash,
4141
pub signature: Signature,

src/policy/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub enum PolicyError {
159159
#[error("duplicate name")]
160160
DuplicateName(String),
161161

162-
#[error("{0}: no sutch witness")]
162+
#[error("{0}: no such witness")]
163163
UnknownName(String),
164164

165165
#[error("quorum already set")]

src/policy/parsing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ mod tests {
350350
);
351351
insta::assert_snapshot!(
352352
parse_policy("quorum foo").unwrap_err(),
353-
@"line 1: invalid quorum rule: foo: no sutch witness",
353+
@"line 1: invalid quorum rule: foo: no such witness",
354354
);
355355
}
356356

0 commit comments

Comments
 (0)