OtpCryptoConfig class

Immutable, process-wide configuration for the OTP crypto protocol.

Constructors

OtpCryptoConfig.ephemeral({required Uint8List masterKey, Uint8List? salt, Uint8List? info, int protocolVersion = 1, int windowSeconds = 30, int verificationSkewWindows = 0, TimeProvider? timeProvider})
Creates a non-global, immutable config object (not assigned to singleton). Useful for unit tests that need multiple isolated configs at once.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
hkdfInfo Uint8List?
final
hkdfSalt Uint8List?
final
masterKey Uint8List
final
protocolVersion int
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
timeProvider TimeProvider
final
verificationSkewWindows int
final
windowSeconds int
final

Methods

acceptableWindows(int receivedWindow) List<int>
Returns the list of acceptable windows for verification. Example: w=100, skew=1 => 99, 100, 101
currentWindow() int
Returns the current time window using the configured TimeProvider.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
windowForEpochSeconds(int epochSeconds) int
Computes the time window for a given epoch seconds using: window = floor(epochSeconds / windowSeconds)

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance OtpCryptoConfig
Retrieve the globally configured instance. Throws if initialize has not been called.
no setter
isInitialized bool
True if the singleton was already initialized.
no setter

Static Methods

initialize({required Uint8List masterKey, Uint8List? salt, Uint8List? info, int protocolVersion = 1, int windowSeconds = 30, int verificationSkewWindows = 0, TimeProvider? timeProvider, bool forceReinitialize = false}) OtpCryptoConfig
Initializes the global configuration (one-time).