}:
mkDerivation {
pname = "hmacaroons";
- version = "0.2.0.0";
+ version = "0.4.0.0";
src = ./.;
buildDepends = [
attoparsec base base64-bytestring byteable bytestring cereal
];
testDepends = [
attoparsec base base64-bytestring byteable bytestring cereal
- cryptohash either hex QuickCheck tasty tasty-hunit tasty-quickcheck
+ cryptohash deepseq either hex QuickCheck tasty tasty-hunit
+ tasty-quickcheck transformers
];
homepage = "https://github.com/jtanguy/hmacaroons";
description = "Haskell implementation of macaroons";
name: hmacaroons
-version: 0.3.0.0
+version: 0.4.0.0
synopsis: Haskell implementation of macaroons
description:
Hmacaroons is a pure haskell implementation of macaroons. It aims to
Crypto.Macaroon.Verifier.Internal
build-depends: base >=4 && < 5,
attoparsec >=0.12,
- transformers >= 0.4,
+ transformers >= 0.3,
bytestring >=0.10,
base64-bytestring >= 1.0,
byteable >= 0.1 && <0.2,
tasty-quickcheck >= 0.8,
QuickCheck >= 2.8,
deepseq >= 1.1,
- transformers >= 0.4
+ transformers >= 0.3
) where
-import Control.Monad
+import Control.Applicative
+import Control.Monad hiding (forM)
import Control.Monad.IO.Class
import Data.Attoparsec.ByteString
import Data.Attoparsec.ByteString.Char8
import Data.Bool
+import Data.Traversable
import qualified Data.ByteString as BS
import Data.Either.Combinators
-- caveat, parsed it and invalidated it;
-- * 'Just' ('Right' '()') if the verifier has successfully verified the
-- given caveat
-verify :: MonadIO m => Secret -> [Caveat -> m (Maybe (Either ValidationError ()))] -> Macaroon -> m (Either ValidationError Macaroon)
+verify :: (Functor m, MonadIO m) => Secret -> [Caveat -> m (Maybe (Either ValidationError ()))] -> Macaroon -> m (Either ValidationError Macaroon)
verify secret verifiers m = join <$> forM (verifySig secret m) (verifyCavs verifiers)
derivedKey = toBytes (hmac "macaroons-key-generator" k :: HMAC SHA256)
-- | Given a list of verifiers, verify each caveat of the given macaroon
-verifyCavs :: MonadIO m
+verifyCavs :: (Functor m, MonadIO m)
=> [Caveat -> m (Maybe (Either ValidationError ()))]
-> Macaroon
-> m (Either ValidationError Macaroon)
-}
module Crypto.Macaroon.Instances where
+import Control.Applicative
import Control.Monad
import Data.Byteable
import qualified Data.ByteString as BS