From 359f5be936ec0d6ac8835a472cf5de30d1c5d076 Mon Sep 17 00:00:00 2001 From: core Date: Mon, 3 Apr 2023 21:53:32 -0400 Subject: [PATCH] cargo-fix --- trifid-api/src/auth_tokens.rs | 2 +- trifid-api/src/main.rs | 6 +++--- trifid-api/src/routes/v1/auth/magic_link.rs | 2 +- trifid-api/src/routes/v1/auth/totp.rs | 6 +++--- trifid-api/src/routes/v1/networks.rs | 2 +- trifid-api/src/routes/v1/organization.rs | 2 +- trifid-api/src/routes/v1/signup.rs | 2 +- trifid-api/src/routes/v1/totp_authenticators.rs | 6 +++--- trifid-api/src/routes/v1/verify_totp_authenticators.rs | 4 ++-- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/trifid-api/src/auth_tokens.rs b/trifid-api/src/auth_tokens.rs index ae89c91..4f249a6 100644 --- a/trifid-api/src/auth_tokens.rs +++ b/trifid-api/src/auth_tokens.rs @@ -1,6 +1,6 @@ use std::error::Error; use actix_web::HttpRequest; -use log::debug; + use sea_orm::{ColumnTrait, Condition, DatabaseConnection, EntityTrait, QueryFilter}; use crate::tokens::get_token_type; use trifid_api_entities::entity::{auth_token, session_token}; diff --git a/trifid-api/src/main.rs b/trifid-api/src/main.rs index 4c19649..f04b3ae 100644 --- a/trifid-api/src/main.rs +++ b/trifid-api/src/main.rs @@ -1,10 +1,10 @@ use std::error::Error; use std::time::Duration; use actix_request_identifier::RequestIdentifier; -use actix_web::{App, HttpResponse, HttpServer, post, web::{Data, Json, JsonConfig}}; -use log::{error, info, Level}; +use actix_web::{App, HttpResponse, HttpServer, web::{Data, JsonConfig}}; +use log::{info, Level}; use sea_orm::{ConnectOptions, Database, DatabaseConnection}; -use serde::{Serialize, Deserialize}; + use trifid_api_migration::{Migrator, MigratorTrait}; use crate::config::CONFIG; use crate::error::{APIError, APIErrorsResponse}; diff --git a/trifid-api/src/routes/v1/auth/magic_link.rs b/trifid-api/src/routes/v1/auth/magic_link.rs index c5ae562..b42f1d7 100644 --- a/trifid-api/src/routes/v1/auth/magic_link.rs +++ b/trifid-api/src/routes/v1/auth/magic_link.rs @@ -1,7 +1,7 @@ use actix_web::{HttpResponse, post}; use actix_web::web::{Data, Json}; use log::error; -use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel, QueryFilter}; +use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, IntoActiveModel, QueryFilter}; use serde::{Serialize, Deserialize}; use trifid_api_entities::entity::user::Entity as UserEntity; use trifid_api_entities::entity::user; diff --git a/trifid-api/src/routes/v1/auth/totp.rs b/trifid-api/src/routes/v1/auth/totp.rs index bc95d2c..b50aa40 100644 --- a/trifid-api/src/routes/v1/auth/totp.rs +++ b/trifid-api/src/routes/v1/auth/totp.rs @@ -7,8 +7,8 @@ use crate::AppState; use crate::auth_tokens::{enforce_session, TokenInfo}; use crate::error::{APIError, APIErrorsResponse}; use sea_orm::{EntityTrait, QueryFilter, ColumnTrait, IntoActiveModel, ActiveModelTrait}; -use sea_orm::ActiveValue::Set; -use totp_rs::{Algorithm, Secret, TOTP}; + +use totp_rs::{Secret, TOTP}; use trifid_api_entities::entity::auth_token; use crate::config::CONFIG; use crate::timers::expires_in_seconds; @@ -91,7 +91,7 @@ pub async fn totp_request(req: Json, req_data: HttpRequest, db: Dat } }; - let secret = Secret::Encoded(auther.secret.clone()); + let _secret = Secret::Encoded(auther.secret.clone()); let totpmachine = match TOTP::from_url(auther.url.clone()) { Ok(m) => m, Err(e) => { diff --git a/trifid-api/src/routes/v1/networks.rs b/trifid-api/src/routes/v1/networks.rs index cb7b169..7066710 100644 --- a/trifid-api/src/routes/v1/networks.rs +++ b/trifid-api/src/routes/v1/networks.rs @@ -5,7 +5,7 @@ use chrono::{TimeZone, Utc}; use log::error; use sea_orm::{ColumnTrait, EntityTrait, PaginatorTrait, QueryFilter, QueryOrder}; use crate::AppState; -use crate::auth_tokens::{enforce_2fa, enforce_api_token, enforce_session, TokenInfo}; +use crate::auth_tokens::{enforce_2fa, enforce_api_token, TokenInfo}; use crate::error::{APIError, APIErrorsResponse}; use trifid_api_entities::entity::organization; use trifid_api_entities::entity::network; diff --git a/trifid-api/src/routes/v1/organization.rs b/trifid-api/src/routes/v1/organization.rs index 70f791f..af72249 100644 --- a/trifid-api/src/routes/v1/organization.rs +++ b/trifid-api/src/routes/v1/organization.rs @@ -16,7 +16,7 @@ use trifid_pki::cert::{NebulaCertificate, NebulaCertificateDetails, serialize_x2 use trifid_pki::ed25519_dalek::SigningKey; use trifid_pki::rand_core::OsRng; use trifid_api_entities::entity::{network, organization, signing_ca}; -use crate::auth_tokens::{enforce_2fa, enforce_api_token, TokenInfo}; +use crate::auth_tokens::{enforce_2fa, TokenInfo}; use crate::config::CONFIG; use crate::crypto::{encrypt_with_nonce, generate_random_iv, get_cipher_from_config}; use crate::error::{APIError, APIErrorsResponse}; diff --git a/trifid-api/src/routes/v1/signup.rs b/trifid-api/src/routes/v1/signup.rs index 2dcaccd..e619b20 100644 --- a/trifid-api/src/routes/v1/signup.rs +++ b/trifid-api/src/routes/v1/signup.rs @@ -1,7 +1,7 @@ use actix_web::{HttpResponse, post}; use actix_web::web::{Data, Json}; use log::error; -use sea_orm::{ActiveModelTrait, ColumnTrait, DatabaseConnection, EntityTrait, IntoActiveModel, QueryFilter}; +use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, IntoActiveModel, QueryFilter}; use serde::{Serialize, Deserialize}; use trifid_api_entities::entity::user::Entity as UserEntity; use trifid_api_entities::entity::user; diff --git a/trifid-api/src/routes/v1/totp_authenticators.rs b/trifid-api/src/routes/v1/totp_authenticators.rs index 955d02b..430c8c2 100644 --- a/trifid-api/src/routes/v1/totp_authenticators.rs +++ b/trifid-api/src/routes/v1/totp_authenticators.rs @@ -5,12 +5,12 @@ use log::error; use sea_orm::{ActiveModelTrait, ColumnTrait, EntityTrait, IntoActiveModel, ModelTrait, QueryFilter}; use totp_rs::{Algorithm, Secret, TOTP}; use crate::AppState; -use crate::auth_tokens::{enforce_2fa, enforce_session, TokenInfo}; +use crate::auth_tokens::{enforce_session, TokenInfo}; use crate::error::{APIError, APIErrorsResponse}; use trifid_api_entities::entity::totp_authenticator; use crate::config::CONFIG; use crate::timers::expires_in_seconds; -use crate::tokens::{random_id, random_token}; +use crate::tokens::{random_token}; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct TotpAuthenticatorsRequest {} @@ -33,7 +33,7 @@ pub struct TotpAuthenticatorsResponse { } #[post("/v1/totp-authenticators")] -pub async fn totp_authenticators_request(db: Data, req_data: HttpRequest, req: Json) -> HttpResponse { +pub async fn totp_authenticators_request(db: Data, req_data: HttpRequest, _req: Json) -> HttpResponse { // require a user session let session_token = match enforce_session(&req_data, &db.conn).await { Ok(r) => { diff --git a/trifid-api/src/routes/v1/verify_totp_authenticators.rs b/trifid-api/src/routes/v1/verify_totp_authenticators.rs index 9b2f2b8..bd979fc 100644 --- a/trifid-api/src/routes/v1/verify_totp_authenticators.rs +++ b/trifid-api/src/routes/v1/verify_totp_authenticators.rs @@ -8,7 +8,7 @@ use crate::auth_tokens::{enforce_session, TokenInfo}; use crate::error::{APIError, APIErrorsResponse}; use sea_orm::{EntityTrait, QueryFilter, ColumnTrait, IntoActiveModel, ActiveModelTrait}; use sea_orm::ActiveValue::Set; -use totp_rs::{Algorithm, Secret, TOTP}; +use totp_rs::{Secret, TOTP}; use trifid_api_entities::entity::auth_token; use crate::config::CONFIG; use crate::timers::expires_in_seconds; @@ -104,7 +104,7 @@ pub async fn verify_totp_authenticators_request(req: Json m, Err(e) => {