aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJulien Tanguy <julien.tanguy@jhome.fr>2015-05-06 13:53:36 +0200
committerJulien Tanguy <julien.tanguy@jhome.fr>2015-05-06 13:53:36 +0200
commit7986de7cc40d5c063805b060c1796623d3584995 (patch)
tree646eff653b1747cd452e0e1349c6622e3d078407
parentc1e083c0be9f3791fa5527533a33eef63ebef497 (diff)
downloadhmacaroons-7986de7cc40d5c063805b060c1796623d3584995.tar.gz
hmacaroons-7986de7cc40d5c063805b060c1796623d3584995.tar.zst
hmacaroons-7986de7cc40d5c063805b060c1796623d3584995.zip
Haddock markup
[ci skip]
-rw-r--r--src/Crypto/Macaroon/Internal.hs2
-rw-r--r--src/Crypto/Macaroon/Serializer/Base64.hs1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/Crypto/Macaroon/Internal.hs b/src/Crypto/Macaroon/Internal.hs
index ebd25cb..02b7963 100644
--- a/src/Crypto/Macaroon/Internal.hs
+++ b/src/Crypto/Macaroon/Internal.hs
@@ -44,6 +44,7 @@ data Macaroon = MkMacaroon { location :: Location
44 -- ^ Macaroon HMAC signature 44 -- ^ Macaroon HMAC signature
45 } 45 }
46 46
47-- | Constant-time Eq instance
47instance Eq Macaroon where 48instance Eq Macaroon where
48 (MkMacaroon l1 i1 c1 s1) == (MkMacaroon l2 i2 c2 s2) = 49 (MkMacaroon l1 i1 c1 s1) == (MkMacaroon l2 i2 c2 s2) =
49 (l1 `constEqBytes` l2) &&! 50 (l1 `constEqBytes` l2) &&!
@@ -76,6 +77,7 @@ data Caveat = MkCaveat { cid :: Key
76 -- ^ Caveat target location 77 -- ^ Caveat target location
77 } 78 }
78 79
80-- | Constant-time Eq instance
79instance Eq Caveat where 81instance Eq Caveat where
80 (MkCaveat c1 v1 l1) == (MkCaveat c2 v2 l2) = 82 (MkCaveat c1 v1 l1) == (MkCaveat c2 v2 l2) =
81 (c1 `constEqBytes` c2) &&! 83 (c1 `constEqBytes` c2) &&!
diff --git a/src/Crypto/Macaroon/Serializer/Base64.hs b/src/Crypto/Macaroon/Serializer/Base64.hs
index f6527c2..053d967 100644
--- a/src/Crypto/Macaroon/Serializer/Base64.hs
+++ b/src/Crypto/Macaroon/Serializer/Base64.hs
@@ -55,6 +55,7 @@ packetize key dat = do
55 putByteString dat 55 putByteString dat
56 putByteString "\n" 56 putByteString "\n"
57 57
58-- | Deserialize a macaroon from a base64url-encoded ByteString
58deserialize :: BS.ByteString -> Either String Macaroon 59deserialize :: BS.ByteString -> Either String Macaroon
59deserialize = parseOnly macaroon . B64.decodeLenient 60deserialize = parseOnly macaroon . B64.decodeLenient
60 61