Available on crate feature
trace only.Expand description
Recording dialogs as masked, anonymised traces (feature trace).
Recorderdecorates aTransport(Recorder::wrap) and keeps every exchange that goes through the wrapped transport, masked as it is recorded, so credentials never sit in memory unmasked: PIN, TAN, challenges, subaccounts and binary data other than statements, pain messages and IDs become*; names, product names, amounts and the statements in HIKAZ, HICAZ, HIWPD and HIWDU keep only their shape, values as#in fixed lengths, and every date is moved by the same few days. Identity values get a stand-in. Account identifiers (IBANs, account numbers, user and customer ID, creditor IDs) get aliases numbered in the order they first appear in this trace, from a random start, with no link to the value; the same value gets the same alias everywhere in the trace, IBANs keep country and bank code and valid check digits, and an IBAN’s account part matches the alias of the same account number. The table lives in the recorder’s memory only. References and IDs (booking references, end-to-end, message and payment information IDs, mandate references, system ID, order, VOP and polling IDs) get keyed pseudonyms. Their key is aSalt:Recorder::newdraws one and forgets it, so the trace links to no other; traces recorded with the same salt (Recorder::with_salt) give a reference the same pseudonym, while their account aliases stay unrelated. The library writes no salt. It records exactly the dialogs that use the wrapped transport, whatever thread they run on; two recorders never see each other’s traffic. A failed send is recorded with a short, content-freeerror. It also names the account each request is about (Exchange::account, an alias such as#2described by aTraceAccount): aliases are numbered in the order the accounts first appear in a HIUPD, and the recorder keeps only keyed hashes of their identifiers (a per-recorder random key that is never written), never the identifiers themselves.Traceis the fixture: one JSON document (TRACE_FORMAT, seeTrace::to_json).Trace::from_exchangesanonymises the rest.Trace::summaryreads it for a human, oneExchangeSummaryper exchange.
Independent of the TRACE event the transport boundary emits for log
consumers (mask::EXCHANGE_TARGET).
Clean room: written from the FinTS 3.0 specification and our own masking
rules (mask).
Structs§
- Client
- The client that recorded a trace.
- Code
- A return code with its text (one element of HIRMG or HIRMS).
- Exchange
- One request and its response, as wire bytes (ISO 8859-1, with the PIN/TAN envelope), redacted; or the request and the error that ended it.
- Exchange
Summary - One exchange of a trace, read for a human: what was asked, what the
bank answered. Built by
Trace::summary; never fails. - Recorder
- Records the exchanges of the transports it wraps. Cheap to clone; clones
share the log. Wrap a transport (
Recorder::wrap), hand it to the dialogs (with_transport), run the client, then takeRecorder::trace. - Salt
- The secret key of the pseudonyms: 32 bytes. Never written into a trace. Account identifiers do not depend on it (they get aliases).
- Trace
- A recorded dialog: the exchanges in order, and the accounts they name.
- Trace
Account - An account of a trace, by alias only: what the UPD says about it, never an identifier, a name or the product name.
- Unknown
Segment - A segment the recorder has no field list for, as the person recording
may look at it before deciding whether a trace shows it
(
Recorder::unknown_segments).
Constants§
- SUMMARY_
LEGEND - The first line of
Trace::summary_table: how to read the lines below. - TRACE_
FORMAT - The
formatof a trace file written byTrace::to_json.
Functions§
- outcome_
label - Short, content-free summary of a failed send (an HTTP body is never included: it may echo request data); a single line. The kind of an error without its text: the variant, with the HTTP status, the transport kind, the bank’s code or the unreadable segment.
- unshape_
statement - The binary data of a recorded answer segment made valid again, if the
segment holds a shape-masked statement (HIKAZ: MT940, HICAZ: camt.052,
HIWPD/HIWDU: MT535/536): each
#becomes1in an amount andXin text, read with the same field rules as the mask, so the result has the bank’s layout.Nonefor other segments. - unshape_
text - A shape-masked text element made valid again:
####,##becomes1111,11, any other#becomesX.