diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-08-17 15:52:08 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-08-17 15:52:08 -0400 |
commit | 19e3dc5541a74fe1c323c629bdf214b8690640e5 (patch) | |
tree | d4c16b9bb027887e9b7ea323997d30e00ba9ebdb /keysafe.hs | |
parent | ed8d1ed03c3520ccd4b3c775817bef122457f224 (diff) | |
download | keysafe-19e3dc5541a74fe1c323c629bdf214b8690640e5.tar.gz |
save restored secret key to gpg or file
Diffstat (limited to 'keysafe.hs')
-rw-r--r-- | keysafe.hs | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -15,6 +15,7 @@ import Encryption import Entropy import ExpensiveHash import Cost +import SecretKey import Shard import Storage import qualified Gpg @@ -61,10 +62,6 @@ dispatch cmdline ui tunables = do go CmdLine.Benchmark _ = benchmarkTunables tunables -getSecretKey :: SecretKeySource -> IO SecretKey -getSecretKey (GpgKey kid) = Gpg.getSecretKey kid -getSecretKey (KeyFile f) = SecretKey <$> B.readFile f - backup :: Storage -> UI -> Tunables -> SecretKeySource -> SecretKey -> IO () backup storage ui tunables secretkeysource secretkey = do username <- userName @@ -166,10 +163,9 @@ restore storage ui secretkeydest = do (decryptdesc cost) $ \setpercent -> do case decrypt candidatekeys esk of Nothing -> showError ui "Decryption failed! Unknown why it would fail at this point." - Just (SecretKey secretkey) -> do + Just secretkey -> do setpercent 100 - -- TODO save - print secretkey + writeSecretKey secretkeydest secretkey showInfo ui "Success" "Your secret key successfully restored!" where -- TODO: derive by probing to find objects |