diff options
author | Julien Tanguy <julien.tanguy@jhome.fr> | 2015-04-14 17:47:05 +0200 |
---|---|---|
committer | Julien Tanguy <julien.tanguy@jhome.fr> | 2015-04-14 17:47:05 +0200 |
commit | 26d38f73993db56811d198a3e0b5c710722dd472 (patch) | |
tree | 433b28f99826251ea19ea0c1c56e52bd78a61414 | |
parent | 30c4b9252064ed044adf1776ff9501841c4de2fe (diff) | |
download | hmacaroons-26d38f73993db56811d198a3e0b5c710722dd472.tar.gz hmacaroons-26d38f73993db56811d198a3e0b5c710722dd472.tar.zst hmacaroons-26d38f73993db56811d198a3e0b5c710722dd472.zip |
Disable third party caveats
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | src/Crypto/Macaroon.hs | 2 | ||||
-rw-r--r-- | test/Crypto/Macaroon/Tests.hs | 30 |
3 files changed, 17 insertions, 16 deletions
@@ -33,6 +33,7 @@ Implementations | |||
33 | TODO | 33 | TODO |
34 | ==== | 34 | ==== |
35 | 35 | ||
36 | - Third party caveats | ||
36 | - Verify Macaroons | 37 | - Verify Macaroons |
37 | - Discharge Macaroons | 38 | - Discharge Macaroons |
38 | - JSON serialization | 39 | - JSON serialization |
diff --git a/src/Crypto/Macaroon.hs b/src/Crypto/Macaroon.hs index 36aecf9..f955ab8 100644 --- a/src/Crypto/Macaroon.hs +++ b/src/Crypto/Macaroon.hs | |||
@@ -41,7 +41,7 @@ module Crypto.Macaroon ( | |||
41 | , create | 41 | , create |
42 | , inspect | 42 | , inspect |
43 | , addFirstPartyCaveat | 43 | , addFirstPartyCaveat |
44 | , addThirdPartyCaveat | 44 | -- , addThirdPartyCaveat |
45 | ) where | 45 | ) where |
46 | 46 | ||
47 | import Crypto.Cipher.AES | 47 | import Crypto.Cipher.AES |
diff --git a/test/Crypto/Macaroon/Tests.hs b/test/Crypto/Macaroon/Tests.hs index 6fa6504..244ec50 100644 --- a/test/Crypto/Macaroon/Tests.hs +++ b/test/Crypto/Macaroon/Tests.hs | |||
@@ -24,7 +24,7 @@ tests :: TestTree | |||
24 | tests = testGroup "Crypto.Macaroon" [ basic | 24 | tests = testGroup "Crypto.Macaroon" [ basic |
25 | , minted | 25 | , minted |
26 | , minted2 | 26 | , minted2 |
27 | , minted3 | 27 | -- , minted3 |
28 | ] | 28 | ] |
29 | 29 | ||
30 | 30 | ||
@@ -93,20 +93,20 @@ mint2Trimmed = testCase "Serialization" $ | |||
93 | mint2Des = testCase "Deserialization" $ | 93 | mint2Des = testCase "Deserialization" $ |
94 | Right m3 @=? (deserialize . serialize) m3 | 94 | Right m3 @=? (deserialize . serialize) m3 |
95 | 95 | ||
96 | m4 :: Macaroon | 96 | -- m4 :: Macaroon |
97 | m4 = addThirdPartyCaveat caveat_key caveat_id caveat_loc n | 97 | -- m4 = addThirdPartyCaveat caveat_key caveat_id caveat_loc n |
98 | where | 98 | -- where |
99 | n = addFirstPartyCaveat "account = 3735928559" $ create sec key loc | 99 | -- n = addFirstPartyCaveat "account = 3735928559" $ create sec key loc |
100 | key = B8.pack "we used our other secret key" | 100 | -- key = B8.pack "we used our other secret key" |
101 | loc = B8.pack "http://mybank/" | 101 | -- loc = B8.pack "http://mybank/" |
102 | sec = B8.pack "this is a different super-secret key; never use the same secret twice" | 102 | -- sec = B8.pack "this is a different super-secret key; never use the same secret twice" |
103 | caveat_key = B8.pack "4; guaranteed random by a fair toss of the dice" | 103 | -- caveat_key = B8.pack "4; guaranteed random by a fair toss of the dice" |
104 | caveat_id = B8.pack "this was how we remind auth of key/pred" | 104 | -- caveat_id = B8.pack "this was how we remind auth of key/pred" |
105 | caveat_loc = B8.pack "http://auth.mybank/" | 105 | -- caveat_loc = B8.pack "http://auth.mybank/" |
106 | 106 | ||
107 | minted3 :: TestTree | 107 | -- minted3 :: TestTree |
108 | minted3 = testGroup "Macaroon with first and third party caveats" [ mint3sig ] | 108 | -- minted3 = testGroup "Macaroon with first and third party caveats" [ mint3sig ] |
109 | 109 | ||
110 | 110 | ||
111 | mint3sig = testCase "Signature" $ | 111 | -- mint3sig = testCase "Signature" $ |
112 | "6B99EDB2EC6D7A4382071D7D41A0BF7DFA27D87D2F9FEA86E330D7850FFDA2B2" @=? (hex . signature) m4 | 112 | -- "6B99EDB2EC6D7A4382071D7D41A0BF7DFA27D87D2F9FEA86E330D7850FFDA2B2" @=? (hex . signature) m4 |