summaryrefslogtreecommitdiff
path: root/src/Pairing.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-04-05 22:03:43 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-04-05 22:03:43 +0200
commit7a9ef992afa96ed177ae9a4a67d302017ab73852 (patch)
tree4c53058ce2ae8015db653326996bfc17a906e72e /src/Pairing.hs
parenta8893fbcfa06044e7f999916c4dcc6a2dc907f75 (diff)
Fix non-exhaustive pattern match warnings
Diffstat (limited to 'src/Pairing.hs')
-rw-r--r--src/Pairing.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/Pairing.hs b/src/Pairing.hs
index a264c42..8567168 100644
--- a/src/Pairing.hs
+++ b/src/Pairing.hs
@@ -195,9 +195,11 @@ nonceDigest idReq idRsp nonceReq nonceRsp = hashToRefDigest $ serializeObject $
]
confirmationNumber :: RefDigest -> String
-confirmationNumber dgst = let (a:b:c:d:_) = map fromIntegral $ BA.unpack dgst :: [Word32]
- str = show $ ((a `shift` 24) .|. (b `shift` 16) .|. (c `shift` 8) .|. d) `mod` (10 ^ len)
- in replicate (len - length str) '0' ++ str
+confirmationNumber dgst =
+ case map fromIntegral $ BA.unpack dgst :: [Word32] of
+ (a:b:c:d:_) -> let str = show $ ((a `shift` 24) .|. (b `shift` 16) .|. (c `shift` 8) .|. d) `mod` (10 ^ len)
+ in replicate (len - length str) '0' ++ str
+ _ -> ""
where len = 6
pairingRequest :: forall a m proxy. (PairingResult a, MonadIO m, MonadError String m) => proxy a -> Peer -> m ()