summaryrefslogtreecommitdiff
path: root/KeyRing.hs
diff options
context:
space:
mode:
authorjoe <joe@jerkface.net>2014-04-30 20:57:08 -0400
committerjoe <joe@jerkface.net>2014-04-30 20:57:08 -0400
commit3c31d32a259dcb81741c2bdd5f2ba46ab26fe08a (patch)
tree11cae50734f5a224b58ea7f5515ec9d79c76e003 /KeyRing.hs
parentacd5a541281324b85ef2a1e5a9d343f9bc91b05e (diff)
merge and makeMemoizingDecrypter now use consistent marshalling of
InputFile keys.
Diffstat (limited to 'KeyRing.hs')
-rw-r--r--KeyRing.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index 6f73fae..bcd8ac8 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -1370,6 +1370,8 @@ writeWalletKeys krd db wk = do
1370 let wip = walletImportFormat (CryptoCoins.private_byte_id nw) (packet mp) 1370 let wip = walletImportFormat (CryptoCoins.private_byte_id nw) (packet mp)
1371 return (CryptoCoins.network_name nw,wip) 1371 return (CryptoCoins.network_name nw,wip)
1372 handleIO_ (return report) $ do 1372 handleIO_ (return report) $ do
1373 -- TODO: This AppendMode stratagy is not easy to adapt from FilePath-based
1374 -- to InputFile-based.
1373 withFile n AppendMode $ \fh -> do 1375 withFile n AppendMode $ \fh -> do
1374 rs <- forM cs' $ \(net,wip) -> do 1376 rs <- forM cs' $ \(net,wip) -> do
1375 hPutStrLn fh wip 1377 hPutStrLn fh wip
@@ -1607,11 +1609,8 @@ makeMemoizingDecrypter :: KeyRingOperation -> InputFileContext
1607 -> IO (MappedPacket -> IO (KikiCondition Packet)) 1609 -> IO (MappedPacket -> IO (KikiCondition Packet))
1608makeMemoizingDecrypter operation ctx = do 1610makeMemoizingDecrypter operation ctx = do
1609 pws <- 1611 pws <-
1610 -- TODO: head will throw an exception if a File Descriptor operation
1611 -- file is present. We probably should change OriginMap to use InputFile
1612 -- instead of FilePath.
1613 Traversable.mapM (cachedContents ctx . fromJust . pwfile . typ) 1612 Traversable.mapM (cachedContents ctx . fromJust . pwfile . typ)
1614 (Map.mapKeys (head . resolveInputFile ctx) 1613 (Map.mapKeys (resolveForReport $ Just ctx)
1615 $ Map.filter (isJust . pwfile . typ) $ kFiles operation) 1614 $ Map.filter (isJust . pwfile . typ) $ kFiles operation)
1616 unkeysRef <- newIORef Map.empty 1615 unkeysRef <- newIORef Map.empty
1617 return $ doDecrypt unkeysRef pws 1616 return $ doDecrypt unkeysRef pws
@@ -2278,7 +2277,7 @@ uidkey (UserIDPacket str) = str
2278merge :: KeyDB -> InputFile -> Message -> KeyDB 2277merge :: KeyDB -> InputFile -> Message -> KeyDB
2279merge db inputfile (Message ps) = merge_ db filename qs 2278merge db inputfile (Message ps) = merge_ db filename qs
2280 where 2279 where
2281 filename = concat $ resolveInputFile (InputFileContext "&secret" "&public") inputfile 2280 filename = resolveForReport Nothing inputfile
2282 2281
2283 qs = scanPackets filename ps 2282 qs = scanPackets filename ps
2284 2283