]> git.immae.eu Git - github/fretlink/hmacaroons.git/blobdiff - test/Crypto/Macaroon/Verifier/Internal/Tests.hs
Dedicated VerifierResult
[github/fretlink/hmacaroons.git] / test / Crypto / Macaroon / Verifier / Internal / Tests.hs
index 826b6314a72b2fe4166280d409d1f27a411c128c..59980dec7fb5ee5ad98564257795f7938a83ba68 100644 (file)
@@ -45,19 +45,19 @@ m = create sec key loc
 m2 :: Macaroon
 m2 = addFirstPartyCaveat "test = caveat" m
 
-vtest :: Caveat -> IO (Maybe (Either ValidationError ()))
+vtest :: Caveat -> IO VerifierResult
 vtest c = return $ if "test" `BS.isPrefixOf` cid c then
-    Just $ bool (Left (ValidatorError "Failed")) (Right ()) $ "test = caveat" == cid c
-    else Nothing
+    bool (Refused (ValidatorError "Failed")) Verified $ "test = caveat" == cid c
+    else Unrelated
 
 
 m3 :: Macaroon
 m3 = addFirstPartyCaveat "value = 42" m2
 
-vval :: Caveat -> IO (Maybe (Either ValidationError ()))
+vval :: Caveat -> IO VerifierResult
 vval c = return $ if "value" `BS.isPrefixOf` cid c then
-    Just $ bool (Left (ValidatorError "Failed")) (Right ()) $ "value = 42" == cid c
-    else Nothing
+    bool (Refused (ValidatorError "Failed")) Verified $ "value = 42" == cid c
+    else Unrelated
 
 
 {-