implement SignedPod (non-mock) using proof-based signatures (#160)
This commit is contained in:
parent
30f26a94ef
commit
d6033b7090
9 changed files with 259 additions and 60 deletions
|
|
@ -249,7 +249,7 @@ impl SignedPod {
|
|||
pub fn origin(&self) -> Origin {
|
||||
Origin::new(PodClass::Signed, self.id())
|
||||
}
|
||||
pub fn verify(&self) -> bool {
|
||||
pub fn verify(&self) -> Result<()> {
|
||||
self.pod.verify()
|
||||
}
|
||||
pub fn kvs(&self) -> HashMap<Hash, middleware::Value> {
|
||||
|
|
@ -808,7 +808,7 @@ pub struct MainPod {
|
|||
impl fmt::Display for MainPod {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
writeln!(f, "MainPod: {}", self.pod.id())?;
|
||||
writeln!(f, " valid? {}", self.pod.verify())?;
|
||||
writeln!(f, " valid? {}", self.pod.verify().is_ok())?;
|
||||
writeln!(f, " statements:")?;
|
||||
for st in &self.pod.pub_statements() {
|
||||
writeln!(f, " - {}", st)?;
|
||||
|
|
|
|||
|
|
@ -255,7 +255,7 @@ mod tests {
|
|||
|
||||
assert_eq!(pod.kvs, deserialized.kvs);
|
||||
assert_eq!(pod.origin(), deserialized.origin());
|
||||
assert_eq!(pod.verify(), deserialized.verify());
|
||||
assert_eq!(pod.verify().is_ok(), deserialized.verify().is_ok());
|
||||
assert_eq!(pod.id(), deserialized.id())
|
||||
}
|
||||
|
||||
|
|
@ -289,6 +289,9 @@ mod tests {
|
|||
|
||||
assert_eq!(kyc_pod.public_statements, deserialized.public_statements);
|
||||
assert_eq!(kyc_pod.pod.id(), deserialized.pod.id());
|
||||
assert_eq!(kyc_pod.pod.verify(), deserialized.pod.verify());
|
||||
assert_eq!(
|
||||
kyc_pod.pod.verify().is_ok(),
|
||||
deserialized.pod.verify().is_ok()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue