DVTotp class

Time-based one-time passwords, RFC 6238 over HOTP (RFC 4226).

The defaults — SHA-1, six digits, thirty seconds — are what every authenticator app implements; the others exist because the RFC defines them, not because an app will agree to them.

Constructors

DVTotp({int digits = 6, Duration period = const Duration(seconds: 30), DVTotpAlgorithm algorithm = DVTotpAlgorithm.sha1})
const

Properties

algorithm → DVTotpAlgorithm
final
digits → int
final
hashCode → int
The hash code for this object.
no setterinherited
period → Duration
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

generate(List<int> secret, {required DateTime at}) → String
The code for secret at at.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
provisioningUri({required String secret, required String issuer, required String account}) → Uri
The otpauth:// URI an authenticator app reads from a QR code.
stepAt(DateTime at) → int
The time step at falls in.
toString() → String
A string representation of this object.
inherited
verify(String code, List<int> secret, {required DateTime at, int window = 1, int? lastUsedStep}) → int?
The step code was generated for, or null when it matches none within window steps of at — or matches only steps at or before lastUsedStep, which have already been spent.

Operators

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

Static Methods

base32Decode(String input) → Uint8List
Decodes base32, forgiving the spaces, hyphens, lower case and padding people type when they enter a key by hand.
base32Encode(List<int> bytes) → String
RFC 4648 base32 without padding: what authenticator apps are given.