Skip to content
Snippets Groups Projects
Commit 74ef82e4 authored by Jean-Paul Calderone's avatar Jean-Paul Calderone
Browse files

Factor the mistake of using `decimal` into one place

parent e773e5a4
No related branches found
No related tags found
1 merge request!10Add structured CHK verify and read capability types
......@@ -68,6 +68,11 @@ showT = T.pack . show
showBase32 :: B.ByteString -> T.Text
showBase32 = T.toLower . B.encodeBase32Unpadded
-- XXXX decimal doesn't check for overflow. Replace it with something that
-- does.
natural :: Num n => Parser n
natural = decimal
instance Show Verifier where
show Verifier{storageIndex, fingerprint, required, total, size} =
T.unpack $
......@@ -183,13 +188,11 @@ pVerifier =
<* char ':'
<*> pBase32 rfc3548Alphabet 256
<* char ':'
-- XXXX decimal doesn't check for overflow. Replace it with something that
-- does.
<*> decimal
<*> natural
<* char ':'
<*> decimal
<*> natural
<* char ':'
<*> decimal
<*> natural
-- | A parser combinator for parsing a CHK read capability.
pReader :: Parser Reader
......@@ -202,13 +205,11 @@ pReader =
<* char ':'
<*> pBase32 rfc3548Alphabet 256
<* char ':'
-- XXXX decimal doesn't check for overflow. Replace it with something that
-- does.
<*> decimal
<*> natural
<* char ':'
<*> decimal
<*> natural
<* char ':'
<*> decimal
<*> natural
makeReader :: AESKey128 -> B.ByteString -> Word16 -> Word16 -> Integer -> Reader
makeReader readKey fingerprint required total size =
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment