From d83e738f6e409964d5472ac1dc2becced6416782 Mon Sep 17 00:00:00 2001 From: joe Date: Mon, 28 Apr 2014 23:22:39 -0400 Subject: documented KeyFilter --- KeyRing.hs | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/KeyRing.hs b/KeyRing.hs index c14343f..09fa19c 100644 --- a/KeyRing.hs +++ b/KeyRing.hs @@ -175,9 +175,14 @@ data Access = AutoAccess -- ^ secret or public as appropriate based on existing | Sec -- ^ secret information | Pub -- ^ public information --- | TODO: Implement keyfilters other than KF_None and KF_All --- This should make kImports obsolete. -data KeyFilter = KF_None | KF_Match String | KF_Subkeys | KF_Authentic | KF_All +data KeyFilter = KF_None -- ^ No keys will be imported. + | KF_Match String -- ^ Only the key that matches the spec will be imported. + | KF_Subkeys -- ^ Subkeys will be imported if their owner key is + -- already in the ring. TODO: Even if their signatures + -- are bad? + | KF_Authentic -- ^ Keys are imported if they belong to an authenticated + -- identity (signed or self-authenticating). + | KF_All -- ^ All keys will be imported. data StreamInfo = StreamInfo { access :: Access @@ -234,14 +239,6 @@ noManip _ _ = [] data KeyRingOperation = KeyRingOperation { kFiles :: Map.Map InputFile StreamInfo , kImports :: Map.Map InputFile (KeyRingRuntime -> KeyData -> Maybe Bool) - -- ^ - -- Indicates what pgp master keys get written to which keyring files. - -- Just True = import public key - -- Just False = import secret key - -- Nothing = do not import - -- Note that subkeys will always be imported if their owner key is - -- already in the ring. - -- TODO: Even if their signatures are bad? , kManip :: KeyRingRuntime -> KeyData -> [PacketUpdate]--[KeyRingAddress PacketUpdate] , homeSpec :: Maybe String } @@ -1301,12 +1298,18 @@ showPacket p | isKey p = (if is_subkey p showPacket0 p = concat . take 1 $ words (show p) +-- | returns Just True so as to indicate that +-- the public portions of keys will be imported importPublic :: Maybe Bool importPublic = Just True +-- | returns False True so as to indicate that +-- the public portions of keys will be imported importSecret :: Maybe Bool importSecret = Just False +-- | returns Nothing to indicate that no new master +-- keys will be imported. subkeysOnly :: Maybe Bool subkeysOnly = Nothing -- cgit v1.2.3