node: Propagate refs update

Signed-off-by: Alexis Sellier <self@cloudhead.io>
This commit is contained in:
Alexis Sellier
2022-09-13 10:16:05 +02:00
parent db6932d58c
commit a70a6822e0
3 changed files with 27 additions and 30 deletions
+10 -3
View File
@@ -178,9 +178,7 @@ impl SignedRefs<Unverified> {
}
pub fn verified(self, signer: &PublicKey) -> Result<SignedRefs<Verified>, crypto::Error> {
let canonical = self.refs.canonical();
match signer.verify(&self.signature, &canonical) {
match self.verify(signer) {
Ok(()) => Ok(SignedRefs {
refs: self.refs,
signature: self.signature,
@@ -189,6 +187,15 @@ impl SignedRefs<Unverified> {
Err(e) => Err(e),
}
}
pub fn verify(&self, signer: &PublicKey) -> Result<(), crypto::Error> {
let canonical = self.refs.canonical();
match signer.verify(&self.signature, &canonical) {
Ok(()) => Ok(()),
Err(e) => Err(e),
}
}
}
impl SignedRefs<Verified> {