summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-04-26 11:22:41 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-04-26 14:35:53 +0200
commit895d1a1bbd0771b9656c3b494f8638e2ababe182 (patch)
treeb629cf27075d0a0628dccb8f5f3f80d398252018 /openpgp
parent49f77b9696dfdd5c8f9c2e2dbcbd46ae57649e4d (diff)
openpgp: Remove TPK::filter_into_tsk().
- We found this function to be not very useful for filtering, and it also turns the TPK into a TSK at the same time, which mixes two concerns. Drop it. We will eventually replace it with something more useful. See also #21.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/tpk/mod.rs30
1 files changed, 0 insertions, 30 deletions
diff --git a/openpgp/src/tpk/mod.rs b/openpgp/src/tpk/mod.rs
index 19a9cbdb..18254a78 100644
--- a/openpgp/src/tpk/mod.rs
+++ b/openpgp/src/tpk/mod.rs
@@ -2843,16 +2843,6 @@ impl TPK {
TSK::from_tpk(self)
}
- /// Cast the public key into a secret key that allows using the secret
- /// parts of the containing keys. Only packets for which `filter` returns
- /// true are included in the TSK.
- pub fn filter_into_tsk<F: Fn(&Packet) -> bool>(self, f: F) -> Result<TSK> {
- let pkts = self.into_packet_pile().into_children().filter(f).collect::<Vec<_>>();
- let pile = PacketPile::from(pkts);
-
- Ok(TSK::from_tpk(TPK::from_packet_pile(pile)?))
- }
-
/// Returns whether at least one of the keys includes a secret
/// part.
pub fn is_tsk(&self) -> bool {
@@ -3912,26 +3902,6 @@ mod test {
}
#[test]
- fn tsk_filter() {
- let (tpk, _) = TPKBuilder::default()
- .add_signing_subkey()
- .add_encryption_subkey()
- .generate().unwrap();
-
- assert!(!tpk.subkeys.is_empty());
-
- // filter subkeys
- let tsk = tpk.filter_into_tsk(|pkt| {
- match pkt {
- &Packet::PublicSubkey(_) | &Packet::SecretSubkey(_) => false,
- _ => true
- }
- }).unwrap();
-
- assert!(tsk.tpk().subkeys.is_empty());
- }
-
- #[test]
fn is_tsk() {
let tpk = TPK::from_bytes(
bytes!("already-revoked.pgp")).unwrap();