summaryrefslogtreecommitdiff
path: root/kiki.hs
diff options
context:
space:
mode:
Diffstat (limited to 'kiki.hs')
-rw-r--r--kiki.hs28
1 files changed, 17 insertions, 11 deletions
diff --git a/kiki.hs b/kiki.hs
index b0f8b3b..59dc575 100644
--- a/kiki.hs
+++ b/kiki.hs
@@ -1306,11 +1306,14 @@ writeOutKeyrings lkmap db = do
1306 -- warn $ "writing "++f 1306 -- warn $ "writing "++f
1307 L.writeFile f (encode m) 1307 L.writeFile f (encode m)
1308 1308
1309cross_merge doDecrypt homespec keyrings wallets f = do 1309setHome spec kd = kd { homeSpec = spec
1310 , kaction = const $ runKeyRing kd
1311 }
1310 1312
1311 let it = KeyRingData 1313
1312 { filesToLock = HomeSec:HomePub:map ArgFile keyrings 1314cross_merge doDecrypt keyrings wallets kd f = do
1313 , homeSpec = homespec 1315
1316 let it = kd { filesToLock = HomeSec:HomePub:map ArgFile keyrings
1314 , keyringFiles = keyrings 1317 , keyringFiles = keyrings
1315 , walletFiles = wallets 1318 , walletFiles = wallets
1316 , kaction = go doDecrypt f 1319 , kaction = go doDecrypt f
@@ -1323,17 +1326,18 @@ cross_merge doDecrypt homespec keyrings wallets f = do
1323 1326
1324 let pass n = do 1327 let pass n = do
1325 ms <- mapM readp (rtRings rt) 1328 ms <- mapM readp (rtRings rt)
1326 let db0 = foldl' (uncurry . merge) Map.empty ms 1329 let grip = rtGrip rt `mplus` (fingerprint <$> fstkey)
1327 fstkey = listToMaybe $ mapMaybe isSecringKey ms 1330 where
1328 where isSecringKey (fn,Message ps) 1331 fstkey = listToMaybe $ mapMaybe isSecringKey ms
1329 | fn== rtSecring rt = listToMaybe ps 1332 where isSecringKey (fn,Message ps)
1330 isSecringKey _ = Nothing 1333 | fn== rtSecring rt = listToMaybe ps
1331 grip = rtGrip rt `mplus` (fingerprint <$> fstkey) 1334 isSecringKey _ = Nothing
1332 wk = listToMaybe $ do 1335 wk = listToMaybe $ do
1333 fp <- maybeToList grip 1336 fp <- maybeToList grip
1334 elm <- Map.toList db0 1337 elm <- Map.toList db0
1335 guard $ matchSpec (KeyGrip fp) elm 1338 guard $ matchSpec (KeyGrip fp) elm
1336 return $ keyPacket (snd elm) 1339 return $ keyPacket (snd elm)
1340 db0 = foldl' (uncurry . merge) Map.empty ms
1337 wms <- mapM (readw wk) (rtWallets rt) 1341 wms <- mapM (readw wk) (rtWallets rt)
1338 let ts = do 1342 let ts = do
1339 maybeToList wk 1343 maybeToList wk
@@ -2408,7 +2412,9 @@ main = do
2408 putStrLn $ "keyrings = "++show keyrings 2412 putStrLn $ "keyrings = "++show keyrings
2409 -} 2413 -}
2410 2414
2411 cross_merge decrypt ( join . take 1 <$> Map.lookup "--homedir" margs) keyrings_ wallets $ \(secfile,grip) db pubring -> do 2415 let homespec = join . take 1 <$> Map.lookup "--homedir" margs
2416 cross_merge decrypt keyrings_ wallets (setHome homespec KeyRing.empty)
2417 $ \(secfile,grip) db pubring -> do
2412 2418
2413 use_db0 <- return db 2419 use_db0 <- return db
2414 2420