dynamic-waas-sdk 0.0.3

Rust SDK for Dynamic Wallet-as-a-Service — manage wallets from your backend.
Documentation
//! # dynamic-waas-sdk
//!
//! Rust SDK for Dynamic Labs `WaaS` — create and manage MPC wallets from a
//! backend service.
//!
//! Stateless v1 contract: every operation that touches an existing wallet
//! takes explicit `wallet_properties` + `external_server_key_shares`
//! parameters. Nothing is held inside the client across calls. See the
//! design doc at `docs/design/rust-sdk.md` for the full contract.
//!
//! ## Quick start
//!
//! ```no_run
//! use dynamic_waas_sdk::{DynamicWalletClient, DynamicWalletClientOpts};
//!
//! # async fn ex() -> Result<(), dynamic_waas_sdk::Error> {
//! let mut client = DynamicWalletClient::new(
//!     DynamicWalletClientOpts::new("env-id"),
//! )?;
//! client.authenticate_api_token("dyn_...").await?;
//!
//! let wp = client.fetch_wallet_metadata("0xabc...").await?;
//! # Ok(())
//! # }
//! ```
//!
//! For chain-specific signing, depend on `dynamic-waas-sdk-evm` or
//! `dynamic-waas-sdk-svm` (T8/T9 in the rust-sdk epic).

#![doc(html_favicon_url = "https://dynamic.xyz/favicon.ico")]
#![doc(html_logo_url = "https://dynamic.xyz/logo.svg")]
#![forbid(unsafe_code)]

// Re-exports from -core for one-stop ergonomics.
pub use dynamic_waas_sdk_core::{
    BackupLocation, BackupLocationInfo, ChainName, Environment, Error, KeyShareBackupInfo,
    RefreshResult, ReshareResult, Result, ServerKeyShare, ThresholdSignatureScheme,
    UpdatePasswordResult, WalletProperties,
};

// Re-exports from -mpc for chain-client crates that need MessageHash etc.
// `EcdsaSigner` and `Ed25519Signer` are intentionally NOT re-exported —
// customers don't need them; the chain clients (T8/T9) own MPC signers
// internally.
pub use dynamic_waas_sdk_mpc::{MessageHash, MpcError};

pub use client::{DynamicWalletClient, DynamicWalletClientOpts};
pub use delegated_client::{DelegatedWalletClient, DelegatedWalletClientOpts};
pub use dynamic_waas_sdk_mpc::EcdsaSignature;
pub use webhook::{
    decrypt_delegated_webhook_data, DecryptedWebhookData, EncryptedDelegatedPayload,
};

// Orchestration helpers — chain client crates (T8/T9) use these to
// implement their `create_wallet_account` and `sign_message` methods.
pub use backup::{run_backup_dynamic, run_mark_external_no_backup, run_recover_key_shares};
pub use export::{run_export_ecdsa, run_export_ed25519};
pub use keygen::{run_keygen, KeygenOpts, KeygenOutput};
pub use keygen_ed25519::{run_keygen_ed25519, KeygenOptsEd25519, KeygenOutputEd25519};
pub use sign::{run_sign_ecdsa, SignOpts};
pub use sign_ed25519::{run_sign_ed25519, SignOptsEd25519};

pub mod mpc_config;

mod backup;
mod client;
mod crypto;
mod delegated_client;
mod export;
mod keygen;
mod keygen_ed25519;
mod sign;
mod sign_ed25519;
mod webhook;

/// Authentication-required error message reused across orchestration
/// helpers. Centralised so the wording stays consistent and Sonar's
/// duplicated-literal rule has nothing to flag.
pub(crate) const AUTH_REQUIRED_MSG: &str =
    "client must be authenticated; call authenticate_api_token first";