Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ default = ["reqwest", "rustls-tls"]
pkce-plain = []
native-tls = ["reqwest/native-tls"]
reqwest-blocking = ["reqwest/blocking"]
rustls-tls = ["reqwest/rustls-tls"]
rustls-tls = ["reqwest/rustls"]
timing-resistant-secret-traits = []

[[example]]
Expand Down Expand Up @@ -49,28 +49,28 @@ required-features = ["reqwest-blocking"]

[dependencies]
base64 = ">= 0.21, <0.23"
thiserror = "1.0"
http = "1.0"
rand = "0.8"
reqwest = { version = "0.12", optional = true, default-features = false }
thiserror = "2.0"
http = "1.4"
rand = "0.9"
reqwest = { version = "0.13", optional = true, default-features = false }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.10"
ureq = { version = "2", optional = true }
url = { version = "2.1", features = ["serde"] }
chrono = { version = "0.4.31", default-features = false, features = ["clock", "serde", "std", "wasmbind"] }
serde_path_to_error = "0.1.2"
url = { version = "2.5", features = ["serde"] }
chrono = { version = "0.4.43", default-features = false, features = ["clock", "serde", "std", "wasmbind"] }
serde_path_to_error = "0.1.20"

[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }
getrandom = { version = "0.3", features = ["wasm_js"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
curl = { version = "0.4.0", optional = true }
curl = { version = "0.4.49", optional = true }

[dev-dependencies]
hex = "0.4"
hmac = "0.12"
uuid = { version = "1.10", features = ["v4"] }
uuid = { version = "1.19", features = ["v4"] }
anyhow = "1.0"
tokio = { version = "1.0", features = ["full"] }
tokio = { version = "1.38", features = ["full"] }
async-std = "1.13"
20 changes: 10 additions & 10 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ where
/// [Cross-Site Request Forgery](https://tools.ietf.org/html/rfc6749#section-10.12)
/// attacks. To disable CSRF protections (NOT recommended), use `insecure::authorize_url`
/// instead.
pub fn authorize_url<S>(&self, state_fn: S) -> AuthorizationRequest
pub fn authorize_url<S>(&self, state_fn: S) -> AuthorizationRequest<'_>
where
S: FnOnce() -> CsrfToken,
{
Expand Down Expand Up @@ -750,7 +750,7 @@ where
/// [Cross-Site Request Forgery](https://tools.ietf.org/html/rfc6749#section-10.12)
/// attacks. To disable CSRF protections (NOT recommended), use `insecure::authorize_url`
/// instead.
pub fn authorize_url<S>(&self, state_fn: S) -> Result<AuthorizationRequest, ConfigurationError>
pub fn authorize_url<S>(&self, state_fn: S) -> Result<AuthorizationRequest<'_>, ConfigurationError>
where
S: FnOnce() -> CsrfToken,
{
Expand Down Expand Up @@ -792,7 +792,7 @@ where
///
/// Requires [`set_token_uri()`](Self::set_token_uri) to have been previously
/// called to set the token endpoint.
pub fn exchange_client_credentials(&self) -> ClientCredentialsTokenRequest<TE, TR> {
pub fn exchange_client_credentials(&self) -> ClientCredentialsTokenRequest<'_, TE, TR> {
self.exchange_client_credentials_impl(self.token_uri())
}

Expand All @@ -805,7 +805,7 @@ where
///
/// Requires [`set_token_uri()`](Self::set_token_uri) to have been previously
/// called to set the token endpoint.
pub fn exchange_code(&self, code: AuthorizationCode) -> CodeTokenRequest<TE, TR> {
pub fn exchange_code(&self, code: AuthorizationCode) -> CodeTokenRequest<'_, TE, TR> {
self.exchange_code_impl(self.token_uri(), code)
}

Expand Down Expand Up @@ -892,7 +892,7 @@ where
/// called to set the token endpoint.
pub fn exchange_client_credentials(
&self,
) -> Result<ClientCredentialsTokenRequest<TE, TR>, ConfigurationError> {
) -> Result<ClientCredentialsTokenRequest<'_, TE, TR>, ConfigurationError> {
Ok(self.exchange_client_credentials_impl(
self.token_url
.as_ref()
Expand All @@ -912,7 +912,7 @@ where
pub fn exchange_code(
&self,
code: AuthorizationCode,
) -> Result<CodeTokenRequest<TE, TR>, ConfigurationError> {
) -> Result<CodeTokenRequest<'_, TE, TR>, ConfigurationError> {
Ok(self.exchange_code_impl(
self.token_url
.as_ref()
Expand Down Expand Up @@ -1020,7 +1020,7 @@ where
/// been previously called to set the device authorization endpoint.
///
/// See [`exchange_device_access_token()`](Self::exchange_device_access_token).
pub fn exchange_device_code(&self) -> DeviceAuthorizationRequest<TE> {
pub fn exchange_device_code(&self) -> DeviceAuthorizationRequest<'_, TE> {
self.exchange_device_code_impl(self.device_authorization_url())
}

Expand Down Expand Up @@ -1070,7 +1070,7 @@ where
/// See [`exchange_device_access_token()`](Self::exchange_device_access_token).
pub fn exchange_device_code(
&self,
) -> Result<DeviceAuthorizationRequest<TE>, ConfigurationError> {
) -> Result<DeviceAuthorizationRequest<'_, TE>, ConfigurationError> {
Ok(self.exchange_device_code_impl(
self.device_authorization_url
.as_ref()
Expand Down Expand Up @@ -1211,7 +1211,7 @@ where
pub fn revoke_token(
&self,
token: RT,
) -> Result<RevocationRequest<RT, TRE>, ConfigurationError> {
) -> Result<RevocationRequest<'_, RT, TRE>, ConfigurationError> {
self.revoke_token_impl(self.revocation_url(), token)
}

Expand Down Expand Up @@ -1259,7 +1259,7 @@ where
pub fn revoke_token(
&self,
token: RT,
) -> Result<RevocationRequest<RT, TRE>, ConfigurationError> {
) -> Result<RevocationRequest<'_, RT, TRE>, ConfigurationError> {
self.revoke_token_impl(
self.revocation_url
.as_ref()
Expand Down
6 changes: 3 additions & 3 deletions src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use base64::prelude::*;
use rand::{thread_rng, Rng};
use rand::{rng, Rng};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use url::Url;
Expand Down Expand Up @@ -473,7 +473,7 @@ impl PkceCodeChallenge {
// characters and a maximum length of 128 characters".
// This implies 32-96 octets of random data to be base64 encoded.
assert!((32..=96).contains(&num_bytes));
let random_bytes: Vec<u8> = (0..num_bytes).map(|_| thread_rng().gen::<u8>()).collect();
let random_bytes: Vec<u8> = (0..num_bytes).map(|_| rng().random::<u8>()).collect();
PkceCodeVerifier::new(BASE64_URL_SAFE_NO_PAD.encode(random_bytes))
}

Expand Down Expand Up @@ -568,7 +568,7 @@ new_secret_type![
///
/// * `num_bytes` - Number of random bytes to generate, prior to base64-encoding.
pub fn new_random_len(num_bytes: u32) -> Self {
let random_bytes: Vec<u8> = (0..num_bytes).map(|_| thread_rng().gen::<u8>()).collect();
let random_bytes: Vec<u8> = (0..num_bytes).map(|_| rng().random::<u8>()).collect();
CsrfToken::new(BASE64_URL_SAFE_NO_PAD.encode(random_bytes))
}
}
Expand Down
Loading