summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--KeyRing.hs46
1 files changed, 25 insertions, 21 deletions
diff --git a/KeyRing.hs b/KeyRing.hs
index 9fd65f8..9854b84 100644
--- a/KeyRing.hs
+++ b/KeyRing.hs
@@ -418,7 +418,7 @@ data KeySpec =
418 418
419 419
420buildKeyDB :: FilePath -> FilePath -> Maybe String -> KeyRingData 420buildKeyDB :: FilePath -> FilePath -> Maybe String -> KeyRingData
421 -> IO ((KeyDB,Maybe String),[(FilePath,KikiReportAction)]) 421 -> IO (KikiCondition ((KeyDB,Maybe String),[(FilePath,KikiReportAction)]))
422buildKeyDB secring pubring grip0 keyring = do 422buildKeyDB secring pubring grip0 keyring = do
423 let isring (KeyRingFile {}) = True 423 let isring (KeyRingFile {}) = True
424 isring _ = False 424 isring _ = False
@@ -457,20 +457,22 @@ buildKeyDB secring pubring grip0 keyring = do
457 (tag,top) <- Map.toList m 457 (tag,top) <- Map.toList m
458 return (top,fname,sub,tag) 458 return (top,fname,sub,tag)
459 459
460 {- 460 doDecrypt = todo
461
461 importWalletKey db' (top,fname,sub,tag) = do 462 importWalletKey db' (top,fname,sub,tag) = do
462 doImportG doDecrypt 463 try db' $ \(db',report0) -> do
464 r <- doImportG doDecrypt
463 db' 465 db'
464 (fmap keykey $ maybeToList wk) 466 (fmap keykey $ maybeToList wk)
465 tag 467 tag
466 fname 468 fname
467 sub 469 sub
468 -} 470 try r $ \(db'',report) -> do
469 471 return $ KikiSuccess (db'', report0 ++ report)
470 -- db <- foldM importWalletKey db0 ts
471 (db,report) <- return (db0,[]) -- todo
472 472
473 return ( (db, grip), report ) 473 db <- foldM importWalletKey (KikiSuccess (db0,[])) wms'
474 try db $ \(db,report) -> do
475 return $ KikiSuccess ( (db, grip), report )
474 476
475torhash key = maybe "" id $ derToBase32 <$> derRSA key 477torhash key = maybe "" id $ derToBase32 <$> derRSA key
476 478
@@ -591,19 +593,21 @@ runKeyRing keyring op = do
591 ret = if null failed then KikiSuccess () else FailedToLock failed 593 ret = if null failed then KikiSuccess () else FailedToLock failed
592 ret <- case functorToEither ret of 594 ret <- case functorToEither ret of
593 Right {} -> do 595 Right {} -> do
594 ((db,grip), report1) <- buildKeyDB secring pubring grip0 keyring -- build db 596 bresult <- buildKeyDB secring pubring grip0 keyring -- build db
595 597 case functorToEither bresult of
596 a <- return $ op KeyRingRuntime 598 Left e -> return $ KikiResult e []
597 { rtPubring = pubring 599 Right ((db,grip), report1) -> do
598 , rtSecring = secring 600 a <- return $ op KeyRingRuntime
599 , rtRings = [] -- todo secring:pubring:keyringFiles keyring 601 { rtPubring = pubring
600 , rtWallets = [] -- todo walletFiles keyring 602 , rtSecring = secring
601 , rtGrip = grip 603 , rtRings = [] -- todo secring:pubring:keyringFiles keyring
602 , rtKeyDB = db 604 , rtWallets = [] -- todo walletFiles keyring
603 } 605 , rtGrip = grip
604 report2 <- todo -- write files 606 , rtKeyDB = db
605 607 }
606 return $ KikiResult (KikiSuccess a) (report1 ++ report2) 608 report2 <- todo -- write files
609
610 return $ KikiResult (KikiSuccess a) (report1 ++ report2)
607 Left err -> return $ KikiResult err [] 611 Left err -> return $ KikiResult err []
608 612
609 forM_ lked $ \(Just lk, fname) -> do dotlock_release lk 613 forM_ lked $ \(Just lk, fname) -> do dotlock_release lk