diff options
Diffstat (limited to 'src/Crypto')
-rw-r--r-- | src/Crypto/Macaroon.hs | 12 | ||||
-rw-r--r-- | src/Crypto/Macaroon/Verifier/Internal.hs | 8 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/Crypto/Macaroon.hs b/src/Crypto/Macaroon.hs index c9c8c21..86d8eb7 100644 --- a/src/Crypto/Macaroon.hs +++ b/src/Crypto/Macaroon.hs | |||
@@ -43,16 +43,20 @@ module Crypto.Macaroon ( | |||
43 | , inspect | 43 | , inspect |
44 | , addFirstPartyCaveat | 44 | , addFirstPartyCaveat |
45 | -- , addThirdPartyCaveat | 45 | -- , addThirdPartyCaveat |
46 | -- * Serialize | ||
47 | , module Crypto.Macaroon.Serializer.Base64 | ||
48 | -- * Verify | ||
49 | , module Crypto.Macaroon.Verifier | ||
46 | ) where | 50 | ) where |
47 | 51 | ||
48 | -- import Crypto.Cipher.AES | 52 | -- import Crypto.Cipher.AES |
49 | import Crypto.Hash | 53 | import Crypto.Hash |
50 | import Data.Byteable | 54 | import Data.Byteable |
51 | import qualified Data.ByteString as BS | 55 | import qualified Data.ByteString as BS |
52 | import qualified Data.ByteString.Base64.URL as B64 | ||
53 | import qualified Data.ByteString.Char8 as B8 | ||
54 | 56 | ||
55 | import Crypto.Macaroon.Internal | 57 | import Crypto.Macaroon.Internal |
58 | import Crypto.Macaroon.Serializer.Base64 | ||
59 | import Crypto.Macaroon.Verifier | ||
56 | 60 | ||
57 | -- | Create a Macaroon from its key, identifier and location | 61 | -- | Create a Macaroon from its key, identifier and location |
58 | create :: Secret -> Key -> Location -> Macaroon | 62 | create :: Secret -> Key -> Location -> Macaroon |
@@ -78,5 +82,3 @@ addFirstPartyCaveat ident m = addCaveat (location m) ident BS.empty m | |||
78 | -- addThirdPartyCaveat key cid loc m = addCaveat loc cid vid m | 82 | -- addThirdPartyCaveat key cid loc m = addCaveat loc cid vid m |
79 | -- where | 83 | -- where |
80 | -- vid = encryptECB (initAES (signature m)) key | 84 | -- vid = encryptECB (initAES (signature m)) key |
81 | |||
82 | |||
diff --git a/src/Crypto/Macaroon/Verifier/Internal.hs b/src/Crypto/Macaroon/Verifier/Internal.hs index 5126b2e..b3ad7f2 100644 --- a/src/Crypto/Macaroon/Verifier/Internal.hs +++ b/src/Crypto/Macaroon/Verifier/Internal.hs | |||
@@ -30,16 +30,16 @@ import Data.Monoid | |||
30 | import Crypto.Macaroon.Internal | 30 | import Crypto.Macaroon.Internal |
31 | 31 | ||
32 | -- | Type representing different validation errors. | 32 | -- | Type representing different validation errors. |
33 | -- Only 'ParseError' and 'ValidatorError' are exported, 'SigMismatch' and | 33 | -- Only 'ParseError' and 'ValidatorError' are exported, @SigMismatch@ and |
34 | -- 'NoVerifier' are used internally and should not be used by the user | 34 | -- @NoVerifier@ are used internally and should not be used by the user |
35 | data ValidationError = SigMismatch -- ^ Signatures do not match | 35 | data ValidationError = SigMismatch -- ^ Signatures do not match |
36 | | NoVerifier -- ^ No verifier can handle a given caveat | 36 | | NoVerifier -- ^ No verifier can handle a given caveat |
37 | | ParseError String -- ^ A verifier had a parse error | 37 | | ParseError String -- ^ A verifier had a parse error |
38 | | ValidatorError String -- ^ A verifier failed | 38 | | ValidatorError String -- ^ A verifier failed |
39 | deriving (Show,Eq) | 39 | deriving (Show,Eq) |
40 | 40 | ||
41 | -- | The 'Monoid' instance is written so 'SigMismatch' is an annihilator, | 41 | -- | The 'Monoid' instance is written so @SigMismatch@ is an annihilator, |
42 | -- and 'NoVerifier' is the identity element | 42 | -- and @NoVerifier@ is the identity element |
43 | instance Monoid ValidationError where | 43 | instance Monoid ValidationError where |
44 | mempty = NoVerifier | 44 | mempty = NoVerifier |
45 | NoVerifier `mappend` e = e | 45 | NoVerifier `mappend` e = e |