summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Crayne <joe@jerkface.net>2019-07-02 03:50:22 -0400
committerJoe Crayne <joe@jerkface.net>2019-07-02 03:50:22 -0400
commite69f4750ceb30ba6e1953ce746d00ad4bc89145f (patch)
tree1559e25d58adcb4390cd992c7b5cab3cb9255748
parentb472f10fb19182deb4c081940cd1e660a0287fe9 (diff)
Make KeyKey a proper type.
-rw-r--r--lib/KeyRing/Types.hs5
-rw-r--r--lib/PacketTranscoder.hs6
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/KeyRing/Types.hs b/lib/KeyRing/Types.hs
index e1e19f5..f5fd879 100644
--- a/lib/KeyRing/Types.hs
+++ b/lib/KeyRing/Types.hs
@@ -299,10 +299,11 @@ data InputFileContext = InputFileContext
299-- which is used for finger-printing and as a lookup key into 299-- which is used for finger-printing and as a lookup key into
300-- maps. This type may be changed to an actual fingerprint in 300-- maps. This type may be changed to an actual fingerprint in
301-- in the future. 301-- in the future.
302type KeyKey = [(Char,MPI)] 302newtype KeyKey = KeyKey [(Char,MPI)]
303 deriving (Eq,Ord,Show)
303 304
304keykey :: Packet -> KeyKey 305keykey :: Packet -> KeyKey
305keykey k = concatMap (\c -> (maybeToList $ find (\(f,x) -> f==c) (key k))) (public_key_fields $ key_algorithm k) 306keykey k = KeyKey $ concatMap (\c -> (maybeToList $ find (\(f,x) -> f==c) (key k))) (public_key_fields $ key_algorithm k)
306 307
307isKey :: Packet -> Bool 308isKey :: Packet -> Bool
308isKey (PublicKeyPacket {}) = True 309isKey (PublicKeyPacket {}) = True
diff --git a/lib/PacketTranscoder.hs b/lib/PacketTranscoder.hs
index 6eadfe4..eaed938 100644
--- a/lib/PacketTranscoder.hs
+++ b/lib/PacketTranscoder.hs
@@ -315,8 +315,12 @@ keyQueries grip ringPackets = (mwk, fmap makeQuery keys)
315 m2 :: Map.Map KeyKey (Maybe Packet, MappedPacket, (Map.Map String [Packet])) 315 m2 :: Map.Map KeyKey (Maybe Packet, MappedPacket, (Map.Map String [Packet]))
316 m2 = Map.fromList 316 m2 = Map.fromList
317 $ drop 1 317 $ drop 1
318 $ scanl' build ([],(Nothing,error "bug in PacketTranscoder (1)", error "bug in PacketTranscoder (2)")) pss 318 $ scanl' build failure pss
319 where 319 where
320 failure = ( error "bug in PacketTranscoder(3)"
321 , (Nothing,error "bug in PacketTranscoder (1)"
322 , error "bug in PacketTranscoder (2)")
323 )
320 build (_,(main0,_,_)) ps = (kk,(main,kp,uidmap ps')) 324 build (_,(main0,_,_)) ps = (kk,(main,kp,uidmap ps'))
321 where 325 where
322 main | is_subkey (packet kp) = main0 326 main | is_subkey (packet kp) = main0