import pyotp
# User's OTP (e.g., from the app)
user_otp = "123456" # OTP entered by the user
# Stored secret
secret = "JBSWY3DPEHPK3PXP" # This would be retrieved from the database
totp = pyotp.TOTP(secret)
# Verify the OTP
if totp.verify(user_otp):
print("OTP is valid!")
else:
print("Invalid OTP!")
lol, could be useful
lol, could be useful