aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
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)