HOTP constructor

HOTP(
  1. List<int> secret, {
  2. int digits = 6,
  3. required List<int> counter,
  4. BlockHashBase<BlockHashSink> algo = sha1,
  5. String? label,
  6. String? issuer,
})

Creates an instance of the HOTP class with the specified parameters.

Parameters:

  • secret is the shared secret as a list of bytes for generating the OTP.
  • digits is the number of digits in the generated OTP (default is 6).
  • counter is the counter value used in the HOTP algorithm (required).
  • algo is the block hash algorithm to use (default is sha1).
  • label is an optional string to identify the account or service the OTP is associated with.
  • issuer is an optional string to specify the entity issuing the OTP.

Implementation

HOTP(
  this.secret, {
  int digits = 6,
  required this.counter,
  BlockHashBase algo = sha1,
  String? label,
  String? issuer,
})  : assert(digits <= 15),
      algo = HMAC(algo).by(secret),
      _max = _pow10[digits],
      super(
        digits,
        label: label,
        issuer: issuer,
      );