reorganize backend
This commit is contained in:
1 parent
c19b573b26
commit
397928b8f1
6 files changed
+134
-136
No files matched your search
+30
-5
@@ -1,10 +1,35 @@
|
||||
pub enum RequestResponse {
|
||||
use serde::{Serialize, Deserialize};
|
||||
use tauri::State;
|
||||
|
||||
use crate::state::AppState;
|
||||
use crate::storage;
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct RequestResponse {
|
||||
pub id: u64,
|
||||
pub approval: Approval,
|
||||
}
|
||||
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub enum Approval {
|
||||
Approved,
|
||||
Denied,
|
||||
}
|
||||
|
||||
|
||||
pub struct Request {
|
||||
pub id: u64,
|
||||
pub response: RequestResponse,
|
||||
}
|
||||
#[tauri::command]
|
||||
pub fn respond(response: RequestResponse, app_state: State<'_, AppState>) -> Result<(), String> {
|
||||
app_state.send_response(response)
|
||||
.map_err(|e| format!("Error responding to request: {e}"))
|
||||
}
|
||||
|
||||
|
||||
#[tauri::command]
|
||||
pub fn unlock(passphrase: String, app_state: State<'_, AppState>) -> bool {
|
||||
let root_credentials = storage::load(&passphrase);
|
||||
// get new session from AWS and store in app state
|
||||
true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user