hmacaroons-0.5.0.0: Haskell implementation of macaroons

Copyright(c) 2015 Julien Tanguy
LicenseBSD3
Maintainerjulien.tanguy@jhome.fr
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Crypto.Macaroon.Verifier

Description

 

Synopsis

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

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

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 Monoid instance is written so SigMismatch is an annihilator, and NoVerifier is the identity element