summaryrefslogtreecommitdiff
path: root/src/Storage/Key.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2019-11-12 21:40:59 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2019-11-17 21:58:03 +0100
commitbfcfbb8523e6fc5ea2a74302661995e09ad0de71 (patch)
treebd15f900b8fe322fd1aa520bf9e4238d6e6d0a62 /src/Storage/Key.hs
parent9c31e863dd9dd5fc60ecae79b5d0fc8d09024fad (diff)
Storage: watching head changes
Diffstat (limited to 'src/Storage/Key.hs')
-rw-r--r--src/Storage/Key.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Storage/Key.hs b/src/Storage/Key.hs
index 8e6d04c..28fc989 100644
--- a/src/Storage/Key.hs
+++ b/src/Storage/Key.hs
@@ -31,13 +31,13 @@ storeKey :: KeyPair sec pub => sec -> IO ()
storeKey key = do
let spub = keyGetPublic key
case stBacking $ storedStorage spub of
- StorageDir dir -> writeFileOnce (keyFilePath dir spub) (BL.fromStrict $ convert $ keyGetData key)
+ StorageDir { dirPath = dir } -> writeFileOnce (keyFilePath dir spub) (BL.fromStrict $ convert $ keyGetData key)
StorageMemory { memKeys = kstore } -> modifyMVar_ kstore $ return . M.insert (refDigest $ storedRef spub) (keyGetData key)
loadKey :: KeyPair sec pub => Stored pub -> IO (Maybe sec)
loadKey spub = do
case stBacking $ storedStorage spub of
- StorageDir dir -> tryIOError (BC.readFile (keyFilePath dir spub)) >>= \case
+ StorageDir { dirPath = dir } -> tryIOError (BC.readFile (keyFilePath dir spub)) >>= \case
Right kdata -> return $ keyFromData (convert kdata) spub
Left _ -> return Nothing
StorageMemory { memKeys = kstore } -> (flip keyFromData spub <=< M.lookup (refDigest $ storedRef spub)) <$> readMVar kstore