cargo fmt
This commit is contained in:
parent
ed715102c0
commit
ba1a5f728c
14 changed files with 40 additions and 35 deletions
|
|
@ -209,7 +209,6 @@ async fn post_lookup(
|
||||||
// The following functions are placeholders for the various token-related operations.
|
// The following functions are placeholders for the various token-related operations.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
async fn get_accessors() -> &'static str {
|
async fn get_accessors() -> &'static str {
|
||||||
todo!("not implemented")
|
todo!("not implemented")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
use axum::{
|
use axum::{
|
||||||
|
Json,
|
||||||
body::Body,
|
body::Body,
|
||||||
http::StatusCode,
|
http::StatusCode,
|
||||||
response::{IntoResponse, Response},
|
response::{IntoResponse, Response},
|
||||||
Json,
|
|
||||||
};
|
};
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
pub mod kv;
|
pub mod kv;
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
|
Extension, Router,
|
||||||
body::Body,
|
body::Body,
|
||||||
extract::{Request, State},
|
extract::{Request, State},
|
||||||
http::{StatusCode, Uri},
|
http::{StatusCode, Uri},
|
||||||
response::{IntoResponse, Response},
|
response::{IntoResponse, Response},
|
||||||
Extension, Router,
|
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
use tower::Service;
|
use tower::Service;
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,12 @@
|
||||||
mod structs;
|
|
||||||
mod data;
|
mod data;
|
||||||
mod meta;
|
mod meta;
|
||||||
|
mod structs;
|
||||||
|
|
||||||
// #[cfg(test)]
|
// #[cfg(test)]
|
||||||
// mod tests;
|
// mod tests;
|
||||||
|
|
||||||
use crate::storage::DbPool;
|
use crate::storage::DbPool;
|
||||||
use axum::{
|
use axum::{Router, routing::*};
|
||||||
Router,
|
|
||||||
routing::*,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn kv_router(pool: DbPool) -> Router {
|
pub fn kv_router(pool: DbPool) -> Router {
|
||||||
Router::new()
|
Router::new()
|
||||||
|
|
|
||||||
|
|
@ -7,9 +7,13 @@
|
||||||
|
|
||||||
use super::structs::KvV2WriteRequest;
|
use super::structs::KvV2WriteRequest;
|
||||||
use crate::{
|
use crate::{
|
||||||
common::HttpError, engines::{
|
DbPool,
|
||||||
kv::structs::{KvSecretData, KvSecretRes, KvV2WriteResponse, Wrapper}, EnginePath
|
common::HttpError,
|
||||||
}, storage::sealing::Secret, DbPool
|
engines::{
|
||||||
|
EnginePath,
|
||||||
|
kv::structs::{KvSecretData, KvSecretRes, KvV2WriteResponse, Wrapper},
|
||||||
|
},
|
||||||
|
storage::sealing::Secret,
|
||||||
};
|
};
|
||||||
use axum::{
|
use axum::{
|
||||||
Extension, Json,
|
Extension, Json,
|
||||||
|
|
@ -128,7 +132,10 @@ pub async fn post_data(
|
||||||
|
|
||||||
let content = serde_json::to_string(&secret.data).unwrap();
|
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 nonce = nonce.as_slice();
|
||||||
|
|
||||||
let mut tx = pool.begin().await.unwrap();
|
let mut tx = pool.begin().await.unwrap();
|
||||||
|
|
|
||||||
|
|
@ -8,12 +8,12 @@
|
||||||
|
|
||||||
use crate::common::HttpError;
|
use crate::common::HttpError;
|
||||||
use axum::{
|
use axum::{
|
||||||
|
Router,
|
||||||
extract::Request,
|
extract::Request,
|
||||||
http::StatusCode,
|
http::StatusCode,
|
||||||
middleware::{self, Next},
|
middleware::{self, Next},
|
||||||
response::{IntoResponse, Response},
|
response::{IntoResponse, Response},
|
||||||
routing::get,
|
routing::get,
|
||||||
Router,
|
|
||||||
};
|
};
|
||||||
use log::*;
|
use log::*;
|
||||||
use std::{env, net::SocketAddr, str::FromStr};
|
use std::{env, net::SocketAddr, str::FromStr};
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ pub mod sealing;
|
||||||
use std::{fs::File, path::Path};
|
use std::{fs::File, path::Path};
|
||||||
|
|
||||||
use log::*;
|
use log::*;
|
||||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite};
|
use sqlx::{Pool, Sqlite, sqlite::SqlitePoolOptions};
|
||||||
|
|
||||||
pub(crate) type DbType = Sqlite;
|
pub(crate) type DbType = Sqlite;
|
||||||
pub(crate) type DbPool = Pool<DbType>;
|
pub(crate) type DbPool = Pool<DbType>;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use zeroize::ZeroizeOnDrop;
|
||||||
|
|
||||||
use crate::DbPool;
|
use crate::DbPool;
|
||||||
|
|
||||||
use super::{write_new_root_key, Sealing, UnsealResult};
|
use super::{Sealing, UnsealResult, write_new_root_key};
|
||||||
|
|
||||||
type P256Share = DefaultShare<IdentifierPrimeField<Scalar>, IdentifierPrimeField<Scalar>>;
|
type P256Share = DefaultShare<IdentifierPrimeField<Scalar>, IdentifierPrimeField<Scalar>>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ use base64::{Engine, prelude::BASE64_STANDARD};
|
||||||
|
|
||||||
use crate::DbPool;
|
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
|
/// Pair of protected root key and nonce
|
||||||
#[derive(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@ use crate::DbPool;
|
||||||
pub fn root_generation() -> Router<DbPool> {
|
pub fn root_generation() -> Router<DbPool> {
|
||||||
Router::new()
|
Router::new()
|
||||||
// .route("/generate-root", get(get_root_generation_attempt))
|
// .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", delete(cancel_generate_root))
|
||||||
|
.route("/generate-root", post(generate_new_root))
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn generate_new_root() {
|
async fn generate_new_root() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
use axum::{
|
use axum::{
|
||||||
extract::State, routing::{get, post, put}, Json, Router
|
Json, Router,
|
||||||
|
extract::State,
|
||||||
|
routing::{get, post, put},
|
||||||
};
|
};
|
||||||
use log::warn;
|
use log::warn;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue