diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-08-27 18:33:16 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-08-30 20:53:55 +0200 |
commit | c27b3c23ecdd53acdbfece747b9bbdb39bf4dae9 (patch) | |
tree | 52a4be70840e2691195ec54149f5ac14ec112606 /src/Test.hs | |
parent | dfddb65ad1abf5ba4171be42d303850ebbc363ee (diff) |
Replace storedStorage usage with MonadHead
Diffstat (limited to 'src/Test.hs')
-rw-r--r-- | src/Test.hs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/Test.hs b/src/Test.hs index a506345..3f59239 100644 --- a/src/Test.hs +++ b/src/Test.hs @@ -426,31 +426,28 @@ cmdWatchSharedIdentity = do cmdUpdateLocalIdentity :: Command cmdUpdateLocalIdentity = do [name] <- asks tiParams - updateLocalHead_ $ \ls -> liftIO $ do + updateLocalHead_ $ \ls -> do Just identity <- return $ validateIdentity $ lsIdentity $ fromStored ls - let st = storedStorage ls - public = idKeyIdentity identity + let public = idKeyIdentity identity - Just secret <- loadKey public + secret <- loadKey public nidata <- maybe (error "created invalid identity") (return . idData) . validateIdentity =<< - wrappedStore st =<< sign secret =<< wrappedStore st (emptyIdentityData public) + mstore =<< sign secret =<< mstore (emptyIdentityData public) { iddPrev = toList $ idDataF identity , iddName = Just name } - wrappedStore st $ (fromStored ls) { lsIdentity = nidata } + mstore (fromStored ls) { lsIdentity = nidata } cmdUpdateSharedIdentity :: Command cmdUpdateSharedIdentity = do [name] <- asks tiParams updateLocalHead_ $ updateSharedState_ $ \case Nothing -> throwError "no existing shared identity" - Just identity -> liftIO $ do - let st = storedStorage $ head $ idDataF identity - public = idKeyIdentity identity - - Just secret <- loadKey public + Just identity -> do + let public = idKeyIdentity identity + secret <- loadKey public maybe (error "created invalid identity") (return . Just . toComposedIdentity) . validateIdentity =<< - wrappedStore st =<< sign secret =<< wrappedStore st (emptyIdentityData public) + mstore =<< sign secret =<< mstore (emptyIdentityData public) { iddPrev = toList $ idDataF identity , iddName = Just name } |