fints/lib.rs
1//! # fints — Native Rust FinTS 3.0 PinTan Client
2//!
3//! A pure Rust implementation of the FinTS 3.0 (formerly HBCI) banking protocol
4//! for German online banking.
5//!
6//! ## Architecture
7//!
8//! 1. **Protocol layer** (`protocol`): Typestate `Dialog<S>` — the dialog's auth
9//! state is in the type system. Business ops on an unauthenticated dialog = compile error.
10//!
11//! 2. **Workflow layer** (`workflow`): Bank-specific workflows via `BankOps` trait.
12//!
13//! 3. **Bank modules** (`dkb`): High-level, bank-specific APIs.
14//!
15//! ## DKB — Quick start
16//!
17//! ```rust,no_run
18//! use fints::{dkb, Account, UserId, Pin, ProductId};
19//!
20//! # async fn example() -> fints::Result<()> {
21//! let (session, challenge) = dkb::connect(
22//! &UserId::new("user"), &Pin::new("pin"), &ProductId::new("PRODUCT_ID"), None,
23//! ).await?;
24//! // User confirms pushTAN in banking app...
25//! let account = Account::new("DE123...", "BYLADEM1001")?; // BIC required!
26//! let data = session.fetch(&account, 365).await?;
27//! println!("Balance: {:?}, {} transactions", data.balance, data.transactions.len());
28//! # Ok(())
29//! # }
30//! ```
31//!
32//! ## Generic bank access
33//!
34//! ```rust,no_run
35//! use fints::{Flow, UserId, Pin, ProductId};
36//!
37//! # async fn example() -> fints::Result<()> {
38//! let (mut flow, challenge) = Flow::initiate(
39//! "12030000", &UserId::new("user"), &Pin::new("pin"), &ProductId::new("PRODUCT_ID"),
40//! None, None, None,
41//! ).await?;
42//! let result = flow.confirm_and_fetch("DE123...", "BYLADEM...", 365).await?;
43//! # Ok(())
44//! # }
45//! ```
46
47// ── Infrastructure ──
48pub mod banks;
49pub mod banks_generated;
50pub mod error;
51pub(crate) mod message;
52pub(crate) mod parser;
53pub(crate) mod segments;
54pub(crate) mod serializer;
55pub(crate) mod transport;
56pub mod types;
57
58// ── Tooling ──
59pub mod debug;
60pub mod audit;
61
62// ── Architecture ──
63pub mod protocol;
64pub mod workflow;
65pub mod flow;
66
67// ── Bank APIs ──
68pub mod dkb;
69
70// ═══════════════════════════════════════════════════════════════════════════════
71// Re-exports
72// ═══════════════════════════════════════════════════════════════════════════════
73
74// Flow layer
75pub use flow::{Flow, ChallengeInfo, SyncResult, FetchOptions};
76
77// Workflow layer
78pub use workflow::{BankOps, AnyBank, Dkb, GenericBank, bank_ops, bank_ops_with_config};
79pub use workflow::{InitiateOutcome, InitiateResult, InitiateNoTanResult, FetchResult, FetchOpts};
80
81// Protocol layer
82pub use protocol::{
83 Dialog, Response, TanChallenge, BankParams, Account,
84 New, Synced, Open, TanPending,
85 InitResult, SendResult, PollResult,
86 BalanceResult, TransactionResult, TransactionPage,
87 HoldingsResult, HoldingsPage,
88};
89
90// Domain types
91pub use types::{
92 AccountBalance, SepaAccount, Transaction, TransactionStatus, TanMethod,
93 SecurityHolding, Isin, Wkn,
94 Blz, UserId, Pin, SystemId, ProductId, DialogId, SecurityFunction,
95 TaskReference, SegmentType, TanMediumName, TouchdownPoint, SegmentRef,
96 Currency, Iban, Bic, TanProcess, ResponseCodeKind, ResponseCode,
97 BankName, FinTSUrl, ChallengeText, HhdUcData, Mt940Data,
98};
99pub use error::{FinTSError, Result};
100pub use banks::{BankConfig, all_banks, bank_by_blz};
101
102// Debug / audit tooling
103pub use debug::{DecodedMessage, DecodedSegment, VerbosityLevel, decode_message, format_decoded};
104pub use audit::{AuditReport, Violation, ViolationSeverity, audit_client_message, audit_server_response};