Files
net/hanzo-kbs/src/error.rs
T
Hanzo Dev 82aa28a247 feat: initial commit — hanzonet workspace extracted from hanzoai/node
This repo holds the network-layer Rust crates previously living under
github.com/hanzoai/node:hanzo-libs/. Breaking them out gives each crate
its own version + publish cadence and lets downstream consumers depend on
them without pulling the whole node tree.

Highlights:

- hanzo-hmm — Hidden Markov Model primitives + Hamiltonian MarketMaker
  for pricing heterogeneous compute. 17 lib tests pass. Earlier was named
  hanzo-llm (misleading) and the standalone hmm stub; both merged here
  with HLLM* identifier prefixes scrubbed.
- hanzo-vm — Hanzo EVM with precompiles wired to canonical
  libluxprecompile.dylib (PQ verify, Quasar) and hanzo-engine
  (AI inference, embedding). 37 lib tests pass (DYLD_LIBRARY_PATH=
  /Users/z/work/lux/precompile/dist).
- hanzo-machine — VM lifecycle (Apple Virtualization.framework via vfkit
  on macOS; KVM on Linux), thin Rust wrapper over canonical C++ impl
  in github.com/luxfi/luxcpp/machine.
- hanzo-pqc / hanzo-did / hanzo-identity / hanzo-libp2p* — crypto +
  identity + networking primitives.
- hanzo-l2 / hanzo-consensus / hanzo-mining — chain layer.
- hanzo-api / hanzo-http-api / hanzo-mcp / hanzo-tools / hanzo-tools-runner
  — service + tooling crates.

Build: `cargo build --workspace` succeeds in ~25min cold (44 crates).
2026-05-12 21:16:17 -07:00

47 lines
1.1 KiB
Rust

//! Error types for Hanzo Security
use thiserror::Error;
#[derive(Error, Debug)]
pub enum SecurityError {
#[error("Key not found: {0}")]
KeyNotFound(String),
#[error("Invalid attestation: {0}")]
InvalidAttestation(String),
#[error("Policy violation: {0}")]
PolicyViolation(String),
#[error("Cryptographic error: {0}")]
CryptoError(String),
#[error("HSM error: {0}")]
HsmError(String),
#[error("KMS error: {0}")]
KmsError(String),
#[error("KBS error: {0}")]
KbsError(String),
#[error("Tier mismatch: requested {requested}, available {available}")]
TierMismatch { requested: u8, available: u8 },
#[error("Session expired")]
SessionExpired,
#[error("Rate limit exceeded")]
RateLimitExceeded,
#[error("Serialization error: {0}")]
SerializationError(#[from] serde_json::Error),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("Other error: {0}")]
Other(#[from] anyhow::Error),
}
pub type Result<T> = std::result::Result<T, SecurityError>;