Commit Graph

20 Commits

Author SHA1 Message Date
Ten0 f9771f7835 Improve deserialization performance around validation and its tests (#202)
* Improve deserialization performance around validation and its tests

The claims validation was done via deserializing into a Map, which
implies allocations/deallocations. This was done even if the map was not
used afterwards.

This commit improves performance of the validation by never
deserializing in a `Map`, and deserializing only when necessary, to
a struct that typically only borrows from the original b64-decoded
json string.

The validation function interface change required update to the tests,
which are also made easier to read by using the `serde_json::json!`
macro.

* unrelated: fix bench compilation
2022-02-02 22:10:11 +01:00
Piotr Maks 90b9700748
Clippy (#146)
* Bump minimum required Rust version to 1.40

Motivation for this change is use of `#[non_exhaustive]` attribute that
was stabilized in Rust 1.40.0

* Migrate benchmarks to criterion

Remove use of unstable features in favour of criterion benchmarks

* Enable clippy in Github Actions

* Fix clippy::manual_non_exhaustive

Remove manual implementations of the non-exhaustive pattern. Instead
use the `#[non_exhaustive]` attribute.

* Allow reexport of deprecated function

Silence rustc `deprecated` working in function reexport

* Remove redundant clone

* Fix various clippy warnings

* Remove redundant pattern
* Use `unreachable!()` to fail test
* No need to add `&` to all patterns
2020-08-31 12:04:57 +02:00
Vincent Prouillet 77ae0effc8 Add DecodingKey 2019-12-29 21:50:06 +01:00
Vincent Prouillet 51dacd9bc4 Update docs 2019-11-14 19:43:43 +01:00
Jake Shadle d51a3f632d Fix benches 2019-05-15 16:20:32 +02:00
Vincent Prouillet 8f0809318d rustfmt 2018-10-28 19:58:35 +01:00
Vincent Prouillet 07b6ee2a19 Remove unused import 2017-04-23 13:29:07 +09:00
Vincent Prouillet fc9f83b837 No need to pass an algorithm to decode 2017-04-22 15:21:44 +09:00
Vincent Prouillet 57c513c757 Actually take a ref to Validation
Seems like I updated the docs but not the code...
2017-04-14 20:32:40 +09:00
Vincent Prouillet 410499e6b6 Add validation 2017-04-12 17:51:05 +09:00
Vincent Prouillet bdeefe5ed7 Fix bench and docs 2017-04-11 12:58:50 +09:00
Vincent Prouillet e3a4294e85 Move to serde + base64
Remove Part trait
Move tests to tests directory
Reorganise code
2017-04-11 12:40:40 +09:00
Vincent Prouillet 002f8a8c7f Change order of encode method args + make alg field public 2015-12-21 19:24:13 +00:00
Vincent Prouillet 275c95281f Use bytes for secret on encode as well for symmetry 2015-12-20 00:41:22 +00:00
Vincent Prouillet 1179eb8b55 Add all params of header from RFC 2015-12-18 21:07:48 +00:00
Kevin Butler 4ebcfca049 Rewrite decode 2015-11-06 22:45:47 +00:00
Kevin Butler 09c4d14609 Weaken parameter requirements for encode 2015-11-06 17:23:29 +00:00
Vincent Prouillet 31d99324e2 Remove useless import + improve readme 2015-11-02 23:32:32 +00:00
Vincent Prouillet e11579c604 Rename to jsonwebtoken 2015-11-02 23:27:28 +00:00
Vincent Prouillet 96acf8f143 Move benches to a folder + add license 2015-11-02 21:15:45 +00:00