Add cross-platform keychain support using the keyring crate for secure credential storage with biometric authentication (TouchID on macOS, Windows Hello on Windows, Secret Service on Linux). - Add keychain module with enable/disable biometric unlock - Add Tauri commands for keychain operations - Add Keychain error variant for proper error handling - Add Java SDK foundation - Update milestone docs to reflect 95% completion
58 lines
1.3 KiB
Rust
58 lines
1.3 KiB
Rust
//! Error types for the desktop wallet
|
|
|
|
use serde::{Serialize, Serializer};
|
|
|
|
/// Result type for wallet operations
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
/// Wallet error types
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum Error {
|
|
#[error("Wallet is locked")]
|
|
WalletLocked,
|
|
|
|
#[error("Wallet not found")]
|
|
WalletNotFound,
|
|
|
|
#[error("Invalid password")]
|
|
InvalidPassword,
|
|
|
|
#[error("Invalid mnemonic phrase")]
|
|
InvalidMnemonic,
|
|
|
|
#[error("Insufficient balance: have {available}, need {required}")]
|
|
InsufficientBalance { available: u64, required: u64 },
|
|
|
|
#[error("Transaction error: {0}")]
|
|
Transaction(String),
|
|
|
|
#[error("Network error: {0}")]
|
|
Network(String),
|
|
|
|
#[error("RPC error: {0}")]
|
|
Rpc(String),
|
|
|
|
#[error("Crypto error: {0}")]
|
|
Crypto(String),
|
|
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Serialization error: {0}")]
|
|
Serialization(String),
|
|
|
|
#[error("Keychain error: {0}")]
|
|
Keychain(String),
|
|
|
|
#[error("Internal error: {0}")]
|
|
Internal(String),
|
|
}
|
|
|
|
impl Serialize for Error {
|
|
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
|
|
where
|
|
S: Serializer,
|
|
{
|
|
serializer.serialize_str(&self.to_string())
|
|
}
|
|
}
|