diff --git a/src/auth/auth_extractor.rs b/src/auth/auth_extractor.rs
index f33f6ed..5b06078 100644
--- a/src/auth/auth_extractor.rs
+++ b/src/auth/auth_extractor.rs
@@ -40,7 +40,7 @@ pub async fn inspect_req(state: &DbPool, req: &Request
) -> Result &'static str {
todo!("not implemented")
}
diff --git a/src/common.rs b/src/common.rs
index 3ba4768..ccd5bac 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -1,8 +1,8 @@
use axum::{
+ Json,
body::Body,
http::StatusCode,
response::{IntoResponse, Response},
- Json,
};
use serde::Serialize;
diff --git a/src/engines.rs b/src/engines.rs
index 26902d8..578e5e9 100644
--- a/src/engines.rs
+++ b/src/engines.rs
@@ -1,11 +1,11 @@
pub mod kv;
use axum::{
+ Extension, Router,
body::Body,
extract::{Request, State},
http::{StatusCode, Uri},
response::{IntoResponse, Response},
- Extension, Router,
};
use log::*;
use tower::Service;
diff --git a/src/engines/kv.rs b/src/engines/kv.rs
index 2d2281e..d969a40 100644
--- a/src/engines/kv.rs
+++ b/src/engines/kv.rs
@@ -1,15 +1,12 @@
-mod structs;
mod data;
mod meta;
+mod structs;
// #[cfg(test)]
// mod tests;
use crate::storage::DbPool;
-use axum::{
- Router,
- routing::*,
-};
+use axum::{Router, routing::*};
pub fn kv_router(pool: DbPool) -> Router {
Router::new()
diff --git a/src/engines/kv/data.rs b/src/engines/kv/data.rs
index 7802866..6d4110e 100644
--- a/src/engines/kv/data.rs
+++ b/src/engines/kv/data.rs
@@ -1,15 +1,19 @@
-// There are some placeholder functions, that will have to be implemented before the first release.
+// There are some placeholder functions, that will have to be implemented before the first release.
// They are marked with `todo!()` to indicate that they need to be implemented.
-// We want to keep these functions in the codebase.
+// We want to keep these functions in the codebase.
// That is why we choose to suppress unused warnings for now.
// TODO
#![allow(unused)]
use super::structs::KvV2WriteRequest;
use crate::{
- common::HttpError, engines::{
- kv::structs::{KvSecretData, KvSecretRes, KvV2WriteResponse, Wrapper}, EnginePath
- }, storage::sealing::Secret, DbPool
+ DbPool,
+ common::HttpError,
+ engines::{
+ EnginePath,
+ kv::structs::{KvSecretData, KvSecretRes, KvV2WriteResponse, Wrapper},
+ },
+ storage::sealing::Secret,
};
use axum::{
Extension, Json,
@@ -128,7 +132,10 @@ pub async fn post_data(
let content = serde_json::to_string(&secret.data).unwrap();
- let Secret { nonce, protected_data } = Secret::encrypt(&content).await.unwrap();
+ let Secret {
+ nonce,
+ protected_data,
+ } = Secret::encrypt(&content).await.unwrap();
let nonce = nonce.as_slice();
let mut tx = pool.begin().await.unwrap();
@@ -243,4 +250,4 @@ pub async fn patch_data(
Json(secret): Json,
) -> &'static str {
todo!("not implemented")
-}
\ No newline at end of file
+}
diff --git a/src/engines/kv/meta.rs b/src/engines/kv/meta.rs
index b050d8c..efc49b1 100644
--- a/src/engines/kv/meta.rs
+++ b/src/engines/kv/meta.rs
@@ -1,6 +1,6 @@
-// There are some placeholder functions, that will have to be implemented before the first release.
+// There are some placeholder functions, that will have to be implemented before the first release.
// They are marked with `todo!()` to indicate that they need to be implemented.
-// We want to keep these functions in the codebase.
+// We want to keep these functions in the codebase.
// That is why we choose to suppress unused warnings for now.
// TODO
#![allow(unused)]
diff --git a/src/engines/kv/structs.rs b/src/engines/kv/structs.rs
index a104791..8ef208e 100644
--- a/src/engines/kv/structs.rs
+++ b/src/engines/kv/structs.rs
@@ -1,6 +1,6 @@
-// There are some placeholder functions, that will have to be implemented before the first release.
+// There are some placeholder functions, that will have to be implemented before the first release.
// They are marked with `todo!()` to indicate that they need to be implemented.
-// We want to keep these functions in the codebase.
+// We want to keep these functions in the codebase.
// That is why we choose to suppress unused warnings for now.
#![allow(unused)]
diff --git a/src/main.rs b/src/main.rs
index d60f82a..0bd365d 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,19 +1,19 @@
#![forbid(unsafe_code)]
-// // There are some placeholder functions, that will have to be implemented before the first release.
+// // There are some placeholder functions, that will have to be implemented before the first release.
// // They are marked with `todo!()` to indicate that they need to be implemented.
-// // We want to keep these functions in the codebase.
+// // We want to keep these functions in the codebase.
// // That is why we choose to suppress unused warnings for now.
// #![allow(unused)]
use crate::common::HttpError;
use axum::{
+ Router,
extract::Request,
http::StatusCode,
middleware::{self, Next},
response::{IntoResponse, Response},
routing::get,
- Router,
};
use log::*;
use std::{env, net::SocketAddr, str::FromStr};
@@ -75,7 +75,7 @@ async fn set_default_content_type_json(
) -> Result {
if req.headers().get("content-type").is_none() {
let headers = req.headers_mut();
-
+
headers.insert("content-type", "application/json".parse().unwrap());
}
@@ -109,7 +109,7 @@ async fn shutdown_signal(pool: DbPool) {
}
/// Fallback route for unknown routes
-///
+///
/// Note: `/v1/*` is handled by [`engines::secrets_router`]
async fn fallback_route_unknown(req: Request) -> Response {
log::error!(
diff --git a/src/storage.rs b/src/storage.rs
index d4616e6..5771166 100644
--- a/src/storage.rs
+++ b/src/storage.rs
@@ -3,14 +3,14 @@ pub mod sealing;
use std::{fs::File, path::Path};
use log::*;
-use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite};
+use sqlx::{Pool, Sqlite, sqlite::SqlitePoolOptions};
pub(crate) type DbType = Sqlite;
pub(crate) type DbPool = Pool;
/// Creates a SQLx SQLite database pool.
/// If nonexistent, it creates a new SQLite file.
-///
+///
/// Note: rvault uses compile-time queries.
/// Hence, during development a migrated SQLite file is required.
/// Use `cargo sqlx database reset` if required.
diff --git a/src/storage/sealing/shamir.rs b/src/storage/sealing/shamir.rs
index 9960326..7bafc00 100644
--- a/src/storage/sealing/shamir.rs
+++ b/src/storage/sealing/shamir.rs
@@ -15,7 +15,7 @@ use zeroize::ZeroizeOnDrop;
use crate::DbPool;
-use super::{write_new_root_key, Sealing, UnsealResult};
+use super::{Sealing, UnsealResult, write_new_root_key};
type P256Share = DefaultShare, IdentifierPrimeField>;
@@ -38,7 +38,7 @@ pub struct ShamirBucket {
}
impl Sealing for ShamirBucket {
- fn new(protected_rk: Vec, nonce: Vec) -> Self {
+ fn new(protected_rk: Vec, nonce: Vec) -> Self {
Self {
portions: Vec::with_capacity(2),
protected_rk,
@@ -46,7 +46,7 @@ impl Sealing for ShamirBucket {
}
}
- async fn unseal(&mut self, key: String) -> UnsealResult {
+ async fn unseal(&mut self, key: String) -> UnsealResult {
let key = match BASE64_STANDARD.decode(key) {
Ok(v) => v,
Err(e) => {
diff --git a/src/storage/sealing/simple.rs b/src/storage/sealing/simple.rs
index 2b2ea74..18c9a39 100644
--- a/src/storage/sealing/simple.rs
+++ b/src/storage/sealing/simple.rs
@@ -6,7 +6,7 @@ use base64::{Engine, prelude::BASE64_STANDARD};
use crate::DbPool;
-use super::{write_new_root_key, Sealing, UnsealResult};
+use super::{Sealing, UnsealResult, write_new_root_key};
/// Pair of protected root key and nonce
#[derive(PartialEq)]
diff --git a/src/sys/root_generation.rs b/src/sys/root_generation.rs
index d9ae9a4..40ec82c 100644
--- a/src/sys/root_generation.rs
+++ b/src/sys/root_generation.rs
@@ -5,8 +5,8 @@ use crate::DbPool;
pub fn root_generation() -> Router {
Router::new()
// .route("/generate-root", get(get_root_generation_attempt))
- .route("/generate-root", post(generate_new_root))
// .route("/generate-root", delete(cancel_generate_root))
+ .route("/generate-root", post(generate_new_root))
}
async fn generate_new_root() {
diff --git a/src/sys/sealing.rs b/src/sys/sealing.rs
index dbec6a6..2dc765e 100644
--- a/src/sys/sealing.rs
+++ b/src/sys/sealing.rs
@@ -1,5 +1,7 @@
use axum::{
- extract::State, routing::{get, post, put}, Json, Router
+ Json, Router,
+ extract::State,
+ routing::{get, post, put},
};
use log::warn;
use serde::Deserialize;