mirror of
https://github.com/Xevion/Pac-Man.git
synced 2025-12-18 12:12:39 -06:00
refactor: allow optional database in setup, use derived default
This commit is contained in:
@@ -51,7 +51,7 @@ impl DiscordProvider {
|
||||
Arc::new(Self {
|
||||
client,
|
||||
http,
|
||||
pkce: PkceManager::new(),
|
||||
pkce: PkceManager::default(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ impl GitHubProvider {
|
||||
Arc::new(Self {
|
||||
client,
|
||||
http,
|
||||
pkce: PkceManager::new(),
|
||||
pkce: PkceManager::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ pub struct PkceRecord {
|
||||
pub created_at: Instant,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct PkceManager {
|
||||
pkce: DashMap<String, PkceRecord>,
|
||||
last_purge_at_secs: AtomicU32,
|
||||
@@ -17,14 +18,6 @@ pub struct PkceManager {
|
||||
}
|
||||
|
||||
impl PkceManager {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
pkce: DashMap::new(),
|
||||
last_purge_at_secs: AtomicU32::new(0),
|
||||
pkce_additions: AtomicU32::new(0),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn generate_challenge(&self) -> (PkceCodeChallenge, String) {
|
||||
let (pkce_challenge, pkce_verifier) = PkceCodeChallenge::new_random_sha256();
|
||||
trace!("PKCE challenge generated");
|
||||
|
||||
Reference in New Issue
Block a user