diff options
Diffstat (limited to 'guide/src/chapter_01.md')
-rw-r--r-- | guide/src/chapter_01.md | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md index 0c891aab..75bc6896 100644 --- a/guide/src/chapter_01.md +++ b/guide/src/chapter_01.md @@ -126,17 +126,10 @@ fn main() { # // whether the signature checks out mathematically, we apply # // our policy. # match results.into_iter().next() { -# Some(VerificationResult::GoodChecksum { .. }) => +# Some(Ok(_)) => # good = true, -# Some(VerificationResult::NotAlive { .. }) => -# return Err(failure::err_msg( -# "Good, but not alive signature")), -# Some(VerificationResult::MissingKey { .. }) => -# return Err(failure::err_msg( -# "Missing key to verify signature")), -# Some(VerificationResult::Error { error, .. }) => -# return Err(failure::err_msg( -# format!("Bad signature: {:?}", error))), +# Some(Err(e)) => +# return Err(openpgp::Error::from(e).into()), # None => # return Err(failure::err_msg("No signature")), # } @@ -281,17 +274,10 @@ fn generate() -> openpgp::Result<openpgp::Cert> { # // whether the signature checks out mathematically, we apply # // our policy. # match results.into_iter().next() { -# Some(VerificationResult::GoodChecksum { .. }) => +# Some(Ok(_)) => # good = true, -# Some(VerificationResult::NotAlive { .. }) => -# return Err(failure::err_msg( -# "Good, but not alive signature")), -# Some(VerificationResult::MissingKey { .. }) => -# return Err(failure::err_msg( -# "Missing key to verify signature")), -# Some(VerificationResult::Error { error, .. }) => -# return Err(failure::err_msg( -# format!("Bad signature: {:?}", error))), +# Some(Err(e)) => +# return Err(openpgp::Error::from(e).into()), # None => # return Err(failure::err_msg("No signature")), # } @@ -436,17 +422,10 @@ fn sign(policy: &dyn Policy, # // whether the signature checks out mathematically, we apply # // our policy. # match results.into_iter().next() { -# Some(VerificationResult::GoodChecksum { .. }) => +# Some(Ok(_)) => # good = true, -# Some(VerificationResult::NotAlive { .. }) => -# return Err(failure::err_msg( -# "Good, but not alive signature")), -# Some(VerificationResult::MissingKey { .. }) => -# return Err(failure::err_msg( -# "Missing key to verify signature")), -# Some(VerificationResult::Error { error, .. }) => -# return Err(failure::err_msg( -# format!("Bad signature: {:?}", error))), +# Some(Err(e)) => +# return Err(openpgp::Error::from(e).into()), # None => # return Err(failure::err_msg("No signature")), # } @@ -602,17 +581,10 @@ impl<'a> VerificationHelper for Helper<'a> { // whether the signature checks out mathematically, we apply // our policy. match results.into_iter().next() { - Some(VerificationResult::GoodChecksum { .. }) => + Some(Ok(_)) => good = true, - Some(VerificationResult::NotAlive { .. }) => - return Err(failure::err_msg( - "Good, but not alive signature")), - Some(VerificationResult::MissingKey { .. }) => - return Err(failure::err_msg( - "Missing key to verify signature")), - Some(VerificationResult::Error { error, .. }) => - return Err(failure::err_msg( - format!("Bad signature: {:?}", error))), + Some(Err(e)) => + return Err(openpgp::Error::from(e).into()), None => return Err(failure::err_msg("No signature")), } |