summaryrefslogtreecommitdiff
path: root/KeyRing.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-05-02 23:59:54 -0400
committerjoe <joe@jerkface.net>2014-05-02 23:59:54 -0400
commit4f9d3fc480a1bace6235aca3197febb7a3eb10cf (patch)
treebf9391f3503646275c55c9aa574aa792ab459de4 /KeyRing.hs
parent970665ceb98b969b040e9f5400705846d54f77ad (diff)
some haddock foo
Diffstat (limited to 'KeyRing.hs')
-rw-r--r--KeyRing.hs38
1 files changed, 31 insertions, 7 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index b1e23b4..513ebb0 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -1,3 +1,16 @@
1---------------------------------------------------------------------------
2-- |
3-- Module : KeyRing
4--
5-- Maintainer : joe@jerkface.net
6-- Stability : experimental
7--
8-- kiki is a command-line utility for manipulating GnuPG's keyring files.
9-- This module is the programmer-facing API it uses to do that.
10--
11-- Note: This is *not* a public facing API. I (the author) consider this
12-- library to be internal to kiki and subject to change at my whim.
13--
1{-# LANGUAGE CPP #-} 14{-# LANGUAGE CPP #-}
2{-# LANGUAGE TupleSections #-} 15{-# LANGUAGE TupleSections #-}
3{-# LANGUAGE ViewPatterns #-} 16{-# LANGUAGE ViewPatterns #-}
@@ -7,14 +20,17 @@
7{-# LANGUAGE NoPatternGuards #-} 20{-# LANGUAGE NoPatternGuards #-}
8{-# LANGUAGE ForeignFunctionInterface #-} 21{-# LANGUAGE ForeignFunctionInterface #-}
9module KeyRing 22module KeyRing
10 ( runKeyRing 23 (
24 -- * Error Handling
25 KikiResult(..)
26 , KikiCondition(..)
27 , KikiReportAction(..)
28 -- * Manipulating Keyrings
29 , runKeyRing
11 , StreamInfo(..) 30 , StreamInfo(..)
12 , Access(..) 31 , Access(..)
13 , KeyFilter(..) 32 , KeyFilter(..)
14 , KeyRingOperation(..) 33 , KeyRingOperation(..)
15 , KikiResult(..)
16 , KikiCondition(..)
17 , KikiReportAction(..)
18 , errorString 34 , errorString
19 , reportString 35 , reportString
20 , KeyRingRuntime(..) 36 , KeyRingRuntime(..)
@@ -424,6 +440,10 @@ instance ASN1Object RSAPrivateKey where
424 440
425 441
426 442
443-- | This type is used to indicate success or failure
444-- and in the case of success, return the computed object.
445-- The 'FunctorToMaybe' class is implemented to facilitate
446-- branching on failture.
427data KikiCondition a = KikiSuccess a 447data KikiCondition a = KikiSuccess a
428 | FailedToLock [FilePath] 448 | FailedToLock [FilePath]
429 | BadPassphrase 449 | BadPassphrase
@@ -480,9 +500,13 @@ errorString :: KikiCondition a -> String
480errorString (KikiSuccess {}) = "success" 500errorString (KikiSuccess {}) = "success"
481errorString e = uncamel . show $ fmap (const ()) e 501errorString e = uncamel . show $ fmap (const ()) e
482 502
503-- | Errors in kiki are indicated by the returning of this record.
483data KikiResult a = KikiResult 504data KikiResult a = KikiResult
484 { kikiCondition :: KikiCondition a 505 { kikiCondition :: KikiCondition a
506 -- ^ The result or a fatal error condition.
485 , kikiReport :: [ (FilePath, KikiReportAction) ] 507 , kikiReport :: [ (FilePath, KikiReportAction) ]
508 -- ^ A list of non-fatal warning messages and the files
509 -- that triggered them.
486 } 510 }
487 511
488keyPacket :: KeyData -> Packet 512keyPacket :: KeyData -> Packet
@@ -1927,13 +1951,13 @@ disjoint_fp ks = {- concatMap group2 $ -} transpose grouped
1927getBindings :: 1951getBindings ::
1928 [Packet] 1952 [Packet]
1929 -> 1953 ->
1930 ( [([Packet],[SignatureOver])] -- ^ other signatures with key sets 1954 ( [([Packet],[SignatureOver])] -- other signatures with key sets
1931 -- that were used for the verifications 1955 -- that were used for the verifications
1932 , [(Word8, 1956 , [(Word8,
1933 (Packet, Packet), -- (topkey,subkey) 1957 (Packet, Packet), -- (topkey,subkey)
1934 [String], -- usage flags 1958 [String], -- usage flags
1935 [SignatureSubpacket], -- hashed data 1959 [SignatureSubpacket], -- hashed data
1936 [Packet])] -- ^ binding signatures 1960 [Packet])] -- binding signatures
1937 ) 1961 )
1938getBindings pkts = (sigs,bindings) 1962getBindings pkts = (sigs,bindings)
1939 where 1963 where