generateHOTPCodeString method
- String secret,
- int counter,
- {int length: 6,
- Algorithm algorithm: Algorithm.SHA1}
Generates a one time password code based on a counter you provide and increment, returns as a 0 padded string.
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.
Implementation
static String generateHOTPCodeString(String secret, int counter,
{int length = 6, Algorithm algorithm = Algorithm.SHA1}) {
var code =
'${generateHOTPCode(secret, counter, length: length, algorithm: algorithm)}';
return code.padLeft(length, '0');
}