diff options
author | Julien Tanguy <julien.tanguy@jhome.fr> | 2015-05-15 16:03:30 +0200 |
---|---|---|
committer | Julien Tanguy <julien.tanguy@jhome.fr> | 2015-05-15 23:10:16 +0200 |
commit | 5d1b7d51854d355bf5b6438c1a96ce9e743fd810 (patch) | |
tree | 9790591988ee639d50bc873e5f757a4c0e6b7ffb /src | |
parent | 8fad4fa9d1b592ece4806dcd9abb6c011d3948bf (diff) | |
download | hmacaroons-5d1b7d51854d355bf5b6438c1a96ce9e743fd810.tar.gz hmacaroons-5d1b7d51854d355bf5b6438c1a96ce9e743fd810.tar.zst hmacaroons-5d1b7d51854d355bf5b6438c1a96ce9e743fd810.zip |
Add quickcheck properties
Diffstat (limited to 'src')
-rw-r--r-- | src/Crypto/Macaroon/Verifier.hs | 6 |
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 |
27 | data Result = Success | Failure deriving (Show,Eq) | 27 | data VResult = VSuccess | VFailure deriving (Show,Eq) |
28 | 28 | ||
29 | verifySig :: Key -> Macaroon -> Result | 29 | verifySig :: Key -> Macaroon -> VResult |
30 | verifySig k m = bool Failure Success $ | 30 | verifySig 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) |