diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-05-13 16:54:38 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-05-13 16:54:38 +0200 |
commit | 8bc173039650ee2f8f20de1e75e68a541b9c6b75 (patch) | |
tree | 2057cfa5b189867f86f97186a2ce518b43115bfa /openpgp/src | |
parent | 2c4989b1020051d1a1cc049be0d056e13217c7b4 (diff) |
openpgp: Allow conversion from all keys to Recipient.
Diffstat (limited to 'openpgp/src')
-rw-r--r-- | openpgp/src/serialize/stream.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs index 4b315648..b7b9f608 100644 --- a/openpgp/src/serialize/stream.rs +++ b/openpgp/src/serialize/stream.rs @@ -136,10 +136,7 @@ use crate::{ crypto::SessionKey, packet::prelude::*, packet::signature, - packet::key::{ - PublicParts, - UnspecifiedRole, - }, + packet::key, cert::prelude::*, }; use crate::packet::header::CTB; @@ -1791,12 +1788,15 @@ impl<'a> writer::Stackable<'a, Cookie> for Compressor<'a> { #[derive(Debug)] pub struct Recipient<'a> { keyid: KeyID, - key: &'a Key<PublicParts, UnspecifiedRole>, + key: &'a Key<key::PublicParts, key::UnspecifiedRole>, } -impl<'a> From<&'a Key<PublicParts, UnspecifiedRole>> for Recipient<'a> { - fn from(key: &'a Key<PublicParts, UnspecifiedRole>) -> Self { - Self::new(key.keyid(), key) +impl<'a, P, R> From<&'a Key<P, R>> for Recipient<'a> + where P: key::KeyParts, + R: key::KeyRole, +{ + fn from(key: &'a Key<P, R>) -> Self { + Self::new(key.keyid(), key.parts_as_public().role_as_unspecified()) } } |