commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
5c652c6010e82b28f1cb785151681934c6f4d06a | Marc-Antoine Perennou | 2020-11-04T21:19:41 | split expected threads number from actual threads number
Do not decrement actual threads number until the thread has actually finished,
but decreade the expected threads number as soon as we ask it to.
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 6e3fba2..0e14879 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -52,6 +52,7 @@ static GLOBAL_EXECUTOR_CONFIG: OnceCell<Config> = OnceCell::new();
static GLOBAL_EXECUTOR_THREADS: Lazy<()> = Lazy::new(init);
static GLOBAL_EXECUTOR_THREADS_NUMBER: Mutex<usize> = Mutex::new(0);
+... | 1 | 8 | 3 |
33993fbd79598651f3dffa81d37111cbc98c988f | Marc-Antoine Perennou | 2020-11-04T21:02:17 | tokio02: don't spawn a new Runtime if there is already one
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/tokio02.rs b/src/tokio02.rs
index 4f92945..1d578fb 100644
--- a/src/tokio02.rs
+++ b/src/tokio02.rs
@@ -6,15 +6,19 @@ pub(crate) fn enter<F: FnOnce() -> R, R>(f: F) -> R {
}
static RUNTIME: Lazy<tokio::runtime::Handle> = Lazy::new(|| {
- let mut rt = tokio::runtime::Runtime::new().expect("failed... | 1 | 13 | 9 |
ca1650d5c3ca861ada1c8f8fb8662be76a2bbd17 | Marc-Antoine Perennou | 2020-11-04T20:58:39 | move tokio impl to modules
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 8fca8cf..6e3fba2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -311,9 +311,9 @@ mod reactor {
#[cfg(not(feature = "async-io"))]
let run = || future::block_on(future);
#[cfg(feature = "tokio02")]
- let run = || crate::TOKIO02.enter(|| run());
+ ... | 3 | 81 | 68 |
e3fca93f7b038143b1d34042e0194d23d9edfe51 | Marc-Antoine Perennou | 2020-11-04T12:26:32 | rework config
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index ebd4d9c..8fca8cf 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -37,6 +37,7 @@ use async_mutex::Mutex;
use futures_lite::future;
use once_cell::sync::{Lazy, OnceCell};
use std::{
+ fmt,
future::Future,
io,
sync::atomic::{AtomicUsize, Ordering},
@@ -133,16 +13... | 1 | 44 | 34 |
114bb25fe88d9a5e6456f8ca53e5672f13cf19f8 | Marc-Antoine Perennou | 2020-11-04T11:39:33 | extract thread main loop into its own fn
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 12ffc62..ebd4d9c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -264,24 +264,7 @@ pub async fn spawn_more_threads(count: usize) -> io::Result<()> {
GLOBAL_EXECUTOR_NEXT_THREAD.fetch_add(1, Ordering::SeqCst),
)
}))
- .s... | 1 | 21 | 18 |
ff0cc4df99a479445611b169d3b6cf1d55df5b58 | Marc-Antoine Perennou | 2020-11-04T09:37:58 | Store number of threads in a Mutex
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 290dc56..99104a9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -20,6 +20,7 @@ tokio03 = ["tokio03-crate"]
[dependencies]
async-channel = "^1.5"
async-executor = "^1.3"
+async-mutex = "^1.4"
futures-lite = "^1.0"
num_cpus = "^1.13"
once_cell = "^1.4"
diff --git a/src/lib.rs... | 2 | 21 | 14 |
c1d87aaad80211e39525462ec563cfb51cf5d01a | Marc-Antoine Perennou | 2020-11-04T08:40:06 | add helpers to shutdown some executor threads
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 36026c0..290dc56 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,6 +18,7 @@ tokio02 = ["tokio02-crate"]
tokio03 = ["tokio03-crate"]
[dependencies]
+async-channel = "^1.5"
async-executor = "^1.3"
futures-lite = "^1.0"
num_cpus = "^1.13"
diff --git a/src/lib.rs b/src/lib.... | 2 | 47 | 1 |
9deed5cdfcd5dc0b94423f206cdccfe9da9a2601 | Marc-Antoine Perennou | 2020-11-04T08:43:51 | rearrange code
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 63e770e..291a25c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -43,19 +43,7 @@ use std::{
pub use async_executor::Task;
-mod reactor {
- pub(crate) fn block_on<F: std::future::Future<Output = T>, T>(future: F) -> T {
- #[cfg(feature = "async-io")]
- let run... | 1 | 122 | 109 |
58833131ec26393a0bd9946143246b25bd17422b | Marc-Antoine Perennou | 2020-11-03T09:24:30 | nuke now unneeded GLOBAL_EXECUTOR_INIT
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 5c11aec..63e770e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -37,7 +37,7 @@ use once_cell::sync::{Lazy, OnceCell};
use std::{
future::Future,
io,
- sync::atomic::{AtomicBool, AtomicUsize, Ordering},
+ sync::atomic::{AtomicUsize, Ordering},
thread,
};
@... | 1 | 2 | 3 |
f9162942e08d73da1d5470f6a3f13cd4bf3b9ead | Marc-Antoine Perennou | 2020-11-03T09:01:11 | track the number of threads we run and try not to go beyond max_threads
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index d34b6ee..5c11aec 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -61,6 +61,7 @@ static GLOBAL_EXECUTOR_CONFIG: OnceCell<Config> = OnceCell::new();
static GLOBAL_EXECUTOR_INIT: AtomicBool = AtomicBool::new(false);
static GLOBAL_EXECUTOR_THREADS: Lazy<()> = Lazy::new(init);
+sta... | 1 | 5 | 0 |
2d964bdb55a724490672fd7ea2bd122d9b82d975 | Marc-Antoine Perennou | 2020-11-03T08:57:34 | seal external config into an internal struct
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 2dca608..d34b6ee 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -57,9 +57,10 @@ mod reactor {
}
}
-static GLOBAL_EXECUTOR_CONFIG: OnceCell<GlobalExecutorConfig> = OnceCell::new();
+static GLOBAL_EXECUTOR_CONFIG: OnceCell<Config> = OnceCell::new();
static GLOBAL_EXECUTOR_... | 1 | 33 | 10 |
ef8c5862298cdd0f93ba07c58c1cda3fb5465760 | Marc-Antoine Perennou | 2020-11-03T08:28:11 | add a method to spawn more threads
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index b2b1467..2dca608 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -36,7 +36,8 @@ use futures_lite::future;
use once_cell::sync::{Lazy, OnceCell};
use std::{
future::Future,
- sync::atomic::{AtomicBool, Ordering},
+ io,
+ sync::atomic::{AtomicBool, AtomicUsize, Order... | 1 | 41 | 24 |
6bc0180a92a2216c958f164665a938b1357e22c7 | Marc-Antoine Perennou | 2020-11-03T08:24:59 | store config in a OnceCell
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 5f71b4f..b2b1467 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -33,7 +33,7 @@ doc_comment::doctest!("../README.md");
use async_executor::{Executor, LocalExecutor};
use futures_lite::future;
-use once_cell::sync::Lazy;
+use once_cell::sync::{Lazy, OnceCell};
use std::{
... | 1 | 17 | 14 |
48161982143cc0460e1be2d5c8eedb247790f54d | Marc-Antoine Perennou | 2020-10-28T15:40:57 | tokio03: switch to multi threaded runtime
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 702a2de..895adea 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -39,7 +39,7 @@ package = "tokio"
version = "^0.3"
optional = true
default-features = false
-features = ["rt"]
+features = ["rt", "rt-multi-thread"]
[dev-dependencies]
doc-comment = "^0.3"
diff --git a/src/lib.... | 2 | 3 | 6 |
60dd41506342d781c83092258eede74a9de9f13b | Marc-Antoine Perennou | 2020-10-28T15:39:08 | tokio02: don't enforce single thread tokio runtime
Let tokio decide depending on enabled features
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 3201ebe..0b828da 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -67,18 +67,14 @@ thread_local! {
#[cfg(feature = "tokio02")]
static TOKIO02: Lazy<tokio02_crate::runtime::Handle> = Lazy::new(|| {
- let mut rt = tokio02_crate::runtime::Builder::new()
- .enable_all()
-... | 1 | 2 | 6 |
734625a254d6ebb73bdb60a6ab81f68fbc58844d | Marc-Antoine Perennou | 2020-10-19T07:40:47 | drop avoidable Arc
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 6ff9f5f..3201ebe 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,23 +83,17 @@ static TOKIO02: Lazy<tokio02_crate::runtime::Handle> = Lazy::new(|| {
});
#[cfg(feature = "tokio03")]
-static TOKIO03: Lazy<std::sync::Arc<tokio03_crate::runtime::Runtime>> = Lazy::new(|| {
- ... | 1 | 11 | 17 |
f8bd46f9be7a624802c99d85a17b2282fe25a7fa | Marc-Antoine Perennou | 2020-10-19T07:32:52 | simplify block_on
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index b94f718..6ff9f5f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,10 +45,9 @@ pub use async_executor::Task;
mod reactor {
pub(crate) fn block_on<F: std::future::Future<Output = T>, T>(future: F) -> T {
#[cfg(feature = "async-io")]
- use async_io::block_on;... | 1 | 2 | 3 |
eb9caf2b5bb5bef080a054892823b116ed2fe1a3 | Marc-Antoine Perennou | 2020-10-19T07:27:09 | tokio02: drop async-compat
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index e51c5ac..793c41a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ readme = "README.md"
[features]
default = ["async-io"]
-tokio02 = ["async-compat"]
+tokio02 = ["tokio02-crate"]
tokio03 = ["tokio03-crate"]
[dependencies]
@@ -23,26 +23,23 @@ futures-lite = "^1... | 2 | 29 | 14 |
3f0d6ce7d68ac6a57c72bbf2909a51d44668a777 | Marc-Antoine Perennou | 2020-10-17T19:11:46 | typo
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index e49012e..37cc77b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -51,7 +51,7 @@ mod reactor {
#[cfg(feature = "tokio02")]
let future = async_compat::Compat::new(future);
#[cfg(feature = "tokio03")]
- let _tokio93_enter = crate::TOKIO03.enter();
+ ... | 1 | 1 | 1 |
3a72be2a6a5eb5d603168ab5fa76ed08d1c03fd3 | Marc-Antoine Perennou | 2020-10-16T09:00:12 | rustfmt
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 24fbd2a..e49012e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -67,7 +67,12 @@ thread_local! {
#[cfg(feature = "tokio03")]
static TOKIO03: Lazy<std::sync::Arc<tokio03_crate::runtime::Runtime>> = Lazy::new(|| {
- let rt = std::sync::Arc::new(tokio03_crate::runtime::Builder... | 1 | 6 | 1 |
6ab6ec6f075b27815ded6004a6f49a2f44bcf7c4 | Marc-Antoine Perennou | 2020-10-16T08:50:01 | v1.4.0
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index c62241a..e51c5ac 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "1.3.0"
+version = "1.4.0"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
0b450898f0a32f8e31dc603e0bdba9bf09b529df | Marc-Antoine Perennou | 2020-10-16T08:49:00 | add tokio03 compatibility
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index df8f841..c62241a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ readme = "README.md"
[features]
default = ["async-io"]
tokio02 = ["async-compat"]
+tokio03 = ["tokio03-crate"]
[dependencies]
async-executor = "^1.3"
@@ -30,11 +31,18 @@ optional = true
version... | 2 | 48 | 1 |
f06cebbff1bf77f1f34649d848a63675b1884cdd | Marc-Antoine Perennou | 2020-10-15T13:16:32 | rename tokio dev-dependency
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 4725f73..df8f841 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -30,7 +30,8 @@ optional = true
version = "^1.0"
optional = true
-[dev-dependencies.tokio]
+[dev-dependencies.tokio02-crate]
+package = "tokio"
version = "^0.2"
default-features = false
features = ["rt-threaded... | 2 | 3 | 1 |
4d6dc37b804d575ea8813c2c4e7d387801dee28b | Marc-Antoine Perennou | 2020-09-28T19:25:43 | switch tokio02 compat to async-compat
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 8c58a60..f3ae472 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,7 +14,7 @@ readme = "README.md"
[features]
default = ["async-io"]
-tokio02 = ["tokio"]
+tokio02 = ["async-compat"]
[dependencies]
async-executor = "^1.3"
@@ -22,15 +22,18 @@ futures-lite = "^1.0"
num_cpu... | 2 | 13 | 43 |
e3ba951d6f6c0e25de4893eeb6696519a68e1813 | Marc-Antoine Perennou | 2020-09-28T19:27:20 | deduplicate block_on selection
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 92fe963..8b6ff5d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,6 +42,16 @@ use std::{
pub use async_executor::Task;
+mod reactor {
+ pub(crate) fn block_on<F: std::future::Future<Output = T>, T>(future: F) -> T {
+ #[cfg(feature = "async-io")]
+ use asy... | 1 | 20 | 20 |
0c23a5ff89fe0fc3634dd1da29283025659aa4e6 | Marc-Antoine Perennou | 2020-09-28T18:55:57 | add tokio integration test
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 6fa4dac..92fe963 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -261,3 +261,24 @@ fn enter02<T>(f: impl FnOnce() -> T) -> T {
})
}
}
+
+#[cfg(all(test, feature = "tokio02"))]
+mod test_tokio02 {
+ use super::*;
+
+ async fn compute() -> u8 {
+ tokio::s... | 1 | 21 | 0 |
b773f5e560d75ee0700d827139943666f7239d80 | Marc-Antoine Perennou | 2020-09-22T15:12:35 | Fix failed amend
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index cbf3090..6fa4dac 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -246,7 +246,7 @@ fn enter02<T>(f: impl FnOnce() -> T) -> T {
}
/// The global tokio runtime.
- static RT: Lazy<Runtime> = new(|| Runtime::new().expect("cannot initialize tokio"));
+ ... | 1 | 1 | 1 |
7260e60a215e89a0b16d8acee8377a4208c2c62b | Marc-Antoine Perennou | 2020-09-22T14:54:03 | add tokio02 feature
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 3af0888..2d76082 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,7 @@ readme = "README.md"
[features]
default = ["async-io"]
+tokio02 = ["tokio"]
[dependencies]
async-executor = "^1.3"
@@ -25,5 +26,11 @@ once_cell = "^1.4"
version = "^1.0"
optional = true
+[d... | 2 | 47 | 5 |
50f4a647890906783ab55321eefc811334d544fc | Stjepan Glavina | 2020-09-20T14:42:16 | Update async-executor | diff --git a/Cargo.toml b/Cargo.toml
index cf4db2a..20b5867 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ readme = "README.md"
default = ["async-io"]
[dependencies]
-async-executor = "^1.2"
+async-executor = "^1.3"
futures-lite = "^1.0"
num_cpus = "^1.13"
once_cell = "^1.4"
diff --git a/src/lib.rs b... | 2 | 3 | 3 |
2b59d531406836d530cc95437839d6cac73cd5d3 | Marc-Antoine Perennou | 2020-09-20T10:52:30 | update async-executor
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index aa63592..5edde64 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ readme = "README.md"
default = ["async-io"]
[dependencies]
-async-executor = "^1.1.1"
+async-executor = "^1.2"
futures-lite = "^1.0"
num_cpus = "^1.13"
once_cell = "^1.4" | 1 | 1 | 1 |
527a6c33eaf3c4b75f9257c1c458a814f129dcce | Stjepan Glavina | 2020-09-17T14:22:14 | Fix deadlocks | diff --git a/Cargo.toml b/Cargo.toml
index 04e2e2f..beb79fa 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,6 @@ readme = "README.md"
default = ["async-io"]
[dependencies]
-async-channel = "^1.4"
async-executor = "^1.1.1"
futures-lite = "^1.0"
num_cpus = "^1.13"
diff --git a/src/lib.rs b/src/lib.rs
index 2... | 2 | 19 | 24 |
baf39bd368cfc75b7d7fb3e604412d90321f5923 | Marc-Antoine Perennou | 2020-09-07T15:37:50 | rustfmt
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 409f63b..3dad600 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -171,9 +171,9 @@ pub fn block_on<F: Future<Output = T>, T>(future: F) -> T {
let local = executor.run(r.recv());
let executors = future::zip(global, local);
let all = future::zip(executors,... | 1 | 2 | 2 |
36766aac1bbe5923c279bde4c597fce88ed5bf9c | Marc-Antoine Perennou | 2020-09-07T15:04:23 | update dependencies
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 17a9fdd..9ffbb3c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,13 +17,13 @@ default = ["async-io"]
[dependencies]
async-channel = "^1.4"
-async-executor = "^0.2"
+async-executor = "^1.0"
futures-lite = "^1.0"
num_cpus = "^1.13"
once_cell = "^1.4"
[dependencies.asyn... | 1 | 2 | 2 |
defffdbedfa14f88fbb32ef894cf180a0120badc | Marc-Antoine Perennou | 2020-09-02T13:12:45 | make async-io optional
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 27a2fe6..17a9fdd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,13 +12,19 @@ keywords = ["async", "await", "future", "executor"]
categories = ["asynchronous", "concurrency"]
readme = "README.md"
+[features]
+default = ["async-io"]
+
[dependencies]
async-channel = "^1.4"... | 2 | 12 | 2 |
15a33f4e22bbea486ca2cd1b517cabf2bac5763e | Marc-Antoine Perennou | 2020-08-28T13:31:10 | v0.2.3
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index b843271..27a2fe6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.2.2"
+version = "0.2.3"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
af46781354d7109cb8de69a8d16998438f9fadc3 | Marc-Antoine Perennou | 2020-08-28T07:43:41 | v0.2.2
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 02ffe88..782fb96 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.2.1"
+version = "0.2.2"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
a19f4fcb02580bc8e20ac1c3ce7161d3eda23a1b | Marc-Antoine Perennou | 2020-08-28T07:43:33 | reexport async_executor::Task
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index adad8ec..866a42b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -31,7 +31,7 @@
#[cfg(doctest)]
doc_comment::doctest!("../README.md");
-use async_executor::{Executor, LocalExecutor, Task};
+use async_executor::{Executor, LocalExecutor};
use futures_lite::future;
use once_cel... | 1 | 3 | 1 |
61683913ac69f12d57cc22d6d386e89f1eed4c92 | Marc-Antoine Perennou | 2020-08-28T07:31:47 | v0.2.1
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 39da77c..02ffe88 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
51692d992483be270340d1be9eccf8f7a3dd6f9a | Marc-Antoine Perennou | 2020-08-28T07:31:35 | spawn at least one thread
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index f8703af..adad8ec 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -106,7 +106,8 @@ pub fn init_with_config(config: GlobalExecutorConfig) {
let num_cpus = std::env::var(config.env_var.unwrap_or("ASYNC_GLOBAL_EXECUTOR_THREADS"))
.ok()
.and_then(|thr... | 1 | 2 | 1 |
cc6085f40a960f06494ea2cab03f161d2fa12acc | Marc-Antoine Perennou | 2020-08-28T07:27:32 | v0.2.0
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index e4d5fa3..39da77c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.1.4"
+version = "0.2.0"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
6ef41d7bdd8c01e8fff3397ecf4241ee54b98fd8 | Marc-Antoine Perennou | 2020-08-28T07:27:04 | don't stop executor threads on panic
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 207cd13..f8703af 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -118,7 +118,9 @@ pub fn init_with_config(config: GlobalExecutorConfig) {
n
)
}))
- .spawn(|| block_on(future::pending::<()>()))
+ ... | 1 | 3 | 1 |
559b706805d7edcae62118ab1afcdcd6a0cefda7 | Marc-Antoine Perennou | 2020-08-28T07:25:12 | GlobalExecutorConfig::with_hread_name
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index ba5aa41..207cd13 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -56,6 +56,8 @@ pub struct GlobalExecutorConfig {
pub env_var: Option<&'static str>,
/// The default number of threads to spawn.
pub default_threads: Option<usize>,
+ /// The name to us fo the thread... | 1 | 20 | 12 |
e5e831789b4c4d968eb7e8184213dea62e813d77 | Marc-Antoine Perennou | 2020-08-27T21:31:28 | v0.1.4
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 7c686e6..fae881c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.1.3"
+version = "0.1.4"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
65156d77af1bdc95b1b61dc259fad9a665445d88 | Marc-Antoine Perennou | 2020-08-27T21:16:23 | add init functions
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index e24dbe9..d2c9504 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -41,29 +41,91 @@ use std::{
};
static GLOBAL_EXECUTOR_INIT: AtomicBool = AtomicBool::new(false);
+static GLOBAL_EXECUTOR_THREADS: Lazy<()> = Lazy::new(init);
+
static GLOBAL_EXECUTOR: Executor = Executor::new();... | 1 | 68 | 6 |
826a4362fcd23478361ce6c11b470c3765a20cab | Marc-Antoine Perennou | 2020-08-27T16:30:21 | split threads initialization
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index c5d9d42..e24dbe9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -32,29 +32,39 @@
doc_comment::doctest!("../README.md");
use async_executor::{Executor, LocalExecutor, Task};
-use once_cell::sync::Lazy;
use futures_lite::future;
-use std::{cell::RefCell, future::Future, thread... | 1 | 31 | 20 |
8ada7916dbd9b37fcc87281de3dbd58acc37ebc1 | Marc-Antoine Perennou | 2020-08-27T15:45:26 | v0.1.3
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 02b88ce..7c686e6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.1.2"
+version = "0.1.3"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
a998695044275af2c3f0650ea559d659ce528e15 | Marc-Antoine Perennou | 2020-08-27T15:45:13 | run: do not require Future to be Send
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index e62dc4b..c5d9d42 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -69,10 +69,11 @@ thread_local! {
/// assert_eq!(task.await, 3);
/// });
/// ```
-pub fn run<F: Future<Output = T> + Send + 'static, T: Send + 'static>(future: F) -> T {
+pub fn run<F: Future<Output = T> + 'sta... | 1 | 3 | 2 |
e92c5037a12b53cba13cf938e4de78f3589c4c08 | Marc-Antoine Perennou | 2020-08-27T15:21:52 | v0.1.2
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 886a3a9..02b88ce 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.1.1"
+version = "0.1.2"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
115c96c701d395e48151c1365960819ca67d99d6 | Marc-Antoine Perennou | 2020-08-27T15:00:06 | v0.1.1
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/Cargo.toml b/Cargo.toml
index 5201a63..d69b57e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "async-global-executor"
-version = "0.1.0"
+version = "0.1.1"
authors = ["Marc-Antoine Perennou <Marc-Antoine@Perennou.com>"]
description = "A global executor built on top of async-... | 1 | 1 | 1 |
55c7e025db4ebb41e4dcd322062743db330a7690 | Marc-Antoine Perennou | 2020-08-27T14:59:55 | fix off-by-one in number of threads
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com> | diff --git a/src/lib.rs b/src/lib.rs
index 585a228..6c13626 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -42,7 +42,7 @@ static GLOBAL_EXECUTOR: Lazy<Executor> = Lazy::new(|| {
.and_then(|threads| threads.parse().ok())
.unwrap_or_else(num_cpus::get)
.max(1);
- for n in 1..num_cpus {
+ for... | 1 | 1 | 1 |
9934c7fe3aa7224b83594e9d4d1851df5f9e59f9 | Michael Scovetta | 2026-02-22T12:17:20 | Fix formatting in Ed25519 key serialization (#485)
In the thumbprint() function, the serialized format of the Ed25519 curve is missing double quotes around "crv", which would likely affect interoperability between other implementations.
Fixes #484 | diff --git a/src/jwk.rs b/src/jwk.rs
index 200bd04..a6ab15c 100644
--- a/src/jwk.rs
+++ b/src/jwk.rs
@@ -531,7 +531,7 @@ impl Jwk {
}
EllipticCurve::Ed25519 => {
format!(
- r#"{{crv:{},"kty":{},"x":"{}"}}"#,
+ r#"{{"crv... | 1 | 1 | 1 |
e99740d15420b735cd3ba90db1e8dfdbcaa51b2f | Carlos O'Ryan | 2026-01-27T09:50:18 | fix: bump minimal version requirements (#481)
Before these changes this fails:
```
cargo minimal-versions check --no-default-features --features aws_lc_rs
``` | diff --git a/Cargo.toml b/Cargo.toml
index 2211e6f..8f3885f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,7 @@ features = ["rust_crypto"]
[dependencies]
base64 = "0.22"
-serde = { version = "1.0", features = ["derive"] }
+serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0"
signature ... | 1 | 2 | 2 |
dfe58f99b49e08da856db61eb1fbcc0d1da22a2a | Ole Kristian Sandum | 2025-10-30T08:09:51 | Remove unnecessary Clone bounds from decode functions (#458) | diff --git a/src/decoding.rs b/src/decoding.rs
index 6d1fc42..51d793e 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -277,7 +277,7 @@ impl TryFrom<&Jwk> for DecodingKey {
/// // Claims is a struct that implements Deserialize
/// let token_message = decode::<Claims>(&token, &DecodingKey::from_secret("secret".as... | 1 | 2 | 4 |
d96982ded0e843a26e2afcc9ee34c63a0d017658 | Adam Gutglick | 2025-10-09T17:49:16 | Fix a few markdown issues in docs (#446) | diff --git a/src/crypto/mod.rs b/src/crypto/mod.rs
index 18cb1e1..adec0d0 100644
--- a/src/crypto/mod.rs
+++ b/src/crypto/mod.rs
@@ -1,6 +1,11 @@
//! The cryptography of the `jsonwebtoken` crate is decoupled behind
//! [`JwtSigner`] and [`JwtVerifier`] traits. These make use of `RustCrypto`'s
//! [`Signer`] and [`Ve... | 3 | 10 | 3 |
fbcfd39f2fcfb9acbeebc655f71b511a4bcf6868 | dsykes16 | 2025-10-09T08:13:49 | feat: add `dangerous::insecure_decode` (#441)
* feat: add `dangerous::insecure_decode`
Add `jsonwebtoken::dangerous::insecure_decode` to support decoding
headers and claims with no signature validation.
* chore: deprecate `insecure_disable_signature_validation`
Add deprecated attribute to
`Validation::insecure_disa... | diff --git a/src/decoding.rs b/src/decoding.rs
index 5fc70b8..6d1fc42 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -300,6 +300,23 @@ pub fn decode<T: DeserializeOwned + Clone>(
Ok(TokenData { header, claims })
}
+/// Decode a JWT with NO VALIDATION
+///
+/// DANGER: This performs zero validation on the... | 6 | 88 | 0 |
4ba3fcee1e75efea53d4937f44a13bf10235fc99 | dsykes16 | 2025-10-09T07:43:11 | fix(docs): add `rust_crypto` feature to docs.rs build (#443)
Add `rust_crypto` feature to docs.rs build to resolve failing docs.rs
build.
Closes #440 | diff --git a/Cargo.toml b/Cargo.toml
index 852c65c..441cc73 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,9 @@ include = [
]
rust-version = "1.85.0"
+[package.metadata.docs.rs]
+features = ["rust_crypto"]
+
[dependencies]
base64 = "0.22"
serde = { version = "1.0", features = ["derive"] } | 1 | 3 | 0 |
29fa3b1f7d18f80f4ef4e2c2144376c194206e03 | tottoto | 2025-10-09T07:43:00 | Implement TryFrom &Jwk for DecodingKey (#437) | diff --git a/examples/auth0.rs b/examples/auth0.rs
index f385722..ca9714f 100644
--- a/examples/auth0.rs
+++ b/examples/auth0.rs
@@ -2,7 +2,7 @@
use std::collections::HashMap;
use jsonwebtoken::jwk::JwkSet;
-use jsonwebtoken::{DecodingKey, Validation, decode, decode_header};
+use jsonwebtoken::{Validation, decode, ... | 2 | 10 | 4 |
14567554a5e0820d76797806638372c75a8635e3 | tottoto | 2025-09-30T19:34:58 | Use DecodingKey::from_jwk to get DecodingKey from JWK in auth0 example (#430) | diff --git a/examples/auth0.rs b/examples/auth0.rs
index 90d0a48..f385722 100644
--- a/examples/auth0.rs
+++ b/examples/auth0.rs
@@ -1,7 +1,7 @@
/// Example for the backend to backend implementation
use std::collections::HashMap;
-use jsonwebtoken::jwk::{AlgorithmParameters, JwkSet};
+use jsonwebtoken::jwk::JwkSet;... | 1 | 2 | 5 |
e72a3d4b53f859393c5365992c795f2b4bb13142 | Vincent Prouillet | 2025-09-29T19:37:12 | cargo fmt post edition bump | diff --git a/benches/jwt.rs b/benches/jwt.rs
index 5949183..6397d24 100644
--- a/benches/jwt.rs
+++ b/benches/jwt.rs
@@ -1,5 +1,5 @@
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
-use jsonwebtoken::{decode, encode, Algorithm, DecodingKey, EncodingKey, Header, Validation};
+use criterion::{Cri... | 25 | 51 | 51 |
c2f26101914b4b1817e732dbb74b1ed493d0592c | Vincent Prouillet | 2025-09-29T19:35:15 | Bump rust edition | diff --git a/Cargo.toml b/Cargo.toml
index 0044239..852c65c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -8,7 +8,7 @@ description = "Create and decode JWTs in a strongly typed way."
homepage = "https://github.com/Keats/jsonwebtoken"
repository = "https://github.com/Keats/jsonwebtoken"
keywords = ["jwt", "api", "token... | 1 | 1 | 1 |
ca09d64cc7d2ba85d1357c0afc72b7373e558b9b | Vincent Prouillet | 2025-09-29T09:26:34 | Add unknown alg for jwk
From #400 by @ThatNerdUKnow | diff --git a/src/jwk.rs b/src/jwk.rs
index 5144fd6..4cbfc91 100644
--- a/src/jwk.rs
+++ b/src/jwk.rs
@@ -190,6 +190,10 @@ pub enum KeyAlgorithm {
/// RSAES-OAEP-256 using SHA-2
#[serde(rename = "RSA-OAEP-256")]
RSA_OAEP_256,
+
+ /// Catch-All for when the key algorithm can not be determined or is not ... | 1 | 13 | 1 |
ac10042519edc4ec179390c40de6e6f7cb76238b | MarcusGrass | 2025-09-29T09:11:07 | Treat empty audience as equivalent to no audience (#350) | diff --git a/src/validation.rs b/src/validation.rs
index 8f6538e..369914f 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -321,6 +321,11 @@ pub(crate) fn validate(claims: ClaimsForValidation, options: &Validation) -> Res
// processing the claim does not identify itself with a value in the
//... | 1 | 5 | 0 |
0c6011db4b65d617c825cc887f7c28a7e7819603 | Vincent Prouillet | 2025-09-29T09:05:29 | Fix potential panic with bad exp set (#390)
Closes #388
All credits to @0xd-0 | diff --git a/src/validation.rs b/src/validation.rs
index 55957b4..8f6538e 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -275,6 +275,11 @@ pub(crate) fn validate(claims: ClaimsForValidation, options: &Validation) -> Res
if options.validate_exp || options.validate_nbf {
let now = get_current_tim... | 1 | 18 | 0 |
4d5e43fec42c7efd1742176d5b8c0658c76a6923 | Amin Ya | 2025-09-29T09:04:47 | fix: implement hash for JwkSet (#392)
This implements Hash for JwkSet, which allows it to be cached in a hashmap. | diff --git a/src/jwk.rs b/src/jwk.rs
index 15501cf..5144fd6 100644
--- a/src/jwk.rs
+++ b/src/jwk.rs
@@ -424,7 +424,7 @@ impl Jwk {
}
/// A JWK set
-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
+#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Hash)]
pub struct JwkSet {
pub keys... | 1 | 1 | 1 |
c3ca386b1f8ca8d6b8ebc1af697a1205503fed0a | brymko | 2025-09-29T09:02:45 | Make family public (#351)
* Made algorithm family public
* made family public
* Added src doc for alorightms on family | diff --git a/src/algorithms.rs b/src/algorithms.rs
index ee17c54..9d121be 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -5,13 +5,35 @@ use serde::{Deserialize, Serialize};
use crate::errors::{Error, ErrorKind, Result};
#[derive(Debug, Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
-pub(crate) enum... | 3 | 33 | 1 |
8b8fc1fd067973318a08ebeb88dabc5b2d6b4df6 | Matthew Martin | 2025-09-29T08:56:46 | Implement Debug on Decoding/EncodingKey while redacting sensitive fields (#406) | diff --git a/src/decoding.rs b/src/decoding.rs
index 2758d95..e287a47 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -1,3 +1,5 @@
+use std::fmt::{Debug, Formatter};
+
use base64::{engine::general_purpose::STANDARD, Engine};
use serde::de::DeserializeOwned;
@@ -69,9 +71,22 @@ pub(crate) enum DecodingKeyKind {... | 2 | 27 | 1 |
ab8dbb1dfb431c5476195d5998343ec6dddb2bda | Kjell Kongsvik | 2025-04-26T19:05:29 | fix: no panic if key_algorithm is not set in JWK (#425) | diff --git a/src/jwk.rs b/src/jwk.rs
index 49c5800..f9831d5 100644
--- a/src/jwk.rs
+++ b/src/jwk.rs
@@ -414,7 +414,10 @@ pub struct Jwk {
impl Jwk {
/// Find whether the Algorithm is implemented and supported
pub fn is_supported(&self) -> bool {
- self.common.key_algorithm.unwrap().to_algorithm().is_... | 1 | 4 | 1 |
88e48f3b44e27822865101673c049b006b5b4fba | MarcoFalke | 2024-07-04T08:14:21 | Update base64 to 0.22 | diff --git a/Cargo.toml b/Cargo.toml
index 5fd03f6..92178dd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,7 +22,7 @@ rust-version = "1.73.0"
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
-base64 = "0.21.0"
+base64 = "0.22"
# For PEM decoding
pem = { version = "3", optional ... | 1 | 1 | 1 |
aa5266d3f2c4d5b41f46757beefb3d092c1eea74 | tottoto | 2024-03-13T20:48:27 | Refactor auth0 example (#367) | diff --git a/examples/auth0.rs b/examples/auth0.rs
index ed9caae..df77622 100644
--- a/examples/auth0.rs
+++ b/examples/auth0.rs
@@ -1,9 +1,8 @@
/// Example for the backend to backend implementation
use std::collections::HashMap;
-use std::str::FromStr;
-use jsonwebtoken::jwk::AlgorithmParameters;
-use jsonwebtoken... | 1 | 26 | 28 |
193eb8de9e06a6a3927b0fe69a7c4ddaebe1ca50 | TellMin | 2023-12-17T20:07:30 | Fix typo in jwk.rs (#353) | diff --git a/src/jwk.rs b/src/jwk.rs
index 68575e2..49c5800 100644
--- a/src/jwk.rs
+++ b/src/jwk.rs
@@ -251,7 +251,7 @@ pub struct CommonParameters {
#[serde(rename = "kid", skip_serializing_if = "Option::is_none", default)]
pub key_id: Option<String>,
- /// X.509 Public key cerfificate URL. This is cur... | 1 | 2 | 2 |
95cfdfb38eecfe53c819187a3d0f994a182cc638 | tottoto | 2023-12-07T10:55:07 | Set expected audience to validation in auth0 example (#349) | diff --git a/examples/auth0.rs b/examples/auth0.rs
index 2964c3a..ed9caae 100644
--- a/examples/auth0.rs
+++ b/examples/auth0.rs
@@ -27,6 +27,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Algorithm::from_str(j.common.key_algorithm.unwrap().to_string().as_str())
... | 1 | 1 | 0 |
f112c08729ad383e8cf3b8dd7e98d40f0eecd4af | Sagun B | 2023-11-07T11:28:16 | Add the ability to decode a JWT token without specifying an audience. (#336)
Adding this allows us to continue using this library to decode a JWT
token with a secret (the way it used to be possible pre v9).
Without this we cannot update to v9 and we are stuck in v8.3.
Co-authored-by: sagunb <sagunb@users.norepl... | diff --git a/src/validation.rs b/src/validation.rs
index 3fd8c72..eea6eaf 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -51,7 +51,13 @@ pub struct Validation {
///
/// Defaults to `false`.
pub validate_nbf: bool,
- /// If it contains a value, the validation will check that the `aud` field ... | 1 | 23 | 1 |
d4f3300960efa0da65fd6533bc3e2dc8f573565b | Brandon Dyer | 2023-11-07T11:27:51 | Do what chrono does (#341)
* Do what chrono does
* Target specific dependencies | diff --git a/Cargo.toml b/Cargo.toml
index 47e724f..13e45a5 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,12 +15,19 @@ rust-version = "1.67.0"
[dependencies]
serde_json = "1.0"
serde = {version = "1.0", features = ["derive"] }
-ring = { version = "0.17.4", features = ["std"] }
base64 = "0.21.0"
# For PEM decodin... | 2 | 19 | 4 |
895079c81477fd63a1facd0a44a9d8bc0a25c26c | Vincent Prouillet | 2023-10-21T21:33:05 | Remove unused import | diff --git a/src/algorithms.rs b/src/algorithms.rs
index 22782c7..06ad34a 100644
--- a/src/algorithms.rs
+++ b/src/algorithms.rs
@@ -84,8 +84,6 @@ impl Algorithm {
#[cfg(test)]
mod tests {
- use crate::jwk::KeyAlgorithm;
-
use super::*;
#[test] | 1 | 0 | 2 |
b32e0a3beeab410bd18ed108f544162c6880503e | nick9822 | 2023-10-21T21:10:21 | deserialization support for some missing algorithms (#324)
* Only deserialization support for missing Algorithm (Keycloak)
* linting fixes
* linting change leftover fix
* KeyAlgorithm moved to mod jwk, typo fixes
* Moved pub method to Jwk private
* Removed test | diff --git a/examples/auth0.rs b/examples/auth0.rs
index 040301a..2964c3a 100644
--- a/examples/auth0.rs
+++ b/examples/auth0.rs
@@ -1,8 +1,9 @@
/// Example for the backend to backend implementation
use std::collections::HashMap;
+use std::str::FromStr;
use jsonwebtoken::jwk::AlgorithmParameters;
-use jsonwebtoken... | 3 | 112 | 11 |
a55b45c9329088b272c1c0bb63fb47ce9985f691 | Graham Christensen | 2023-10-16T07:03:25 | Reject tokens when claims has an aud, none expected (#332)
* Reject tokens when claims has an aud, none expected
From the RFC:
> Each principal intended to process the JWT MUST
> identify itself with a value in the audience claim. If the principal
> processing the claim does not identify itself with a value in... | diff --git a/src/validation.rs b/src/validation.rs
index 195c916..af05d11 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -263,6 +263,14 @@ pub(crate) fn validate(claims: ClaimsForValidation, options: &Validation) -> Res
}
match (claims.aud, options.aud.as_ref()) {
+ // Each principal inten... | 1 | 24 | 0 |
b7599eb51d2f075e41f3f647d860ba6e9a58eaef | Kyle Huey | 2023-10-16T07:03:11 | Upgrade ring. (#333) | diff --git a/Cargo.toml b/Cargo.toml
index 90a3df6..b7efe93 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ rust-version = "1.67.0"
[dependencies]
serde_json = "1.0"
serde = {version = "1.0", features = ["derive"] }
-ring = { version = "0.16.5", features = ["std"] }
+ring = { version = "0.17.3", features ... | 4 | 5 | 5 |
d17051c666a97db140325f681a4e479645364084 | Oliver THEBAULT | 2023-06-15T18:29:45 | fix(decoding): do not get_current_timestamp if user dont validate exp/nbf (#302) | diff --git a/src/validation.rs b/src/validation.rs
index de5a5e6..399a38a 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -213,8 +213,6 @@ fn is_subset(reference: &HashSet<String>, given: &HashSet<BorrowedCowIfPossible<
}
pub(crate) fn validate(claims: ClaimsForValidation, options: &Validation) -> Result<... | 1 | 11 | 9 |
1bdfb9140a4718da397891b4eadd249ec8f2e8c6 | Edward Rudd | 2023-06-15T18:29:03 | Update pem dependency to 2.x (#303)
- updating this removes the duplicate base64 dependency as pem 1.x used base64 0.13 still | diff --git a/Cargo.toml b/Cargo.toml
index 869dc48..8bb727e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ serde = {version = "1.0", features = ["derive"] }
ring = { version = "0.16.5", features = ["std"] }
base64 = "0.21.0"
# For PEM decoding
-pem = {version = "1", optional = true}
+pem = {version = "2"... | 2 | 6 | 7 |
a470ed015bb80827c05a24482caab66cf475c772 | Sjoerd Simons | 2023-06-15T18:28:53 | JWK hmac keys are base64url encoded not standard (#316)
* JWK hmac keys are base64url encoded not standard
DecodingKey::from_base64_secret uses standard decoding, while "k" field
of a jwk is expected to be in base64url instead.
Signed-off-by: Sjoerd Simons <sjoerd@collabora.com>
* Test validating HMAC SHA-25... | diff --git a/src/decoding.rs b/src/decoding.rs
index 73cc940..8d87f03 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -183,7 +183,13 @@ impl DecodingKey {
DecodingKey::from_ec_components(¶ms.x, ¶ms.y)
}
AlgorithmParameters::OctetKeyPair(params) => DecodingKey::fr... | 2 | 27 | 1 |
f517b9a9419722c7cf394bede46ef0047c61d128 | Gary Coady | 2023-03-15T19:10:31 | Implement Clone for TokenData<T> if T: Clone (#298)
If T: Clone, we can write a Clone implementation for `TokenData`. | diff --git a/src/decoding.rs b/src/decoding.rs
index af87ad6..73cc940 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -20,6 +20,15 @@ pub struct TokenData<T> {
pub claims: T,
}
+impl<T> Clone for TokenData<T>
+where
+ T: Clone,
+{
+ fn clone(&self) -> Self {
+ Self { header: self.header.clone... | 1 | 9 | 0 |
147d24170497a5aa973c74ac4566e8baab97770c | 0xc0001a2040 | 2023-02-08T21:34:28 | Improve some doc inconsistencies (#258) | diff --git a/src/decoding.rs b/src/decoding.rs
index e47623a..af87ad6 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -38,8 +38,8 @@ pub(crate) enum DecodingKeyKind {
RsaModulusExponent { n: Vec<u8>, e: Vec<u8> },
}
-/// All the different kind of keys we can use to decode a JWT
-/// This key can be re-use... | 3 | 7 | 7 |
4df1e47c72c7bf1f7c207212541458d8a2b162b3 | Takayuki Nakata | 2023-01-25T17:09:46 | Suppress warnings when `cargo test --no-default-features` (#289) | diff --git a/tests/ecdsa/mod.rs b/tests/ecdsa/mod.rs
index 072f1b4..bdb51fd 100644
--- a/tests/ecdsa/mod.rs
+++ b/tests/ecdsa/mod.rs
@@ -1,8 +1,12 @@
use jsonwebtoken::{
crypto::{sign, verify},
- decode, encode, Algorithm, DecodingKey, EncodingKey, Header, Validation,
+ Algorithm, DecodingKey, EncodingKey,
... | 3 | 15 | 3 |
9343c661f9f9a743f1e3a5e9d461b43ef3702331 | Takayuki Nakata | 2023-01-24T15:41:50 | Fix some comments (#288) | diff --git a/src/errors.rs b/src/errors.rs
index 3e00da9..c5d8041 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -59,9 +59,9 @@ pub enum ErrorKind {
InvalidIssuer,
/// When a token’s `aud` claim does not match one of the expected audience values
InvalidAudience,
- /// When a token’s `sub` claim doe... | 1 | 2 | 2 |
be8697a970bd8ed2fd62be71b48bd2b227f9d33b | Samuel Tardieu | 2023-01-21T20:02:04 | style: use non-reference patterns instead of explicit ref in patterns (#283) | diff --git a/examples/auth0.rs b/examples/auth0.rs
index 2873cde..040301a 100644
--- a/examples/auth0.rs
+++ b/examples/auth0.rs
@@ -18,8 +18,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
None => return Err("Token doesn't have a `kid` header field".into()),
};
if let Some(j) = jwks.find(... | 4 | 23 | 27 |
968a10a84d359e6b30ba6a61ab4efce173c1cc45 | Alexey | 2023-01-21T19:58:17 | Update base64 to 0.21.0 (#278)
* chore: update base64 to 0.21.0 | diff --git a/Cargo.toml b/Cargo.toml
index c9e61c5..5df8af3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,7 +15,7 @@ include = ["src/**/*", "benches/**/*", "tests/**/*", "LICENSE", "README.md", "CH
serde_json = "1.0"
serde = {version = "1.0", features = ["derive"] }
ring = { version = "0.16.5", features = ["std"] ... | 7 | 16 | 9 |
4008c8b3587355e9b1c857ea8ec6695edbe3d253 | Takayuki Nakata | 2023-01-20T15:21:21 | Fix the broken links (#286) | diff --git a/src/crypto/rsa.rs b/src/crypto/rsa.rs
index dfdbb25..34fce1a 100644
--- a/src/crypto/rsa.rs
+++ b/src/crypto/rsa.rs
@@ -32,7 +32,7 @@ pub(crate) fn alg_to_rsa_signing(alg: Algorithm) -> &'static dyn signature::RsaE
/// The actual RSA signing + encoding
/// The key needs to be in PKCS8 format
-/// Taken... | 2 | 2 | 2 |
d2ba3513b23b38919022666dc7232c4a5cd7c6af | Ovidiu Ionescu | 2023-01-06T20:52:35 | added an example for ed25519 (#282)
Co-authored-by: Ovidiu Ionescu <ovidiu@ionescu.net> | diff --git a/examples/ed25519.rs b/examples/ed25519.rs
new file mode 100644
index 0000000..21a8f21
--- /dev/null
+++ b/examples/ed25519.rs
@@ -0,0 +1,62 @@
+use jsonwebtoken::{
+ decode, encode, get_current_timestamp, Algorithm, DecodingKey, EncodingKey, Validation,
+};
+use ring::signature::{Ed25519KeyPair, KeyPair... | 1 | 62 | 0 |
708d452ca03c9958390fdbc8ce06d0f0bedb708d | Max Bruckner | 2023-01-02T16:15:40 | Fix comment on Result type alias (#280)
`jsonwebtoken::Error` doesn't exist, needs to be `jsonwebtoken::errors::Error` | diff --git a/src/errors.rs b/src/errors.rs
index e0553e3..b685b57 100644
--- a/src/errors.rs
+++ b/src/errors.rs
@@ -8,7 +8,7 @@ pub(crate) fn new_error(kind: ErrorKind) -> Error {
Error(Box::new(kind))
}
-/// A type alias for `Result<T, jsonwebtoken::Error>`.
+/// A type alias for `Result<T, jsonwebtoken::erro... | 1 | 1 | 1 |
e19cb4e27b7fcf395498aae531e29cbb151e13dc | Vincent Prouillet | 2022-12-03T21:45:36 | One more clippy tweak | diff --git a/src/decoding.rs b/src/decoding.rs
index b4fbdc4..af8c290 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -156,7 +156,7 @@ impl DecodingKey {
/// From x part (base64 encoded) of the JWK encoding
pub fn from_ed_components(x: &str) -> Result<Self> {
- let x_decoded = b64_decode(&x)?;
... | 1 | 1 | 1 |
b427bc1f929de2f836325f160916ac61d7b7ecf6 | Alexey Chernyshov | 2022-12-01T08:07:16 | lint (clippy): explicit auto deref
https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref | diff --git a/src/validation.rs b/src/validation.rs
index b4920b2..9afd296 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -199,7 +199,7 @@ enum Issuer<'a> {
struct BorrowedCowIfPossible<'a>(#[serde(borrow)] Cow<'a, str>);
impl std::borrow::Borrow<str> for BorrowedCowIfPossible<'_> {
fn borrow(&self) ->... | 1 | 1 | 1 |
9de03c009e20b48e1fea9c322d779378fd7d5a5e | Alexey Chernyshov | 2022-12-01T08:06:39 | lint (clippy): needless borrow
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow | diff --git a/src/decoding.rs b/src/decoding.rs
index a421108..b4fbdc4 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -56,7 +56,7 @@ impl DecodingKey {
/// If you're using HMAC with a base64 encoded secret, use this.
pub fn from_base64_secret(secret: &str) -> Result<Self> {
- let out = base64::... | 2 | 2 | 2 |
e1e3e66e786099a097ed2f8e01aac673ae4b1f93 | cduvray | 2022-10-28T06:31:37 | Add DecodingKey::from_jwk
- ref. #260 | diff --git a/src/decoding.rs b/src/decoding.rs
index 82f4e0a..a421108 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -4,6 +4,7 @@ use crate::algorithms::AlgorithmFamily;
use crate::crypto::verify;
use crate::errors::{new_error, ErrorKind, Result};
use crate::header::Header;
+use crate::jwk::{AlgorithmParamete... | 4 | 127 | 0 |
ee5a2dd214cf548a913670e73fc2dbc72a759541 | cduvray | 2022-10-28T06:31:37 | Add from_ec_components(), from_ed_components() for DecodingKey
- facilitates creating from jwk | diff --git a/src/decoding.rs b/src/decoding.rs
index 145a24d..82f4e0a 100644
--- a/src/decoding.rs
+++ b/src/decoding.rs
@@ -101,6 +101,22 @@ impl DecodingKey {
})
}
+ /// If you have (x,y) ECDSA key components
+ pub fn from_ec_components(x: &str, y: &str) -> Result<Self> {
+ let x_cmp = b6... | 4 | 80 | 0 |
e2bd051bbbea8962c359fa069a3acb4e31f0415a | Jeff Davey | 2022-06-17T19:30:50 | Fix invalid field name on OctetKeyParameters (#256)
RFC 7518 defines the parameters for symmetric keys to have the 'k' (Key
Value) parameter (Section 6.4.1). The OctetKeyParameters structure
unfortunately has it defined as "value".
This change should allow parsing of jwks.json files with a symmetric key
while ke... | diff --git a/src/jwk.rs b/src/jwk.rs
index 232d934..13a10df 100644
--- a/src/jwk.rs
+++ b/src/jwk.rs
@@ -297,6 +297,7 @@ pub struct OctetKeyParameters {
#[serde(rename = "kty")]
pub key_type: OctetKeyType,
/// The octet key value
+ #[serde(rename = "k")]
pub value: String,
}
@@ -362,3 +363,39 ... | 1 | 37 | 0 |
2d2921f9ce632d3779e2aa1c971cb8376c1832f7 | Orne Brocaar | 2022-04-12T18:33:43 | Fix #190 / cleanup of PR #240 (#247)
* Made spec_claims exp, nbf, iss, sub, and aud optional, unless they are specifically required
* Run cargo fmt.
* Fix clippy feedback.
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com> | diff --git a/src/validation.rs b/src/validation.rs
index 1a13eea..ec76b07 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -230,46 +230,48 @@ pub(crate) fn validate(claims: ClaimsForValidation, options: &Validation) -> Res
}
}
- if options.validate_exp
- && !matches!(claims.exp, TryPa... | 1 | 79 | 41 |
1a9ca38b76d05d0eb0823af808c344cd97bc5bea | Vincent Prouillet | 2022-02-03T15:23:32 | Update leeway docs
Closes #234 | diff --git a/src/validation.rs b/src/validation.rs
index efe3770..1a13eea 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -38,7 +38,7 @@ pub struct Validation {
/// Add some leeway (in seconds) to the `exp` and `nbf` validation to
/// account for clock skew.
///
- /// Defaults to `0`.
+ /... | 1 | 1 | 1 |
0ed16a34ad6d052d6d3c5440b938c8856df001c3 | Vivien Maisonneuve | 2022-02-03T07:41:25 | Fix function name in doc comment | diff --git a/src/validation.rs b/src/validation.rs
index 11d48aa..efe3770 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -115,7 +115,7 @@ impl Validation {
/// Which claims are required to be present for this JWT to be considered valid.
/// The only values that will be considered are "exp", "nbf"... | 1 | 1 | 1 |
03927bf31940186c7486c1fa50e2d1ebca624b14 | Pietro | 2022-01-29T13:30:05 | reduced default double allocation to one (#232) | diff --git a/src/validation.rs b/src/validation.rs
index 27b0b3f..11d48aa 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -82,7 +82,23 @@ pub struct Validation {
impl Validation {
/// Create a default validation setup allowing the given alg
pub fn new(alg: Algorithm) -> Validation {
- Valida... | 1 | 18 | 18 |
5486f96f52e5bbfeb0f695d26fadd91989fda330 | Vincent Prouillet | 2022-01-09T19:15:33 | Remove iat mention
Closes #228 | diff --git a/src/validation.rs b/src/validation.rs
index 3e2b219..27b0b3f 100644
--- a/src/validation.rs
+++ b/src/validation.rs
@@ -35,7 +35,7 @@ pub struct Validation {
///
/// Defaults to `{"exp"}`
pub required_spec_claims: HashSet<String>,
- /// Add some leeway (in seconds) to the `exp`, `iat` and... | 1 | 1 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.