| Copyright | (c) 2015 Julien Tanguy |
|---|---|
| License | BSD3 |
| Maintainer | julien.tanguy@jhome.fr |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Crypto.Macaroon.Verifier
Description
- 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:
Unrelatedif the caveat is not related to the verifier (for instance a time verifier is given an action caveat);Refused(ParseErrorreason) if the verifier is related to the caveat, but failed to parse it completely;Refused(ValidatorErrorreason) if the verifier is related to the caveat, parsed it and invalidated it;Verifiedif the verifier has successfully verified the given caveat
data VerifierResult
Type representing the result of a validator
Constructors
| 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 |
Instances
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
Constructors
| ParseError String | A verifier had a parse error |
| ValidatorError String | A verifier failed |
Instances
| Eq ValidationError | |
| Show ValidationError | |
| Monoid ValidationError | The |