Skip to content

Commit acbcb91

Browse files
committed
changed type name from SignedCheckpoint to Checkpoint
Signed-off-by: Victor Embacher <[email protected]>
1 parent 7b8c63f commit acbcb91

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

src/rekor/models/checkpoint.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::str::FromStr;
1515
/// The `note` field stores this data,
1616
/// and its authenticity can be verified with the data in `signature`.
1717
#[derive(Debug, PartialEq, Clone, Eq)]
18-
pub struct SignedCheckpoint {
18+
pub struct Checkpoint {
1919
pub note: CheckpointNote,
2020
pub signature: CheckpointSignature,
2121
}
@@ -67,7 +67,7 @@ pub enum ParseCheckpointError {
6767
DecodeError(String),
6868
}
6969

70-
impl FromStr for SignedCheckpoint {
70+
impl FromStr for Checkpoint {
7171
type Err = ParseCheckpointError;
7272

7373
fn from_str(s: &str) -> Result<Self, Self::Err> {
@@ -82,7 +82,7 @@ impl FromStr for SignedCheckpoint {
8282
let signature = signature.parse()?;
8383
let note = CheckpointNote::unmarshal(note)?;
8484

85-
Ok(SignedCheckpoint { note, signature })
85+
Ok(Checkpoint { note, signature })
8686
}
8787
}
8888

@@ -139,15 +139,15 @@ impl CheckpointNote {
139139
}
140140
}
141141

142-
impl ToString for SignedCheckpoint {
142+
impl ToString for Checkpoint {
143143
fn to_string(&self) -> String {
144144
let note = self.note.marshal();
145145
let signature = self.signature.to_string();
146146
format!("{note}\n{signature}")
147147
}
148148
}
149149

150-
impl SignedCheckpoint {
150+
impl Checkpoint {
151151
/// This method can be used to verify that the checkpoint was issued by the log with the
152152
/// public key `rekor_key`.
153153
pub fn verify_signature(&self, rekor_key: &CosignVerificationKey) -> Result<(), SigstoreError> {
@@ -175,7 +175,7 @@ impl SignedCheckpoint {
175175
}
176176
}
177177

178-
impl Serialize for SignedCheckpoint {
178+
impl Serialize for Checkpoint {
179179
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
180180
where
181181
S: Serializer,
@@ -184,13 +184,13 @@ impl Serialize for SignedCheckpoint {
184184
}
185185
}
186186

187-
impl<'de> Deserialize<'de> for SignedCheckpoint {
187+
impl<'de> Deserialize<'de> for Checkpoint {
188188
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
189189
where
190190
D: Deserializer<'de>,
191191
{
192192
<String>::deserialize(deserializer).and_then(|s| {
193-
SignedCheckpoint::from_str(&s).map_err(|DecodeError(err)| serde::de::Error::custom(err))
193+
Checkpoint::from_str(&s).map_err(|DecodeError(err)| serde::de::Error::custom(err))
194194
})
195195
}
196196
}

src/rekor/models/inclusion_proof.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::crypto::merkle::{
1414
use crate::crypto::CosignVerificationKey;
1515
use crate::errors::SigstoreError;
1616
use crate::errors::SigstoreError::{InclusionProofError, UnexpectedError};
17-
use crate::rekor::models::checkpoint::SignedCheckpoint;
17+
use crate::rekor::models::checkpoint::Checkpoint;
1818
use crate::rekor::TreeSize;
1919
use serde::{Deserialize, Serialize};
2020

@@ -32,7 +32,7 @@ pub struct InclusionProof {
3232
/// A list of hashes required to compute the inclusion proof, sorted in order from leaf to root
3333
#[serde(rename = "hashes")]
3434
pub hashes: Vec<String>,
35-
pub checkpoint: Option<SignedCheckpoint>,
35+
pub checkpoint: Option<Checkpoint>,
3636
}
3737

3838
impl InclusionProof {
@@ -41,7 +41,7 @@ impl InclusionProof {
4141
root_hash: String,
4242
tree_size: TreeSize,
4343
hashes: Vec<String>,
44-
checkpoint: Option<SignedCheckpoint>,
44+
checkpoint: Option<Checkpoint>,
4545
) -> InclusionProof {
4646
InclusionProof {
4747
log_index,

src/rekor/models/log_info.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use crate::crypto::merkle::hex_to_hash_output;
1212
use crate::crypto::CosignVerificationKey;
1313
use crate::errors::SigstoreError;
14-
use crate::rekor::models::checkpoint::SignedCheckpoint;
14+
use crate::rekor::models::checkpoint::Checkpoint;
1515
use crate::rekor::models::ConsistencyProof;
1616
use crate::rekor::TreeSize;
1717
use serde::{Deserialize, Serialize};
@@ -26,7 +26,7 @@ pub struct LogInfo {
2626
pub tree_size: TreeSize,
2727
/// The current signed tree head
2828
#[serde(rename = "signedTreeHead")]
29-
pub signed_tree_head: SignedCheckpoint,
29+
pub signed_tree_head: Checkpoint,
3030
/// The current treeID
3131
#[serde(rename = "treeID")]
3232
pub tree_id: Option<String>,
@@ -35,11 +35,7 @@ pub struct LogInfo {
3535
}
3636

3737
impl LogInfo {
38-
pub fn new(
39-
root_hash: String,
40-
tree_size: TreeSize,
41-
signed_tree_head: SignedCheckpoint,
42-
) -> LogInfo {
38+
pub fn new(root_hash: String, tree_size: TreeSize, signed_tree_head: Checkpoint) -> LogInfo {
4339
LogInfo {
4440
root_hash,
4541
tree_size,

0 commit comments

Comments
 (0)