From 367105479e4468af01c66fd6c6aa289feeefc3ce Mon Sep 17 00:00:00 2001 From: Nevernown Date: Sat, 15 Nov 2025 10:52:25 +0100 Subject: [PATCH] Split into libs --- identity/Cargo.toml | 13 +++++++++++++ identity/src/lib.rs | 28 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 identity/Cargo.toml create mode 100644 identity/src/lib.rs diff --git a/identity/Cargo.toml b/identity/Cargo.toml new file mode 100644 index 0000000..151f243 --- /dev/null +++ b/identity/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "identity" +version = "0.1.0" +edition = "2024" + +[dependencies] +axum = "0.8.1" +log = "0.4.25" +serde = { version = "1.0.217", features = ["derive"] } +tokio = { version = "1.43.0", features = ["full"] } +tracing = "0.1.41" +tracing-subscriber = "0.3.19" +sigma = { path = "../sigma" } \ No newline at end of file diff --git a/identity/src/lib.rs b/identity/src/lib.rs new file mode 100644 index 0000000..14ba309 --- /dev/null +++ b/identity/src/lib.rs @@ -0,0 +1,28 @@ +use axum::{routing::get, Json, Router}; +#[allow(unused)] +use log::{info, debug, warn, error, trace}; +use sigma::repsonse::SigmaInformation; +use tracing::instrument; + + +const NAME: &str = "TinyIdentity"; +const VERSION: &str = "0.0.0.1"; + +pub fn router() -> Router { + info!("Loading {NAME} app routes"); + debug!("{NAME} version is {VERSION}"); + Router::new() + .route("/", get(information)) + .route("/setup", get(dummy)) + .route("/me", get(dummy)) +} + +#[instrument] +async fn dummy() -> Json<()> { + Json(()) +} + +#[instrument] +async fn information() -> Json { + Json(SigmaInformation::new(NAME, VERSION)) +} \ No newline at end of file