testing library
Test helpers for flutter_mfa_core: a controllable clock, a seeded (insecure) random generator and the frozen RFC 4226 / RFC 6238 vectors.
Never import this library from production code.
Classes
- FakeClock
- A Clock whose time only changes when a test says so. Tests only.
- HotpVector
- One RFC 4226 Appendix D known-answer vector.
- SeededRandom
-
Deterministic, insecure pseudo-random generator for reproducible
tests. Exported only from
testing.dart; never use it for secrets or ids in production (library code usesRandom.secure()). - TotpVector
- One RFC 6238 Appendix B known-answer vector (8 digits, 30 s, T0 = 0).
Constants
-
rfc4226Vectors
→ const List<
HotpVector> -
RFC 4226 Appendix D: HOTP, SHA-1, 6 digits. Verified against the RFC
text and independently with Python
hmac(M1-04). -
rfc6238Vectors
→ const List<
TotpVector> - RFC 6238 Appendix B: TOTP, 8 digits, period 30 s, T0 = 0, all 18 vectors. Verified against the RFC text and independently (M1-04).
Properties
- rfc4226Secret → Uint8List
-
RFC 4226 Appendix D secret: ASCII
12345678901234567890. Test data only.no setter
Functions
-
rfc6238Seed(
OtpAlgorithm algorithm) → Uint8List -
RFC 6238 Appendix B seed for
algorithm. The seed length differs per algorithm (20/32/64 bytes); reusing the 20-byte seed is the most common implementation bug. Test data only.