From 2903fd39c39357168a7cbb8b6821a0c99ed1e5a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sun, 26 Dec 2021 22:22:34 +0100 Subject: Generalize local state helper functions --- src/Attach.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/Attach.hs') diff --git a/src/Attach.hs b/src/Attach.hs index 89ed4bb..e028718 100644 --- a/src/Attach.hs +++ b/src/Attach.hs @@ -88,15 +88,14 @@ attachAccept printMsg h peer = do liftIO $ printMsg $ "Confirmed peer, but verification of received identity failed" return (Nothing, NoPairing) OurRequestConfirm (Just (AttachIdentity _ keys (Just identity))) -> do - liftIO $ do - printMsg $ "Accepted updated identity" - updateLocalState_ h $ finalizeAttach identity keys + liftIO $ printMsg $ "Accepted updated identity" + flip runReaderT h $ updateLocalState_ $ finalizeAttach identity keys return (Nothing, PairingDone) OurRequestReady -> throwError $ "alredy accepted, waiting for peer" PeerRequest {} -> throwError $ "waiting for peer" PeerRequestConfirm -> do liftIO $ printMsg $ "Accepted new attached device, seding updated identity" - owner <- liftIO $ mergeSharedIdentity h + owner <- runReaderT mergeSharedIdentity h PeerIdentityFull pid <- peerIdentity peer Just secret <- liftIO $ loadKey $ idKeyIdentity owner liftIO $ do -- cgit v1.2.3