feat: add devices handler with stub implementation

This commit is contained in:
qaz741wsd856 2025-11-30 09:38:50 +00:00
parent 682e372752
commit b3c3aa2f33
3 changed files with 22 additions and 1 deletions

18
src/handlers/devices.rs Normal file
View file

@ -0,0 +1,18 @@
use axum::Json;
use serde_json::{json, Value};
/// GET /devices
///
/// Returns an empty list of devices.
/// Device tracking is not implemented in this minimal Bitwarden-compatible server.
/// This does not affect authentication since we use stateless JWT tokens.
/// Clients will show "No devices currently logged in" in the device management settings.
#[worker::send]
pub async fn get_devices() -> Json<Value> {
Json(json!({
"data": [],
"continuationToken": null,
"object": "list"
}))
}

View file

@ -1,6 +1,7 @@
pub mod accounts;
pub mod ciphers;
pub mod config;
pub mod devices;
pub mod emergency_access;
pub mod folders;
pub mod identity;

View file

@ -5,7 +5,7 @@ use axum::{
use std::sync::Arc;
use worker::Env;
use crate::handlers::{accounts, ciphers, config, emergency_access, folders, identity, import, sync, webauth};
use crate::handlers::{accounts, ciphers, config, devices, emergency_access, folders, identity, import, sync, webauth};
pub fn api_router(env: Env) -> Router {
let app_state = Arc::new(env);
@ -78,6 +78,8 @@ pub fn api_router(env: Env) -> Router {
"/api/emergency-access/granted",
get(emergency_access::get_granted_access),
)
// Devices (stub - returns empty list, device tracking not implemented)
.route("/api/devices", get(devices::get_devices))
// WebAuthn (stub - prevents 404 errors, passkeys not supported)
.route(
"/api/webauthn",