Implement Decoupled TAN (Asynchronous Authentication) Support #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds PSD2-compliant decoupled TAN authentication where transaction approval happens on a separate device (e.g., mobile banking app). Implements FinTS 3.0 PINTAN specification with automatic polling, state management, and configurable timeouts.
Core Implementation
DecoupledTanManager (
src/decoupled-tan/decoupled-tan-manager.ts)Type System (
src/decoupled-tan/types.ts)DecoupledTanStateenum for lifecycle trackingDecoupledTanConfiginterface for polling configurationDecoupledTanStatusinterface for current stateError Handling (
src/errors/decoupled-tan-error.ts)DecoupledTanErrorwith status snapshot, transaction reference, remaining requestsisTimeout(),isCancelled(),hasRemainingRequests()Integration Points
Dialog (
src/dialog.ts)send()auto-detects decoupled TAN requirements via return codes 3956/3076handleDecoupledTan()initiates polling with optional status callbackscheckDecoupledTanStatus()for manual status checkscancelDecoupledTan()for user cancellationPinTanClient (
src/pin-tan-client.ts)DecoupledTanConfigin client configurationhandleDecoupledTanChallenge()wraps polling with callback supportTanRequiredError (
src/errors/tan-required-error.ts)isDecoupledTan()method to detect decoupled challengesdecoupledTanStateproperty for lifecycle trackingUsage
Testing
Original prompt
Implement Decoupled TAN (Asynchronous Authentication) Support
This comprehensive implementation adds support for Decoupled TAN (asynchronous authentication) to the fints-lib library, enabling modern PSD2-compliant authentication flows where transaction approval occurs on a separate, trusted device (e.g., mobile app).
Specification Reference
This implementation follows the FinTS 3.0 Security Specification (PINTAN) with these key requirements:
Core Components to Implement
1. DecoupledTanManager (
packages/fints/src/decoupled-tan/decoupled-tan-manager.ts)2. DecoupledTanState and Enums (
packages/fints/src/decoupled-tan/types.ts)3. DecoupledTanError (
packages/fints/src/errors/decoupled-tan-error.ts)4. Dialog Extension (
packages/fints/src/dialog.ts)5. PinTanClient Extension (
packages/fints/src/pin-tan-client.ts)6. TanRequiredError Extension (
packages/fints/src/errors/tan-required-error.ts)Implementation Features
Polling Behavior:
Error Handling:
State Tracking:
User Integration:
Testing Requirements
All implementations must include comprehensive tests:
Unit Tests (
packages/fints/src/decoupled-tan/__tests__/):Integration Tests (
packages/fints/src/__tests__/):Test Coverage Requirements:
Files to Create/Modify
New Files:
packages/fints/src/decoupled-tan/decoupled-tan-manager.tspackages/fints/src/decoupled-tan/types.tspackages/fints/src/decoupled-tan/index.tspackages/fints/src/errors/decoupled-tan-error.tspackages/fints/src/decoupled-tan/__tests__/test-decoupled-tan-manager.tspackages/fints/src/decoupled-tan/__tests__/test-decoupled-tan-integration.tsModified Files:
packages/fints/src/dialog.tsThis pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.