From f4e6dcf51c53e53926f8139d242b70588bdb9557 Mon Sep 17 00:00:00 2001 From: "neha@quantoz" Date: Fri, 12 Apr 2024 09:26:50 +0200 Subject: [PATCH] Modified timestamp to 2 minutes --- .../Compliance/TOTPGenerator/TOTPGenerator.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/backend/core/src/Core.Infrastructure/Compliance/TOTPGenerator/TOTPGenerator.cs b/backend/core/src/Core.Infrastructure/Compliance/TOTPGenerator/TOTPGenerator.cs index bc6ace4..69d19f3 100644 --- a/backend/core/src/Core.Infrastructure/Compliance/TOTPGenerator/TOTPGenerator.cs +++ b/backend/core/src/Core.Infrastructure/Compliance/TOTPGenerator/TOTPGenerator.cs @@ -38,10 +38,12 @@ public bool VerifyOTP(string otpKey, string otpCode) var keyBytes = Base32Encoding.ToBytes(otpKey); // Create a TOTP generator with the key and time step - var totp = new Totp(keyBytes, step: 30); + var totp = new Totp(keyBytes, step: 120); // Verify the OTP code - return totp.VerifyTotp(otpCode, out _, VerificationWindow.RfcSpecifiedNetworkDelay); + bool isValid = totp.VerifyTotp(otpCode, out long timeStepMatched, VerificationWindow.RfcSpecifiedNetworkDelay); + + return isValid; } catch {