updateCode static method
Implementation
static TotpResponse updateCode(int length, int interval, String key) {
final now = DateTime.now();
String totpCode = OTP.generateTOTPCodeString(
key, now.millisecondsSinceEpoch,
algorithm: Algorithm.SHA1,
length: length,
interval: interval,
isGoogle: true);
final remainingTime = 30 - ((now.millisecondsSinceEpoch ~/ 1000) % 30);
TotpResponse response = TotpResponse()
..totpCode = totpCode
..duration = remainingTime;
return response;
}