From 710bb61f217e7636c0b55090d89bb8b36c8b49b0 Mon Sep 17 00:00:00 2001 From: Neeraj Gupta <254676+ua741@users.noreply.github.com> Date: Thu, 12 Sep 2024 17:34:26 +0530 Subject: [PATCH] [auth] Fix bug in code generation --- auth/lib/utils/totp_util.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/auth/lib/utils/totp_util.dart b/auth/lib/utils/totp_util.dart index 669f986cb5..6b7f53ae5b 100644 --- a/auth/lib/utils/totp_util.dart +++ b/auth/lib/utils/totp_util.dart @@ -63,12 +63,12 @@ String getNextTotp(Code code) { final List codes = []; if (code.type == Type.steam || code.issuer.toLowerCase() == 'steam') { final SteamTOTP steamTotp = SteamTOTP(secret: code.secret); - for (int i = 1; i <= count; i++) { + for (int i = 0; i < count; i++) { int generatedTime = startTime + code.period * 1000 * i; codes.add(steamTotp.generate(generatedTime ~/ 1000)); } } else { - for (int i = 1; i <= count; i++) { + for (int i = 0; i < count; i++) { int generatedTime = startTime + code.period * 1000 * i; final genCode = otp.OTP.generateTOTPCodeString( secret,