summaryrefslogtreecommitdiffstats
path: root/tool
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-12-19 21:47:19 +0100
committerNeal H. Walfield <neal@pep.foundation>2019-12-19 21:51:19 +0100
commitb3ba97146f534ac5cf67db7f72d8a633112d0a18 (patch)
tree581c64936f0a857dd1f0fbf75c7a4ddf243d8656 /tool
parent2b2b5c8905d0e823d03b5ba2a115298e80e08b74 (diff)
openpgp: Change KeyIter to return a struct instead of a tuple.
- A tuple is just an unnamed, inflexible struct. Use a struct instead. - Fixes #400.
Diffstat (limited to 'tool')
-rw-r--r--tool/src/commands/mod.rs6
-rw-r--r--tool/tests/sq-sign.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/tool/src/commands/mod.rs b/tool/src/commands/mod.rs
index 3ecd65ca..1263fa05 100644
--- a/tool/src/commands/mod.rs
+++ b/tool/src/commands/mod.rs
@@ -50,7 +50,7 @@ fn get_signing_keys(certs: &[openpgp::Cert])
'next_cert: for tsk in certs {
for key in tsk.keys_valid()
.for_signing()
- .map(|k| k.2)
+ .map(|ka| ka.key())
{
if let Some(secret) = key.secret() {
let unencrypted = match secret {
@@ -112,7 +112,7 @@ pub fn encrypt(mapping: &mut store::Mapping,
let mut recipient_subkeys: Vec<Recipient> = Vec::new();
for cert in certs.iter() {
let mut count = 0;
- for (_, _, key) in cert.keys_valid().key_flags(mode.clone()) {
+ for key in cert.keys_valid().key_flags(mode.clone()).map(|ka| ka.key()) {
recipient_subkeys.push(key.into());
count += 1;
}
@@ -306,7 +306,7 @@ impl<'a> VerificationHelper for VHelper<'a> {
.flat_map(|cert| {
// Even if a key is revoked or expired, we can still
// use it to verify a message.
- cert.keys_all().map(|(_, _, key)| key.fingerprint().into())
+ cert.keys_all().map(|ka| ka.key().fingerprint().into())
}).collect();
// Explicitly provided keys are trusted.
diff --git a/tool/tests/sq-sign.rs b/tool/tests/sq-sign.rs
index adab186a..0c1fbed8 100644
--- a/tool/tests/sq-sign.rs
+++ b/tool/tests/sq-sign.rs
@@ -208,7 +208,7 @@ fn sq_sign_append_on_compress_then_sign() {
// message by foot.
let tsk = Cert::from_file(&p("keys/dennis-simon-anton-private.pgp"))
.unwrap();
- let key = tsk.keys_all().for_signing().nth(0).unwrap().2;
+ let key = tsk.keys_all().for_signing().nth(0).unwrap().key();
let sec = match key.secret() {
Some(SecretKeyMaterial::Unencrypted(ref u)) => u.clone(),
_ => unreachable!(),