otp_crypto/time_provider library
OTP Crypto – Time providers
Concrete implementations of the TimeProvider abstraction declared in
otp_crypto_config.dart. These help isolate time from the system clock
for testability and skew simulations.
SystemTimeProvider: uses the real system UTC time.AdjustableTimeProvider: mutable time source for tests; you can set or advance time deterministically.
HINTS:
- Prefer
SystemTimeProviderin production. - Use
AdjustableTimeProviderin unit/integration tests to freeze/advance time. - All times are expressed as UNIX epoch seconds (UTC).
Classes
- AdjustableTimeProvider
- Mutable time source for tests and deterministic flows.
- SystemTimeProvider
- Uses the real system clock (UTC) as the current time source.