summaryrefslogtreecommitdiff
path: root/src/Pairing.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-12-20 21:47:22 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2020-12-23 22:32:09 +0100
commit36b9a1ddbddf1477c61809d340cd0b86360a7a83 (patch)
tree7b327df1b1635270e98391ec1cf63478b8730793 /src/Pairing.hs
parent0c4c6618d43a8b7179f11b8edb1f289169b5f2bc (diff)
Network: STM-based synchronization rewrite
Diffstat (limited to 'src/Pairing.hs')
-rw-r--r--src/Pairing.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Pairing.hs b/src/Pairing.hs
index a0a19b3..9af33c7 100644
--- a/src/Pairing.hs
+++ b/src/Pairing.hs
@@ -155,9 +155,9 @@ confirmationNumber dgst = let (a:b:c:d:_) = map fromIntegral $ BA.unpack dgst ::
pairingRequest :: forall a m proxy. (PairingResult a, MonadIO m, MonadError String m) => proxy a -> UnifiedIdentity -> Peer -> m ()
pairingRequest _ self peer = do
nonce <- liftIO $ getRandomBytes 32
- pid <- case peerIdentity peer of
- PeerIdentityFull pid -> return pid
- _ -> throwError "incomplete peer identity"
+ pid <- peerIdentity peer >>= \case
+ PeerIdentityFull pid -> return pid
+ _ -> throwError "incomplete peer identity"
sendToPeerWith @(PairingService a) self peer $ \case
NoPairing -> return (Just $ PairingRequest (nonceDigest self pid nonce BA.empty), OurRequest nonce)
_ -> throwError "alredy in progress"