This adds support for encrypting and decrypting secrets. It implements the APIs required for unsealing. The APIs are not complete or compliant. Reviewed-on: #1 Co-authored-by: C0ffeeCode <ritters_werth@outlook.com> Co-committed-by: C0ffeeCode <ritters_werth@outlook.com>
49 lines
1.4 KiB
Rust
49 lines
1.4 KiB
Rust
mod structs;
|
|
mod data;
|
|
mod meta;
|
|
|
|
// #[cfg(test)]
|
|
// mod tests;
|
|
|
|
use crate::storage::DbPool;
|
|
use axum::{
|
|
Router,
|
|
routing::*,
|
|
};
|
|
|
|
pub fn kv_router(pool: DbPool) -> Router {
|
|
Router::new()
|
|
.route("/config", get(get_config))
|
|
.route("/config", post(post_config))
|
|
.route("/data/{*path}", get(data::get_data))
|
|
// .route("/:mount_path/data/*path/", get(get_data))
|
|
.route("/data/{*path}", post(data::post_data))
|
|
// Why does HC V SDK expect PUT instead of POST - neither in the docs nor spec
|
|
.route("/data/{*path}", put(data::post_data))
|
|
.route("/data/{*path}", delete(data::delete_data))
|
|
.route("/delete/{*path}", post(meta::delete_path))
|
|
.route("/destroy/{*path}", post(meta::destroy_path))
|
|
.route("/metadata/{*path}", get(meta::get_meta))
|
|
// .route("/:mount_path/metadata/*path/", get(get_meta))
|
|
.route("/metadata/{*path}", post(meta::post_meta))
|
|
.route("/metadata/{*path}", delete(meta::delete_meta))
|
|
.route("/subkeys/{*path}", get(get_subkeys))
|
|
.route("/undelete/{*path}", post(post_undelete))
|
|
.with_state(pool)
|
|
}
|
|
|
|
async fn get_config() -> &'static str {
|
|
todo!("not implemented")
|
|
}
|
|
|
|
async fn post_config() -> &'static str {
|
|
todo!("not implemented")
|
|
}
|
|
|
|
async fn get_subkeys() -> &'static str {
|
|
todo!("not implemented")
|
|
}
|
|
|
|
async fn post_undelete() -> &'static str {
|
|
todo!("not implemented")
|
|
}
|