Copyright | (c) 2015 Julien Tanguy |
---|---|
License | BSD3 |
Maintainer | julien.tanguy@jhome.fr |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
- verify :: (Functor m, MonadIO m) => Secret -> [Caveat -> m VerifierResult] -> Macaroon -> m (Either ValidationError Macaroon)
- data VerifierResult
- data ValidationError
Documentation
verify :: (Functor m, MonadIO m) => Secret -> [Caveat -> m VerifierResult] -> Macaroon -> m (Either ValidationError Macaroon)
Verify a Macaroon's signature and caveats, given the corresponding Secret and verifiers.
A verifier is a function of type
.MonadIO
m => Caveat
-> m VerifierResult
It should return:
Unrelated
if the caveat is not related to the verifier (for instance a time verifier is given an action caveat);Refused
(ParseError
reason) if the verifier is related to the caveat, but failed to parse it completely;Refused
(ValidatorError
reason) if the verifier is related to the caveat, parsed it and invalidated it;Verified
if the verifier has successfully verified the given caveat
data VerifierResult
Type representing the result of a validator
Verified | The caveat is correctly parsed and verified |
Refused ValidationError | The caveat is refused (Either a parse error or a validation error |
Unrelated | The given verifier does not verify the caveat |
data ValidationError
Type representing different validation errors.
Only ParseError
and ValidatorError
are exported, SigMismatch
and
NoVerifier
are used internally and should not be used by the user
ParseError String | A verifier had a parse error |
ValidatorError String | A verifier failed |
Eq ValidationError | |
Show ValidationError | |
Monoid ValidationError | The |