txgate_policy/lib.rs
1//! # txgate-policy
2//!
3//! Policy engine for transaction approval rules in the `TxGate` signing service.
4//!
5//! ## Internal Crate Warning
6//!
7//! **This crate is an internal implementation detail of [`txgate`](https://crates.io/crates/txgate).**
8//!
9//! It is published to crates.io only because Cargo requires all dependencies to be
10//! published. The API is **unstable** and may change without notice between any versions,
11//! including patch releases.
12//!
13//! **Do not depend on this crate directly.** Instead:
14//! - For the signing server binary: `cargo install txgate`
15//! - For programmatic access: Open an issue at <https://github.com/luisjpf/txgate>
16//! to discuss a stable public API.
17//!
18//! This crate provides the policy evaluation and rule management system:
19//!
20//! ## Modules
21//!
22//! - [`config`] - Policy configuration types
23//!
24//! ## Modules (planned)
25//!
26//! - `engine` - Policy evaluation engine
27//! - `rules` - Rule definitions and parsing
28//! - `conditions` - Condition types (amount limits, address allowlists, etc.)
29//! - `actions` - Policy actions (approve, deny, `require_approval`)
30//!
31//! ## Policy Features (planned)
32//!
33//! - Transaction amount limits (per-tx)
34//! - Address allowlists and blocklists
35//! - Contract function restrictions
36//! - Time-based rules (business hours, rate limiting)
37//! - Multi-signature approval workflows
38//! - Chain-specific policies
39//!
40//! ## Policy Format
41//!
42//! Policies are defined in YAML/JSON format and can be:
43//! - Loaded from files
44//! - Fetched from remote configuration servers
45//! - Defined programmatically
46//!
47//! ## Example Policy (conceptual)
48//!
49//! ```yaml
50//! policies:
51//! - name: "high_value_transfer"
52//! conditions:
53//! - type: "amount_greater_than"
54//! value: "10 ETH"
55//! action: "require_approval"
56//! approvers: ["admin@company.com"]
57//! ```
58
59#![forbid(unsafe_code)]
60#![warn(missing_docs)]
61#![warn(clippy::all)]
62#![warn(clippy::pedantic)]
63
64pub mod config;
65pub mod engine;
66
67pub use config::PolicyConfig;
68pub use engine::{DefaultPolicyEngine, PolicyCheckResult, PolicyEngine};
69
70// Placeholder for future modules
71// pub mod rules;
72// pub mod conditions;
73// pub mod actions;