Totp class
An implementation of the Time-based One-time Password (TOTP).
Constructors
-
Totp({required List<
int> secret, Algorithm algorithm = Algorithm.sha256, int digits = 8, int period = 30}) -
Create a new TOTP instance for a given
secret
. - Totp.fromBase32({required String secret, Algorithm algorithm = Algorithm.sha256, int digits = 8, int period = 30, Encoding encoding = Encoding.standardRFC4648})
-
Create a new TOTP instance for a given Base32 encoded
secret
.
Properties
- algorithm → Algorithm
-
Return the TOTP hashing algorithm.
no setter
- digits → int
-
Return the TOTP password length.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- period → int
-
period of TOTP password
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
secret
→ List<
int> -
Return the TOTP secret key.
no setter
Methods
-
generate(
DateTime dateTime) → String -
Generate a new Time-based One-time Password (TOTP) for the
given
dateTime
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
now(
) → String - Generage a new Time-based One-time Password (TOTP) for the current time.
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
String password, DateTime dateTime) → bool -
Validate a given
password
for the givendateTime
.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited