API Reference
Complete API reference for the Privacy Boost CLI library (Rust).Generated Documentation
Full API documentation can be generated usingcargo doc:
PrivacyBoostCLI
Main CLI SDK interface for Rust applications.Constructor
config- CLI configuration
Result<PrivacyBoostCLI, CliError>
Example:
Connection & Authentication Methods
authenticate
private_key- Hex-encoded private keykey_source- Optional key derivation source.Nonedefaults toWalletDerived. Options:KeySource::WalletDerived,KeySource::Mnemonic { phrase },KeySource::RawSeed { hex_seed }token_provider- Optional custom token provider for server-mediated auth flows
Result<AuthResult, CliError> - either Authenticated(LoginResult) or CredentialRequired(CredentialChallenge)
submit_credential
authenticate() returns CredentialRequired.
Returns: Result<LoginResult, CliError>
logout
clear_session
is_authenticated
State Accessors
Balance Methods
get_balance
get_all_balances
Vault Operations
deposit
token_address- Token contract addressamount- Amount in wei (as string)
withdraw
token_address- Token contract addressamount- Amount in wei (as string)recipient- Recipient Ethereum address
send
token_address- Token contract addressamount- Amount in wei (as string)recipient_privacy_address- Recipient’s 194-char privacy address
prepare_shield
requestDeposit calldata plus the note
commitment; nothing is sent on-chain. Needs an authenticated session (keys) but
no wallet. After relaying, settle from the mined receipt with
privacy_boost_core::operations::finalize_shield.
Parameters:
token_address- Token contract address (use0x0for ETH)amount- Amount in wei (as string)recipient- Recipient privacy address;Noneshields to yourself
CLI subcommandsprepare-shieldandfinalize-shieldwrap these for shell use — see the Commands Reference.
Transaction History
Session Persistence
export_session
import_session
Address Lookup
resolve_identity
identifier- MPK or Ethereum address
Result<IdentityResult, CliError>
Utilities
Module Functions
CliConfig
CLI configuration struct.Constructor
Builder Methods
File Operations
Environment
NetworkPreset
Network preset enumeration.Methods
Local:"local","localhost","dev"OpSepolia:"op-sepolia","optimism-sepolia","opsepolia"
Types
KeySource
authenticate(). WalletDerived derives keys from a wallet signature, Mnemonic from a BIP-39 phrase, and RawSeed from a raw 32-byte hex seed.
AuthResult
LoginResult
TokenBalance
ShieldResult
UnshieldResult
TransferResult
PreparedShield
Returned byprepare_shield. Re-exported from
privacy_boost_core::operations. Carries no private material, so it is safe to
hand to a relayer. Each Call is a single on-chain call to relay; value and
data are 0x-hex.
Transaction
StatusInfo
IdentityResult
ExportedSession
Re-exported fromprivacy_boost_core::sdk_state::ExportedSession:
CliError
Default Values
Complete Example
Gift & Portal Commands
Claimable transfers and portal deposit addresses are preview features (pending external audit), exposed as CLI subcommands:- Claimable Transfers —
gift-fund-to-wallet,gift-fund,gift-list,gift-claim,gift-claim-from-link,gift-refund-by-record,gift-refund,gift-decode-link - Portal Deposits —
portal create | list | status | deposits | sweep | reclaim | withdraw
See Also
- Getting Started - Basic CLI usage
- Commands Reference - CLI commands
- Claimable Transfers - Send to an unregistered wallet
- Portal Deposits - Reusable public deposit addresses
- Network Presets - Network configuration