fints-rs
A pure Rust implementation of the FinTS 3.0 (formerly HBCI) banking protocol for German online banking.
Features
- Full FinTS 3.0 PinTan implementation (two-step and decoupled TAN)
- Typestate protocol layer — invalid dialog state transitions are compile-time errors
- Bank-specific workflows (DKB, generic FinTS banks)
- Built-in registry of 1000+ German banks with FinTS endpoints
- Account balance, transaction history (MT940), and securities/depot holdings
- CLI client for interactive banking from the terminal
- Mock server for integration testing
- Debug & audit tooling for protocol inspection
Installation
As a library
Add to your Cargo.toml:
[]
= "0.1"
The crate is published as fints-rs on crates.io but the library name is fints, so all imports use use fints::....
CLI client
This installs the fints-client binary.
Library Usage
Quick start — DKB
use ;
async
Generic bank access (any FinTS bank)
use ;
async
Bank lookup
use ;
// Look up a bank by BLZ
if let Some = bank_by_blz
// List all known banks
for bank in all_banks
Low-level protocol access
The typestate Dialog API enforces correct protocol usage at compile time:
use Dialog;
use *;
// Dialog<New> → sync → Dialog<Synced> → open → Dialog<Open> → business ops
// Calling business methods on Dialog<New> won't compile.
States: New → Synced → Open → TanPending → back to Open after TAN.
CLI Usage
First-time setup
# or by BLZ:
This performs a sync dialog, discovers accounts and TAN methods, and saves a session file for future use.
Sync (balance + transactions + holdings)
Balance only
Transactions
Holdings (securities/depot)
Custom bank (by URL)
Session management
Debug & audit tools
# Inspect bank capabilities
# Decode a raw FinTS message
|
# Audit a bank's protocol compliance
Output formats
All data commands support --output human (default), --output json, and --output csv.
Environment variables
| Variable | Description |
|---|---|
FINTS_PRODUCT_ID |
Override the default FinTS product registration ID |
FINTS_SESSION_DIR |
Override the session storage directory |
Global options
--bank <BLZ|name> Bank identifier (BLZ or shorthand like "dkb")
--user <USER_ID> FinTS user ID
--pin <PIN> PIN (prefer interactive prompt instead)
--product-id <ID> FinTS product registration ID
--verbose / -v Show decoded FinTS segments
--debug-wire Show hex wire dumps
--no-persist Don't save session; print resume token instead
--resume-token <TOK> Resume from a previously printed token
Architecture
┌─────────────────────────────────────────────────┐
│ Flow API │ ← High-level 2-step TAN flow
├─────────────────────────────────────────────────┤
│ Workflow layer │ ← Bank-specific logic (DKB, Generic)
│ BankOps trait + AnyBank │
├─────────────────────────────────────────────────┤
│ Protocol layer │ ← Typestate Dialog<S> state machine
│ Dialog<New|Synced|Open|TanPending> │
├──────────────────┬──────────────────────────────┤
│ Segments │ Message builder │ ← HKSAL, HKKAZ, HKTAN, ...
├──────────────────┼──────────────────────────────┤
│ Parser │ Serializer │ ← Wire format (DEG/DE encoding)
├──────────────────┴──────────────────────────────┤
│ Transport (HTTPS) │ ← Base64 over HTTPS POST
└─────────────────────────────────────────────────┘
Feature flags
| Feature | Description |
|---|---|
cli |
Enables the fints-client binary (clap, rpassword, comfy-table, csv, flate2) |
server |
Enables the fints-server mock server binary (axum) |
No features are enabled by default — the library is lightweight with minimal dependencies.
FinTS Product Registration
To use FinTS with German banks in production, you need a registered product ID from the Deutsche Kreditwirtschaft. Set it via:
ProductId::new("YOUR_ID")in code--product-id YOUR_IDon the CLIFINTS_PRODUCT_ID=YOUR_IDenvironment variable
License
MIT