feat: vault core/CLI/workbench, vaultd token path, filetree view-state cleanup
Land password-vault dedicated workbench and mnote-vault-core/CLI, agent token read path design, vault transport split, and retire obsolete filetree smokes. Ignore local vault reimport scripts that trip secret scanners.
This commit is contained in:
@@ -92,6 +92,28 @@ impl WebError {
|
||||
}
|
||||
}
|
||||
|
||||
/// Map independent vault-core errors into HTTP WebError (12-2 P1a shared read path).
|
||||
impl From<mnote_vault_core::VaultError> for WebError {
|
||||
fn from(err: mnote_vault_core::VaultError) -> Self {
|
||||
use mnote_vault_core::VaultStatus;
|
||||
let status = match err.status {
|
||||
VaultStatus::BadRequest => StatusCode::BAD_REQUEST,
|
||||
VaultStatus::Unauthorized => StatusCode::UNAUTHORIZED,
|
||||
VaultStatus::Forbidden => StatusCode::FORBIDDEN,
|
||||
VaultStatus::NotFound => StatusCode::NOT_FOUND,
|
||||
VaultStatus::Conflict => StatusCode::CONFLICT,
|
||||
VaultStatus::Locked => StatusCode::from_u16(423).unwrap_or(StatusCode::FORBIDDEN),
|
||||
VaultStatus::Unavailable => StatusCode::SERVICE_UNAVAILABLE,
|
||||
VaultStatus::Internal => StatusCode::INTERNAL_SERVER_ERROR,
|
||||
};
|
||||
let mut web = WebError::new(status, err.code, err.message);
|
||||
if let Some(details) = err.details {
|
||||
web = web.with_details(details);
|
||||
}
|
||||
web
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoResponse for WebError {
|
||||
fn into_response(self) -> Response {
|
||||
let body = ErrorBody {
|
||||
|
||||
Reference in New Issue
Block a user