-
Notifications
You must be signed in to change notification settings - Fork 7
/
libjwt-typed.cabal
174 lines (166 loc) · 7.81 KB
/
libjwt-typed.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
cabal-version: 2.4
name: libjwt-typed
version: 0.2
synopsis: A Haskell implementation of JSON Web Token (JWT)
description: A Haskell implementation of JSON Web Token (JWT)
.
= Key features
.
== Type-safety
.
Above Haskell standard type-safety, the library keeps track of public and private claim names and types. There are no user-facing @HashMap@s in this library!
A type of a JWT token might be: @Jwt '["user_name" ->> Text, "is_root" ->> Bool, "user_id" ->> UUID, "created" ->> UTCTime, "accounts" ->> NonEmpty (UUID, Text)] ('SomeNs "https://example.com")@.
From information encoded with precise types, it automatically derives encoders and decoders. It can also work with generic representations such as records.
.
== Speed and robustness
.
@libjwt-typed@ uses [libjwt](https://github.com/benmcollins/libjwt) for low-level functionality. @libjwt@ delegates cryptographic work to either @GnuTLS@ or @OpenSSL@.
This way, not only the most performance-sensitive features work lightning fast, they are also extremely reliable.
Besides, the library does not depend on any JSON library like @aeson@, but it implements the necessary JSON processing in C via [jsmn](https://github.com/zserge/jsmn) - which makes it even faster. Benchmarking shows that it can be over 10 times faster than other Haskell JWT libraries.
.
== Ease of use
.
The library is designed for frictionless use.
It can be easily extended, e.g. to add support for new types or to use custom JSON encodings compatible with other libraries you may already use in your project. Most instances can be derived automatically.
The compilation errors are designed to be informational, i.e. you get @Claim "user_name" does not exist in this claim set@ from GHC, not some 3 page long instance resolution output.
.
= Installation
.
You must have [libjwt](https://github.com/benmcollins/libjwt) (preferrably the latest version) installed on your system and visible to the linker.
.
@libjwt-typed@ links to it at compile time.
You can configure @libjwt@ with @GnuTLS@ or @OpenSSL@
.
Please see the full [README](https://github.com/marcin-rzeznicki/libjwt-typed) or browse the docs for more details.
homepage: https://github.com/marcin-rzeznicki/libjwt-typed
bug-reports: https://github.com/marcin-rzeznicki/libjwt-typed/issues
license: MPL-2.0
license-files: LICENSE
src/cbits/jsmn/LICENSE
author: Marcin Rzeźnicki
maintainer: Marcin Rzeźnicki <[email protected]>
copyright: 2020 Marcin Rzeźnicki
category: Web
build-type: Simple
extra-source-files: src/cbits/jsmn/jsmn.h
src/cbits/jsmn/Makefile
extra-doc-files: README.md
CHANGELOG.md
tested-with: GHC == 8.8.3
GHC == 8.10.1
GHC == 8.10.2
GHC == 8.10.3
source-repository head
type: git
location: https://github.com/marcin-rzeznicki/libjwt-typed.git
common common-options
build-depends: base >= 4.13.0.0 && < 4.15,
bytestring ^>= 0.10.10.0,
exceptions ==0.10.4,
either ^>= 5.0.1.1,
transformers ^>= 0.5.6.2,
uuid >= 1.3,
text >= 1.2.3.2 && < 1.2.5,
time >=1.9 && < 1.10,
monad-time ==0.3.*,
data-default >= 0.2 && < 1.0,
extra ^>= 1.7,
ghc-options: -Wall
-Wcompat
-Widentities
-Wincomplete-uni-patterns
-Wincomplete-record-updates
-fdefer-typed-holes
if impl(ghc >= 8.0)
ghc-options: -Wredundant-constraints
if impl(ghc >= 8.2)
ghc-options: -fhide-source-paths
if impl(ghc >= 8.4)
ghc-options: -Wmissing-export-lists
-Wpartial-fields
if impl(ghc >= 8.8)
ghc-options: -Wmissing-deriving-strategies
default-language: Haskell2010
library
import: common-options
hs-source-dirs: src
build-depends: unordered-containers ^>= 0.2.10.0,
utf8-string ^>= 1.0.1.1,
proxied ==0.3.*,
casing ^>= 0.1.4.1,
case-insensitive >= 1.2.0.0
exposed-modules: Web.Libjwt
Libjwt.Jwt
Libjwt.Exceptions
Libjwt.Header
Libjwt.RegisteredClaims
Libjwt.Payload
Libjwt.JwtValidation
Libjwt.ASCII
Libjwt.NumericDate
Libjwt.Flag
Libjwt.PrivateClaims
Libjwt.Classes
Libjwt.Encoding
Libjwt.Decoding
Libjwt.Keys
Libjwt.Algorithms
Libjwt.JsonByteString
Libjwt.FFI.Jwt
other-modules: Libjwt.FFI.Jsmn
Libjwt.FFI.Libjwt
Web.Libjwt.Tutorial
cc-options: -DJSMN_STATIC
-DJSMN_PARENT_LINKS
-DJSMN_STRICT
-march=native
-mtune=native
-O2
-fno-plt
include-dirs: src/cbits/jsmn
c-sources: src/cbits/HsJsonTokenizer.c
extra-libraries: jwt
test-suite libjwt-typed-test
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
other-modules: Env
Generators
Properties
Interop.JWTHelpers
Interop.JWTEncoding
Interop.JWTDecoding
build-depends: libjwt-typed,
jwt >= 0.10.0,
containers,
aeson,
hspec ==2.7.*,
hspec-core ==2.7.*,
QuickCheck >= 2.13.2 && < 2.15,
quickcheck-instances >= 0.3.14
ghc-options: -threaded
-rtsopts
"-with-rtsopts=-N -A64m -n4m -ki2k"
benchmark libjwt-typed-benchmark
import: common-options
type: exitcode-stdio-1.0
hs-source-dirs: bench
main-is: Benchmarks.hs
other-modules: Env
Algorithms
Benchmarks.Libjwt
Benchmarks.Jose
Benchmarks.Data
build-depends: libjwt-typed,
criterion,
QuickCheck >= 2.13.2 && < 2.15,
jose >= 0.8.3,
lens,
aeson,
unordered-containers,
deepseq >= 1.4.4.0
ghc-options: -O2
-threaded
-rtsopts
"-with-rtsopts=-N -s -ki2k -A512m -n32m"