From 5d1b7d51854d355bf5b6438c1a96ce9e743fd810 Mon Sep 17 00:00:00 2001 From: Julien Tanguy Date: Fri, 15 May 2015 16:03:30 +0200 Subject: Add quickcheck properties --- src/Crypto/Macaroon/Verifier.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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 -- | Opaque datatype for now. Might need more explicit errors -data Result = Success | Failure deriving (Show,Eq) +data VResult = VSuccess | VFailure deriving (Show,Eq) -verifySig :: Key -> Macaroon -> Result -verifySig k m = bool Failure Success $ +verifySig :: Key -> Macaroon -> VResult +verifySig k m = bool VFailure VSuccess $ signature m == foldl' hash (toBytes (hmac derivedKey (identifier m) :: HMAC SHA256)) (caveats m) where hash s c = toBytes (hmac s (vid c `BS.append` cid c) :: HMAC SHA256) -- cgit v1.2.3