using OtpNet; namespace EnvelopeGenerator.Extensions { public static class StringExtension { public static bool IsValidTotp(this string totp, string secret) { var secret_bytes = Base32Encoding.ToBytes(secret); var secret_totp = new Totp(secret_bytes); return secret_totp.VerifyTotp(totp, out _, VerificationWindow.RfcSpecifiedNetworkDelay); } } }