comdirect-rest-api
High-availability Rust client for the comdirect REST API.
This crate provides:
- Typed API access for
accountsandbrokerageendpoints - Session lifecycle orchestration (
login,try_restore,shutdown) - Automatic token refresh with state and refresh-token callbacks
- Retry and infrastructure helpers for resilient API calls
- Optional web-based interactive TAN flow via the
webfeature
Installation
Add to your Cargo.toml:
[]
= "0.2.0"
Enable web login routes when needed:
[]
= { = "0.2.0", = ["web"] }
Quick Start
1. Restore an existing session (recommended for services)
use ;
async
2. Interactive login flow
use ;
use ;
async
Important: comdirect does not provide a redirect-based completion step for this TAN flow.
Your application callback must wait for an explicit user confirmation signal (for example a
frontend button like "I've allowed it") before returning TanAction::ConfirmPushTan.
API Surface
Top-level modules:
session: auth lifecycle, restore/login flow, refresh worker integrationaccounts: typed account endpoints (balances, single balance, transactions)brokerage: typed brokerage endpoints (depots, positions, instruments)auth,types,error: shared auth models, common types, and error handlingweb(feature-gated): mounts browser-driven auth routes for TAN workflows
Optional Web Feature
When web is enabled, you can expose login routes with Axum.
Session::login_web(...)mounts default auth routes under/comdirectmount_session_login_route(...)allows custom route mounting- The callback must still wait for explicit user confirmation before submitting
ConfirmPushTan
Development
Run tests for this crate:
Run with optional web feature tests/build:
License
Licensed under either:
- MIT
- Apache-2.0
at your option.