From bead6f43b89147de52e8c64f8a423cf5f9653578 Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 17 Jul 2026 16:21:51 -0400 Subject: [PATCH] icarus_envy -> sienvy --- Cargo.lock | 30 +++++++++++++++--------------- Cargo.toml | 2 +- src/callers/login.rs | 18 +++++++++--------- src/callers/register.rs | 6 +++--- src/repo/mod.rs | 14 +++++++------- src/token_stuff/mod.rs | 12 ++++++------ 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index defbf28..77e0074 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -781,20 +781,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "icarus_models" -version = "0.11.3" -source = "git+ssh://git@git.kundeng.us/phoenix/icarus_models.git?tag=v0.11.3#859b0fb1b377370d8171e22e59893d86e41b258b" -dependencies = [ - "josekit", - "rand", - "serde", - "serde_json", - "time", - "utoipa", - "uuid", -] - [[package]] name = "icu_collections" version = "2.2.0" @@ -1564,6 +1550,20 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "703d5c7ef118737c72f1af64ad2f6f8c5e1921f818cdcb97b8fe6fc69bf66214" +[[package]] +name = "simodels" +version = "0.11.3" +source = "git+ssh://git@git.kundeng.us/phoenix/simodels.git?tag=v0.11.3-main-fe9d101bd0-111#fe9d101bd019f91fe8c99c29721ccb0e6e90c92c" +dependencies = [ + "josekit", + "rand", + "serde", + "serde_json", + "time", + "utoipa", + "uuid", +] + [[package]] name = "slab" version = "0.4.12" @@ -1586,12 +1586,12 @@ dependencies = [ "argon2", "axum", "http-body-util", - "icarus_models", "josekit", "openssl", "serde", "serde_json", "sienvy", + "simodels", "sqlx", "time", "tokio", diff --git a/Cargo.toml b/Cargo.toml index ff8aed7..f28bf9e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ time = { version = "0.3.53", features = ["macros", "serde"] } josekit = { version = "0.10.3" } utoipa = { version = "5.5.0", features = ["axum_extras"] } utoipa-swagger-ui = { version = "9.0.2", features = ["axum"] } -icarus_models = { git = "ssh://git@git.kundeng.us/phoenix/icarus_models.git", tag = "v0.11.3" } +simodels = { git = "ssh://git@git.kundeng.us/phoenix/simodels.git", tag = "v0.11.3-main-fe9d101bd0-111" } sienvy = { git = "ssh://git@git.kundeng.us/phoenix/sienvy.git", tag = "v0.8.0-main-d06c8fdf49-006" } [dev-dependencies] diff --git a/src/callers/login.rs b/src/callers/login.rs index 06b0b3e..c583d97 100644 --- a/src/callers/login.rs +++ b/src/callers/login.rs @@ -28,14 +28,14 @@ pub mod response { #[derive(Default, Deserialize, Serialize, utoipa::ToSchema)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } pub mod service_login { #[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } @@ -43,7 +43,7 @@ pub mod response { #[derive(Debug, Default, serde::Deserialize, serde::Serialize, utoipa::ToSchema)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } } @@ -104,11 +104,11 @@ pub mod endpoint { StatusCode::OK, Json(response::Response { message: String::from("Successful"), - data: vec![icarus_models::login_result::LoginResult { + data: vec![simodels::login_result::LoginResult { id: user.id, username: user.username.clone(), token: token_literal, - token_type: String::from(icarus_models::token::TOKEN_TYPE), + token_type: String::from(simodels::token::TOKEN_TYPE), expiration: duration, }], }), @@ -156,11 +156,11 @@ pub mod endpoint { token_stuff::create_service_token(&key, &id).unwrap(); if token_stuff::verify_token(&key, &token_literal) { - let login_result = icarus_models::login_result::LoginResult { + let login_result = simodels::login_result::LoginResult { id, username, token: token_literal, - token_type: String::from(icarus_models::token::TOKEN_TYPE), + token_type: String::from(simodels::token::TOKEN_TYPE), expiration: duration, }; @@ -215,11 +215,11 @@ pub mod endpoint { Ok((username, _, _)) => { match token_stuff::create_service_refresh_token(&key, &id) { Ok((access_token, exp_dur)) => { - let login_result = icarus_models::login_result::LoginResult { + let login_result = simodels::login_result::LoginResult { id, token: access_token, expiration: exp_dur, - token_type: String::from(icarus_models::token::TOKEN_TYPE), + token_type: String::from(simodels::token::TOKEN_TYPE), username, }; response.message = String::from("Successful"); diff --git a/src/callers/register.rs b/src/callers/register.rs index 5de508e..15d3924 100644 --- a/src/callers/register.rs +++ b/src/callers/register.rs @@ -29,7 +29,7 @@ pub mod response { #[derive(Deserialize, Serialize, utoipa::ToSchema)] pub struct Response { pub message: String, - pub data: Vec, + pub data: Vec, } } @@ -67,7 +67,7 @@ pub async fn register_user( }; if registration_enabled { - let mut user = icarus_models::user::User { + let mut user = simodels::user::User { username: payload.username.clone(), password: payload.password.clone(), email: payload.email.clone(), @@ -91,7 +91,7 @@ pub async fn register_user( ) } else { let salt_string = hashing::generate_salt().unwrap(); - let mut salt = icarus_models::user::salt::Salt::default(); + let mut salt = simodels::user::salt::Salt::default(); let generated_salt = salt_string; salt.salt = generated_salt.to_string(); salt.id = repo::salt::insert(&pool, &salt).await.unwrap(); diff --git a/src/repo/mod.rs b/src/repo/mod.rs index 15482e9..b127180 100644 --- a/src/repo/mod.rs +++ b/src/repo/mod.rs @@ -12,7 +12,7 @@ pub mod user { pub async fn get( pool: &sqlx::PgPool, username: &String, - ) -> Result { + ) -> Result { let result = sqlx::query( r#" SELECT * FROM "user" WHERE username = $1 @@ -24,7 +24,7 @@ pub mod user { match result { Ok(r) => match r { - Some(r) => Ok(icarus_models::user::User { + Some(r) => Ok(simodels::user::User { id: r.try_get("id")?, username: r.try_get("username")?, password: r.try_get("password")?, @@ -46,7 +46,7 @@ pub mod user { pub async fn update_last_login( pool: &sqlx::PgPool, - user: &icarus_models::user::User, + user: &simodels::user::User, time: &time::OffsetDateTime, ) -> Result { let result = sqlx::query( @@ -95,7 +95,7 @@ pub mod user { pub async fn insert( pool: &sqlx::PgPool, - user: &icarus_models::user::User, + user: &simodels::user::User, ) -> Result<(uuid::Uuid, std::option::Option), sqlx::Error> { let row = sqlx::query( r#" @@ -145,7 +145,7 @@ pub mod salt { pub async fn get( pool: &sqlx::PgPool, id: &uuid::Uuid, - ) -> Result { + ) -> Result { let result = sqlx::query( r#" SELECT * FROM "salt" WHERE id = $1 @@ -157,7 +157,7 @@ pub mod salt { match result { Ok(r) => match r { - Some(r) => Ok(icarus_models::user::salt::Salt { + Some(r) => Ok(simodels::user::salt::Salt { id: r.try_get("id")?, salt: r.try_get("salt")?, }), @@ -169,7 +169,7 @@ pub mod salt { pub async fn insert( pool: &sqlx::PgPool, - salt: &icarus_models::user::salt::Salt, + salt: &simodels::user::salt::Salt, ) -> Result { let row = sqlx::query( r#" diff --git a/src/token_stuff/mod.rs b/src/token_stuff/mod.rs index cc734ec..95d6ebe 100644 --- a/src/token_stuff/mod.rs +++ b/src/token_stuff/mod.rs @@ -24,39 +24,39 @@ pub fn create_token( provided_key: &String, id: &uuid::Uuid, ) -> Result<(String, i64), josekit::JoseError> { - let resource = icarus_models::token::TokenResource { + let resource = simodels::token::TokenResource { message: String::from(MESSAGE), issuer: String::from(ISSUER), audiences: vec![String::from(AUDIENCE)], id: *id, }; - icarus_models::token::create_token(provided_key, &resource, time::Duration::hours(4)) + simodels::token::create_token(provided_key, &resource, time::Duration::hours(4)) } pub fn create_service_token( provided: &String, id: &uuid::Uuid, ) -> Result<(String, i64), josekit::JoseError> { - let resource = icarus_models::token::TokenResource { + let resource = simodels::token::TokenResource { message: String::from(SERVICE_SUBJECT), issuer: String::from(ISSUER), audiences: vec![String::from(AUDIENCE)], id: *id, }; - icarus_models::token::create_token(provided, &resource, time::Duration::hours(1)) + simodels::token::create_token(provided, &resource, time::Duration::hours(1)) } pub fn create_service_refresh_token( key: &String, id: &uuid::Uuid, ) -> Result<(String, i64), josekit::JoseError> { - let resource = icarus_models::token::TokenResource { + let resource = simodels::token::TokenResource { message: String::from(SERVICE_SUBJECT), issuer: String::from(ISSUER), audiences: vec![String::from(AUDIENCE)], id: *id, }; - icarus_models::token::create_token(key, &resource, time::Duration::hours(4)) + simodels::token::create_token(key, &resource, time::Duration::hours(4)) } pub fn verify_token(key: &String, token: &String) -> bool {