1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
//! MPC Wallet System for Tenzro Network
//!
//! This crate provides auto-provisioned threshold wallets for Tenzro Network,
//! an AI-Native, Agentic, Tokenized Settlement Layer blockchain.
//!
//! # Key Features
//!
//! - **Seamless Onboarding**: Auto-provisioned MPC wallets - no seed phrases to manage
//! - **Threshold Signatures**: 2-of-3 (configurable) multi-party signing
//! - **Multi-Asset Support**: TNZO (native settlement), plus USDC, USDT, and major tokens
//! - **Encrypted Storage**: Password-protected keystore for key shares (Argon2id)
//! - **Transaction Validation**: Chain ID, nonce, gas, address, and data size checks
//! - **Signature Verification**: Automatic post-signing cryptographic verification
//! - **Nonce Management**: Per-address sequential nonces with replay protection
//! - **Transaction History**: Full lifecycle tracking with filtering and pagination
//! - **Address Book**: Contact management with name resolution and tag filtering
//! - **State Sync**: On-chain balance/nonce synchronization via ChainStateProvider
//! - **Transaction Builder**: Type-safe builder pattern with auto gas estimation
//! - **Key Zeroization**: Sensitive key material zeroized on drop
//!
//! # Architecture
//!
//! The wallet system uses Multi-Party Computation (MPC) to distribute key shares
//! across multiple parties. A threshold number of shares (e.g., 2 out of 3) are
//! required to generate signatures, providing security without single points of failure.
//!
//! # Examples
//!
//! ## Provisioning a new wallet
//!
//! ```no_run
//! use tenzro_wallet::service::TenzroWalletService;
//! use tenzro_wallet::traits::WalletService;
//!
//! # async fn example() -> tenzro_wallet::error::Result<()> {
//! let service = TenzroWalletService::new()?;
//!
//! // Auto-provision a new MPC wallet
//! let wallet = service.provision_wallet().await?;
//!
//! println!("Wallet created: {}", wallet.wallet_id);
//! println!("Address: {}", wallet.address);
//! println!("Threshold: {}-of-{}", wallet.threshold, wallet.total_shares);
//! # Ok(())
//! # }
//! ```
//!
//! ## Building and signing a transaction
//!
//! ```no_run
//! use tenzro_wallet::service::TenzroWalletService;
//! use tenzro_wallet::traits::WalletService;
//! use tenzro_wallet::builder::TransactionBuilder;
//! use tenzro_types::primitives::{Address, Nonce};
//!
//! # async fn example() -> tenzro_wallet::error::Result<()> {
//! let service = TenzroWalletService::new()?;
//! let wallet = service.provision_wallet().await?;
//!
//! // Build a validated transfer transaction. `from_wallet_pq` binds the
//! // wallet's classical address AND its ML-DSA-65 verifying key into the
//! // transaction so the hybrid signature stays self-consistent.
//! let tx = TransactionBuilder::default_chain()
//! .from_wallet_pq(&wallet)
//! .to(Address::new([2u8; 32]))
//! .nonce(service.next_nonce(&wallet.address))
//! .transfer(1000)
//! .build_validated()?;
//!
//! // Sign (validates, signs with MPC threshold + ML-DSA-65, verifies both legs)
//! let signature = service.sign_transaction(&wallet.wallet_id, &tx).await?;
//! println!(
//! "Signature: classical={} bytes, pq={} bytes",
//! signature.classical.len(),
//! signature.pq.len(),
//! );
//! # Ok(())
//! # }
//! ```
// Re-export commonly used types
pub use ;
pub use ;
pub use TransactionBuilder;
pub use ;
pub use ;
pub use ;
pub use Keystore;
pub use ;
pub use NonceManager;
pub use ;
pub use ;
pub use HybridSignatureBytes;
pub use ;
pub use WalletService;
pub use ;
pub use ;
pub use ;