Expand description
Rust bindings for the Beekeeper wallet daemon.
This crate exposes the same wallet-management surface as the
@hiveio/beekeeper npm package (programs/beekeeper/beekeeper_wasm),
but as a native Rust library. The underlying wallet logic and crypto
primitives live in the shared C++ core/ library and the FC-backed
fc_crypto_bridge, reached through a cxx bridge
(ffi::BeekeeperHolder). Storage callbacks are still injected from
Rust via RustStorageProtocol.
§Quick start
use beekeeper::prelude::*;
let bk = BeekeeperApi::new(
BeekeeperOptions::new("./storage_root-rust").unlock_timeout(900),
);
let session = bk.create_session().unwrap();
let mut created = session.create_wallet("my-wallet", "password").unwrap();
let pubkey = created.import_key("5J...wif...").unwrap();
let sig = created.sign_digest(&pubkey, "deadbeef...").unwrap();
// Dropping `session` locks its wallets and closes the session.§Design notes
The API follows the npm package, but where Rust allows a safer shape than a 1:1 port, the Rust shape wins:
- Synchronous API. All calls are blocking.
- Sessions close on
Drop. Asession::Sessionis an owned guard that locks its wallets and closes itself when it goes out of scope; there is no explicitclose. - Lock state lives in the type system.
unlock/lock/closeconsume the wallet handle and return the next state, so stale handles are unrepresentable. - Fixed backends. Storage is always the bundled filesystem-backed
storage::RustStorageProtocoland crypto is always the FC-backed provider; in-memory mode is selected throughBeekeeperOptions::in_memory. The key prefix is hard-coded towallet::DEFAULT_KEY_PREFIX("STM").
Re-exports§
pub use api::BeekeeperApi;pub use options::BeekeeperOptions;
Modules§
- api
- The top-level
BeekeeperApihandle. - ffi
cxx-generated FFI between Rust and the C++beekeeper_rs::beekeeper_holder.- options
- Construction options for
BeekeeperApi. - prelude
- One-line import for everything the README examples use.
- session
- Per-session wallet operations.
- wallet
- Locked / unlocked wallet handles.
Structs§
- Rust
Storage Protocol - Filesystem storage backend handed to C++ as a
Box<RustStorageProtocol>.
Enums§
- Beekeeper
Error - Every failure surfaced by the Rust facade.
Functions§
- new_
rust_ storage_ protocol - Build a
RustStorageProtocolrooted atstorage_root.