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