generateHOTPCode static method Null safety

int generateHOTPCode(
  1. String secret,
  2. int counter,
  3. {int length = 6,
  4. Algorithm algorithm = Algorithm.SHA1,
  5. bool isGoogle = false}
)

Generates a one time password code based on a counter you provide and increment.

This function does not increment for you. Optional parameters to change the length of the code provided (default 6) and hashing algorithm (default SHA1) These settings are defaulted to the RFC standard but can be changed. Throws a FormatException if string is not a base32 secret.

Implementation

static int generateHOTPCode(String secret, int counter,
    {int length = 6,
    Algorithm algorithm = Algorithm.SHA1,
    bool isGoogle = false}) {
  return _generateCode(secret, counter, length, getAlgorithm(algorithm),
      _getAlgorithmByteLength(algorithm),
      isHOTP: true, isGoogle: isGoogle);
}