Dfns Rust SDK
Welcome, builders. This repo holds the Dfns Rust SDK. Useful links:
Installation
Quick Start
use ;
async
User Action Signing
Some operations (like creating wallets or signing transactions) require user action signing.
The transport handles the challenge dance (/auth/action/init -> sign -> /auth/action)
automatically; you provide the signing step by implementing the UserActionSigner trait
with your credential's key material:
use Arc;
use async_trait;
use Error;
use ;
use CreateWalletRequest;
use ;
async
Delegated Signing
In some setups your server talks to Dfns on behalf of a user, while the user keeps signing
every request themselves (e.g. with a WebAuthn credential in a web app). DfnsDelegatedClient
supports this: it needs no signer, and every operation that requires a user action signature
is split into a <method>_init / <method>_complete pair.
<method>_inittakes the request payload and returns theUserActionChallengeto be signed by the end user (typically in the browser).<method>_completetakes the same payload, the challenge identifier, and the signed assertion, and performs the request.
use CredentialAssertion;
use CreateWalletRequest;
use ;
async
Available Domains
The client provides access to the following API domains:
client.address_watches- Address watch operations (6 endpoints)client.agreements- Agreement management (2 endpoints)client.allocations- Allocation management (6 endpoints)client.auth- Authentication and user management (58 endpoints)client.exchanges- Exchange integrations (9 endpoints)client.fee_sponsors- Fee sponsor management (7 endpoints)client.keys- Key management (12 endpoints)client.networks- Network information (7 endpoints)client.payins- Payin operations (6 endpoints)client.payouts- Payout operations (5 endpoints)client.permissions- Permission management (8 endpoints)client.policies- Policy management (8 endpoints)client.signers- Signer management (17 endpoints)client.staking- Staking operations (6 endpoints)client.swaps- Token swap operations (5 endpoints)client.vaults- Vault operations (15 endpoints)client.wallets- Wallet operations (29 endpoints)client.webhooks- Webhook subscriptions (8 endpoints)
Each domain provides typed methods for all available API endpoints.
Error Handling
All methods return Result<T, dfns_sdk_rust::Error>:
use Error;
match client.wallets.get_wallet.await
The Error enum covers API errors (decoded and raw), configuration errors, missing or
failing signers, transport failures, and (de)serialization failures.
License
MIT License - See LICENSE file for details.