Open x2affy opened 11 months ago
If it helps anyone.
When creating the new Totp
for both Generate and Validate.
Pass in the same params.
For example:
public bool ValidateTotp(string base32Secret, string totp, int step) { var secretBytes = Base32Encoding.ToBytes(base32Secret); var totpValidator = new Totp(secretBytes, step); return totpValidator.VerifyTotp(totp, out _); }
Can some please help with this as i am stuck really.
If i create the QRcode and set it up with an authnticator the validate all works fine. However if i generate the secret and store this, then use it to create a TOTP and try to validate this, it always fails? I want to use email validation as well as an authenticator app. So i am generating an email with the totp created using the stored secret, but it fails validation.
Can some please help or point me in the right direction with this?
public class TotpManager : ITotpManager { private readonly string _qrCodeImagePrefix = "data:image/png;base64,"; private readonly string _totpAuthPrefix = "otpauth://totp/";
}