]> git.immae.eu Git - github/fretlink/hmacaroons.git/blame - src/Crypto/Macaroon/Binder.hs
Rewording and lint
[github/fretlink/hmacaroons.git] / src / Crypto / Macaroon / Binder.hs
CommitLineData
f6781456
JT
1{-|
2Module : Crypto.Macaroon.Binder
3Copyright : (c) 2015 Julien Tanguy
4License : BSD3
5
6Maintainer : julien.tanguy@jhome.fr
7Stability : experimental
8Portability : portable
9
10
11
12-}
13module Crypto.Macaroon.Binder where
14
15import Crypto.Hash
16import Data.Byteable
17import qualified Data.ByteString as BS
18
19import Crypto.Macaroon.Internal
20
21-- | Datatype for binding discharging and authorizing macaroons together
22newtype Binder = Binder { bind :: Macaroon -> Macaroon -> BS.ByteString }
23
24
25-- | Binder which concatenates the two signatures and hashes them
26hashSigs :: Binder
2aede11a 27hashSigs = Binder $ \m m' -> toBytes (HMAC . hash $ BS.append (toBytes $ signature m') (toBytes $ signature m) :: HMAC SHA256)
f6781456 28