diff options
author | Neal H. Walfield <neal@pep.foundation> | 2019-08-12 13:39:14 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2019-08-23 19:15:13 +0200 |
commit | 05cf492f3417fd61f6b1e7dc4913a16fd5f201ea (patch) | |
tree | eca0c2e0481e10b54884a766e7e864020089fe84 /ipc/examples | |
parent | 102dea398e920e91b34e5602033c2e7e53c50bb1 (diff) |
openpgp: Use marker types to denote a Key's type.
- In addition to providing some added protection, this allows us to
implement 'From<Key<_, _>> for Packet'.
Diffstat (limited to 'ipc/examples')
-rw-r--r-- | ipc/examples/gpg-agent-decrypt.rs | 4 | ||||
-rw-r--r-- | ipc/examples/gpg-agent-sign.rs | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/ipc/examples/gpg-agent-decrypt.rs b/ipc/examples/gpg-agent-decrypt.rs index 8a783f7a..0faa57a3 100644 --- a/ipc/examples/gpg-agent-decrypt.rs +++ b/ipc/examples/gpg-agent-decrypt.rs @@ -63,7 +63,7 @@ fn main() { /// verification policy. struct Helper<'a> { ctx: &'a Context, - keys: HashMap<openpgp::KeyID, openpgp::packet::Key>, + keys: HashMap<openpgp::KeyID, openpgp::packet::key::UnspecifiedPublic>, } impl<'a> Helper<'a> { @@ -77,7 +77,7 @@ impl<'a> Helper<'a> { || s.key_flags().can_encrypt_for_transport())) .unwrap_or(false) { - keys.insert(key.keyid(), key.clone()); + keys.insert(key.keyid(), key.clone().into()); } } } diff --git a/ipc/examples/gpg-agent-sign.rs b/ipc/examples/gpg-agent-sign.rs index 43435b46..e7dd6e53 100644 --- a/ipc/examples/gpg-agent-sign.rs +++ b/ipc/examples/gpg-agent-sign.rs @@ -41,11 +41,11 @@ fn main() { // Construct a KeyPair for every signing-capable (sub)key. let mut keypairs = tpks.iter().flat_map(|tpk| tpk.keys_valid().signing_capable().filter_map(|(_, _, key)| { KeyPair::new(&ctx, key).ok() - })).collect::<Vec<KeyPair>>(); + })).collect::<Vec<KeyPair<_>>>(); // Well, this is awkward... let signers = keypairs.iter_mut() - .map(|s| -> &mut dyn openpgp::crypto::Signer { s }) + .map(|s| -> &mut dyn openpgp::crypto::Signer<_> { s }) .collect(); // Compose a writer stack corresponding to the output format and |