feat(auth): add WebAuthn passkey support with migrations, routes, and tests

This commit is contained in:
2025-10-29 17:50:14 +01:00
parent ec6e7f04f2
commit ca30b20873
23 changed files with 1511 additions and 83 deletions
+11 -1
View File
@@ -7,7 +7,7 @@ use diesel::{
use uuid::Uuid;
use crate::{
auth::jwt::JwtService,
auth::{jwt::JwtService, passkeys::PasskeyService},
config::AppConfig,
db::PgPool,
error::{AppError, AppResult},
@@ -24,6 +24,7 @@ pub struct AppState {
storage: Arc<dyn ObjectStorage>,
pub jwt: JwtService,
pub tenants: TenantService,
pub passkeys: Option<PasskeyService>,
}
impl AppState {
@@ -52,12 +53,21 @@ impl AppState {
let config = Arc::new(config);
let tenants = TenantService::new(pool.clone());
let passkeys = match PasskeyService::try_new(&config) {
Ok(service) => service,
Err(err) => {
tracing::warn!(error = ?err, "passkey service disabled due to configuration");
None
}
};
Self {
pool,
config,
storage,
jwt,
tenants,
passkeys,
}
}