aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJulien Tanguy <julien.tanguy@jhome.fr>2015-05-15 16:03:30 +0200
committerJulien Tanguy <julien.tanguy@jhome.fr>2015-05-15 23:10:16 +0200
commit5d1b7d51854d355bf5b6438c1a96ce9e743fd810 (patch)
tree9790591988ee639d50bc873e5f757a4c0e6b7ffb /src
parent8fad4fa9d1b592ece4806dcd9abb6c011d3948bf (diff)
downloadhmacaroons-5d1b7d51854d355bf5b6438c1a96ce9e743fd810.tar.gz
hmacaroons-5d1b7d51854d355bf5b6438c1a96ce9e743fd810.tar.zst
hmacaroons-5d1b7d51854d355bf5b6438c1a96ce9e743fd810.zip
Add quickcheck properties
Diffstat (limited to 'src')
-rw-r--r--src/Crypto/Macaroon/Verifier.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Crypto/Macaroon/Verifier.hs b/src/Crypto/Macaroon/Verifier.hs
index 0d1636c..e257f5f 100644
--- a/src/Crypto/Macaroon/Verifier.hs
+++ b/src/Crypto/Macaroon/Verifier.hs
@@ -24,10 +24,10 @@ import Crypto.Macaroon.Internal
24 24
25 25
26-- | Opaque datatype for now. Might need more explicit errors 26-- | Opaque datatype for now. Might need more explicit errors
27data Result = Success | Failure deriving (Show,Eq) 27data VResult = VSuccess | VFailure deriving (Show,Eq)
28 28
29verifySig :: Key -> Macaroon -> Result 29verifySig :: Key -> Macaroon -> VResult
30verifySig k m = bool Failure Success $ 30verifySig k m = bool VFailure VSuccess $
31 signature m == foldl' hash (toBytes (hmac derivedKey (identifier m) :: HMAC SHA256)) (caveats m) 31 signature m == foldl' hash (toBytes (hmac derivedKey (identifier m) :: HMAC SHA256)) (caveats m)
32 where 32 where
33 hash s c = toBytes (hmac s (vid c `BS.append` cid c) :: HMAC SHA256) 33 hash s c = toBytes (hmac s (vid c `BS.append` cid c) :: HMAC SHA256)