diff options
author | Julien Tanguy <julien.tanguy@jhome.fr> | 2015-04-09 18:04:05 +0200 |
---|---|---|
committer | Julien Tanguy <julien.tanguy@jhome.fr> | 2015-04-09 18:04:05 +0200 |
commit | 1971e224efa6a5940fb8b15c718f2b59c2d0f014 (patch) | |
tree | c57e8c4784f8318c26edc3336ad94d757be6e79c /src/Crypto/Macaroon.hs | |
parent | 2aede11ad7e5addd50cd4e3c202e094319e942f2 (diff) | |
download | hmacaroons-1971e224efa6a5940fb8b15c718f2b59c2d0f014.tar.gz hmacaroons-1971e224efa6a5940fb8b15c718f2b59c2d0f014.tar.zst hmacaroons-1971e224efa6a5940fb8b15c718f2b59c2d0f014.zip |
Documentation
Diffstat (limited to 'src/Crypto/Macaroon.hs')
-rw-r--r-- | src/Crypto/Macaroon.hs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/Crypto/Macaroon.hs b/src/Crypto/Macaroon.hs index 42e4a07..07043f7 100644 --- a/src/Crypto/Macaroon.hs +++ b/src/Crypto/Macaroon.hs | |||
@@ -25,6 +25,7 @@ module Crypto.Macaroon ( | |||
25 | , Caveat | 25 | , Caveat |
26 | , Key | 26 | , Key |
27 | , Location | 27 | , Location |
28 | , Sig | ||
28 | -- * Accessing functions | 29 | -- * Accessing functions |
29 | -- ** Macaroons | 30 | -- ** Macaroons |
30 | , location | 31 | , location |
@@ -65,18 +66,23 @@ create secret ident loc = MkMacaroon loc ident [] (toBytes (hmac derivedKey iden | |||
65 | where | 66 | where |
66 | derivedKey = toBytes (hmac "macaroons-key-generator" secret :: HMAC SHA256) | 67 | derivedKey = toBytes (hmac "macaroons-key-generator" secret :: HMAC SHA256) |
67 | 68 | ||
69 | -- | Caveat target location | ||
68 | caveatLoc :: Caveat -> Location | 70 | caveatLoc :: Caveat -> Location |
69 | caveatLoc = cl | 71 | caveatLoc = cl |
70 | 72 | ||
73 | -- | Caveat identifier | ||
71 | caveatId :: Caveat -> Key | 74 | caveatId :: Caveat -> Key |
72 | caveatId = cid | 75 | caveatId = cid |
73 | 76 | ||
77 | -- | Caveat verification identifier | ||
74 | caveatVId :: Caveat -> Key | 78 | caveatVId :: Caveat -> Key |
75 | caveatVId = vid | 79 | caveatVId = vid |
76 | 80 | ||
81 | -- | Inspect a macaroon's contents. For debugging purposes. | ||
77 | inspect :: Macaroon -> String | 82 | inspect :: Macaroon -> String |
78 | inspect = show | 83 | inspect = show |
79 | 84 | ||
85 | -- | Serialize a macaroon in an URL-safe Base64 encoding | ||
80 | serialize :: Macaroon -> BS.ByteString | 86 | serialize :: Macaroon -> BS.ByteString |
81 | serialize m = B8.filter (/= '=') . B64.encode $ packets | 87 | serialize m = B8.filter (/= '=') . B64.encode $ packets |
82 | where | 88 | where |