aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJulien Tanguy <julien.tanguy@jhome.fr>2015-05-06 11:15:04 +0200
committerJulien Tanguy <julien.tanguy@jhome.fr>2015-05-06 11:15:04 +0200
commit7001a61e8fa105cd51715e471d0a682bf23528fd (patch)
tree2ee75ab9a5959baa23db6fd9b60c63aa610ada13
parenta22bcdb648d1f540ae895cb246997dcdcce7b568 (diff)
downloadhmacaroons-7001a61e8fa105cd51715e471d0a682bf23528fd.tar.gz
hmacaroons-7001a61e8fa105cd51715e471d0a682bf23528fd.tar.zst
hmacaroons-7001a61e8fa105cd51715e471d0a682bf23528fd.zip
Nixify package & documentation
Added quickcheck helper
-rw-r--r--.travis.yml1
-rw-r--r--CONTRIBUTING.md26
-rw-r--r--default.nix20
-rw-r--r--hmacaroons.cabal62
-rw-r--r--shell.nix8
-rw-r--r--test/Crypto/Macaroon/Instances.hs6
6 files changed, 117 insertions, 6 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..999bd37
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1 @@
language: haskell
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..3e85b0b
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,26 @@
1How to contribute
2=================
3First and most important: Submit issues !
4
5If you want to contribute, please fork the repo, and send us a pull request with
6your changes.
7
8Tests and cabal flags
9---------------------
10For this project we use the standard hunit/quickcheck tests.
11If you want to submit a new feature, please try to integrate at least
12*some* tests.
13
14Code style
15----------
16We do not impose any specific style of code, but you can improve your code
17by running it through `hlint`.
18
19Crypto analysis
20---------------
21This library has **not** been audited by security experts !
22It relies on an existing implementation and crypto libraries.
23
24Any analysis is welcome, and I will gladly merge it.
25
26
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..10ee0b9
--- /dev/null
+++ b/default.nix
@@ -0,0 +1,20 @@
1{ mkDerivation, attoparsec, base, base64-bytestring, byteable
2, bytestring, cereal, cipher-aes, cryptohash, deepseq, hex, stdenv
3, tasty, tasty-hunit, tasty-quickcheck
4}:
5mkDerivation {
6 pname = "hmacaroons";
7 version = "0.1.0.0";
8 src = ./.;
9 buildDepends = [
10 attoparsec base base64-bytestring byteable bytestring cereal
11 cipher-aes cryptohash deepseq hex
12 ];
13 testDepends = [
14 attoparsec base base64-bytestring byteable bytestring cereal
15 cryptohash hex tasty tasty-hunit tasty-quickcheck
16 ];
17 homepage = "https://github.com/jtanguy/hmacaroons";
18 description = "Haskell implementation of macaroons";
19 license = stdenv.lib.licenses.bsd3;
20}
diff --git a/hmacaroons.cabal b/hmacaroons.cabal
index 2b23c89..5590af6 100644
--- a/hmacaroons.cabal
+++ b/hmacaroons.cabal
@@ -1,23 +1,73 @@
1name: hmacaroons 1name: hmacaroons
2version: 0.1.0.0 2version: 0.1.0.0
3synopsis: Haskell implementation of macaroons 3synopsis: Haskell implementation of macaroons
4-- description: 4description:
5 = Macaroons: Pure haskell implementation of macaroons
6 #macaroons-pure-haskell-implementation-of-macaroons#
7
8 Macaroons is a pure haskell implementation of macaroons. It aims to
9 provide compatibility at a serialized level with the
10 <https://github.com/rescrv/libmacaroons reference implementation> and
11 the <https://github.com/ecordell/pymacaroons python implementation>
12
13 __WARNING: This library has not been audited by security experts.__
14 __There is no error handling at the moment, everyhting is silently
15 accepted__
16
17 It is developed in the purpose of exploration purposes, and would need
18 much more attention if it were to be used in production.
19
20 = References
21 #references#
22
23 == Papers and articles
24 #papers-and-articles#
25
26 - <http://research.google.com/pubs/pub41892.html Google paper on macaroons>
27 - <https://air.mozilla.org/macaroons-cookies-with-contextual-caveats-for-decentralized-authorization-in-the-cloud/ Macaroons at Mozilla>
28 - <http://hackingdistributed.com/2014/11/23/macaroons-in-hyperdex/ Time for better security in NoSQL>
29
30 == Implementations
31 #implementations#
32
33 - <https://github.com/rescrv/libmacaroons C>
34 - <https://github.com/nitram509/jmacaroons Java>
35 - <https://github.com/nitram509/macaroons.js Node.js>
36 - <https://github.com/ecordell/pymacaroons Python>
37 - <https://github.com/cryptosphere/rust-macaroons.git Rust>
38
39 = TODO
40 #todo#
41
42 - Third party caveats
43 - Verify Macaroons
44 - Discharge Macaroons
45 - JSON serialization
46 - Quickcheck tests
47 - Error handling
48 - FFI\'s for testing and benchmarking purposes
5license: BSD3 49license: BSD3
6license-file: LICENSE 50license-file: LICENSE
7author: Julien Tanguy 51author: Julien Tanguy
8maintainer: julien.tanguy@jhome.fr 52maintainer: julien.tanguy@jhome.fr
9-- copyright: 53homepage: https://github.com/jtanguy/hmacaroons
54bug-reports: https://github.com/jtanguy/hmacaroons/issues
10category: Data 55category: Data
11build-type: Simple 56build-type: Simple
12extra-source-files: README.md 57extra-source-files: README.md
58 CONTRIBUTING.md
13cabal-version: >=1.10 59cabal-version: >=1.10
14 60
61source-repository head
62 type: git
63 branch: master
64 location: https://github.com/jtanguy/hmacaroons
65
15library 66library
16 exposed-modules: Crypto.Macaroon, 67 exposed-modules: Crypto.Macaroon,
17 Crypto.Macaroon.Binder 68 Crypto.Macaroon.Binder
18 Crypto.Macaroon.Serializer.Base64 69 Crypto.Macaroon.Serializer.Base64
19 other-modules: Crypto.Macaroon.Internal 70 other-modules: Crypto.Macaroon.Internal
20 -- other-extensions:
21 build-depends: base >=4 && < 5, 71 build-depends: base >=4 && < 5,
22 attoparsec >=0.12, 72 attoparsec >=0.12,
23 bytestring >=0.10, 73 bytestring >=0.10,
@@ -41,14 +91,14 @@ benchmark bench
41 attoparsec >=0.12, 91 attoparsec >=0.12,
42 bytestring >=0.10, 92 bytestring >=0.10,
43 base64-bytestring >= 1.0, 93 base64-bytestring >= 1.0,
94 byteable >= 0.1 && <0.2,
44 cereal >= 0.4, 95 cereal >= 0.4,
45 cryptohash >=0.11 && <0.12, 96 cryptohash >=0.11 && <0.12,
46 cipher-aes >=0.2 && <0.3, 97-- cipher-aes >=0.2 && <0.3,
47 byteable >= 0.1 && <0.2,
48 hex >= 0.1, 98 hex >= 0.1,
49 deepseq >= 1.1, 99 deepseq >= 1.1,
50 criterion >= 1.1 100 criterion >= 1.1
51 101
52test-suite test 102test-suite test
53 default-language: Haskell2010 103 default-language: Haskell2010
54 type: exitcode-stdio-1.0 104 type: exitcode-stdio-1.0
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..07952fc
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,8 @@
1with (import <nixpkgs> {}).pkgs;
2let hspkgs = haskell-ng.packages.ghc7101.override {
3 overrides = self: super: {
4 hmacaroons = self.callPackage ./. {};
5 };
6 };
7in
8 hspkgs.hmacaroons.env
diff --git a/test/Crypto/Macaroon/Instances.hs b/test/Crypto/Macaroon/Instances.hs
index 5d4b062..4e2f39f 100644
--- a/test/Crypto/Macaroon/Instances.hs
+++ b/test/Crypto/Macaroon/Instances.hs
@@ -23,6 +23,12 @@ import Test.Tasty.QuickCheck
23 23
24import Crypto.Macaroon 24import Crypto.Macaroon
25 25
26
27-- | Adjust the size parameter, by transforming it with the given
28-- function.
29scale :: (Int -> Int) -> Gen a -> Gen a
30scale f g = sized (\n -> resize (f n) g)
31
26newtype Url = Url { unUrl :: BS.ByteString } deriving (Show) 32newtype Url = Url { unUrl :: BS.ByteString } deriving (Show)
27 33
28instance Arbitrary Url where 34instance Arbitrary Url where