summaryrefslogtreecommitdiffstats
path: root/ipc/examples
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 /ipc/examples
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 'ipc/examples')
-rw-r--r--ipc/examples/gpg-agent-decrypt.rs8
-rw-r--r--ipc/examples/gpg-agent-sign.rs4
2 files changed, 7 insertions, 5 deletions
diff --git a/ipc/examples/gpg-agent-decrypt.rs b/ipc/examples/gpg-agent-decrypt.rs
index f59912a5..381bab6d 100644
--- a/ipc/examples/gpg-agent-decrypt.rs
+++ b/ipc/examples/gpg-agent-decrypt.rs
@@ -74,11 +74,13 @@ impl<'a> Helper<'a> {
// Map (sub)KeyIDs to secrets.
let mut keys = HashMap::new();
for cert in certs {
- for (sig, _, key) in cert.keys_all() {
- if sig.map(|s| (s.key_flags().for_storage_encryption()
- || s.key_flags().for_transport_encryption()))
+ for ka in cert.keys_all() {
+ if ka.binding_signature(None)
+ .map(|s| (s.key_flags().for_storage_encryption()
+ || s.key_flags().for_transport_encryption()))
.unwrap_or(false)
{
+ let key = ka.key();
keys.insert(key.keyid(), key.clone().into());
}
}
diff --git a/ipc/examples/gpg-agent-sign.rs b/ipc/examples/gpg-agent-sign.rs
index e0cfeb98..dfc3f304 100644
--- a/ipc/examples/gpg-agent-sign.rs
+++ b/ipc/examples/gpg-agent-sign.rs
@@ -39,8 +39,8 @@ fn main() {
// Construct a KeyPair for every signing-capable (sub)key.
let mut signers = certs.iter().flat_map(|cert| {
- cert.keys_valid().for_signing().filter_map(|(_, _, key)| {
- KeyPair::new(&ctx, key).ok()
+ cert.keys_valid().for_signing().filter_map(|ka| {
+ KeyPair::new(&ctx, ka.key()).ok()
})
}).collect::<Vec<KeyPair>>();