- AppError enum with 10 variants (Database, Auth, Filesystem, Ipc, NotFound,
Validation, Sidecar, Config, Network, Internal) + serde tag serialization
- From impls for rusqlite::Error, std::io::Error, serde_json::Error
- Migrated 9 command modules from Result<T, String> to Result<T, AppError>
- Frontend receives structured {kind, detail} objects via IPC
35 lines
921 B
Rust
35 lines
921 B
Rust
use crate::error::AppError;
|
|
use crate::secrets::SecretsManager;
|
|
|
|
#[tauri::command]
|
|
pub fn secrets_store(key: String, value: String) -> Result<(), AppError> {
|
|
SecretsManager::store_secret(&key, &value).map_err(AppError::auth)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn secrets_get(key: String) -> Result<Option<String>, AppError> {
|
|
SecretsManager::get_secret(&key).map_err(AppError::auth)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn secrets_delete(key: String) -> Result<(), AppError> {
|
|
SecretsManager::delete_secret(&key).map_err(AppError::auth)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn secrets_list() -> Result<Vec<String>, AppError> {
|
|
SecretsManager::list_keys().map_err(AppError::auth)
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn secrets_has_keyring() -> bool {
|
|
SecretsManager::has_keyring()
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub fn secrets_known_keys() -> Vec<String> {
|
|
crate::secrets::KNOWN_KEYS
|
|
.iter()
|
|
.map(|s| s.to_string())
|
|
.collect()
|
|
}
|