Class OtpCode
Represents a one-time password (OTP) code used for authentication purposes.
public record OtpCode
- Inheritance
-
objectOtpCode
Constructors
OtpCode(string, string, int)
Represents a one-time password (OTP) code used for authentication purposes.
public OtpCode(string Code, string Email, int MinutesToExpire = 10)
Parameters
CodestringEmailstringMinutesToExpireint
Properties
Code
public string Code { get; init; }
Property Value
- string
public string Email { get; init; }
Property Value
- string
ExpiresAt
public DateTime ExpiresAt { get; init; }
Property Value
- DateTime
MinutesToExpire
public int MinutesToExpire { get; init; }
Property Value
- int
Methods
IsCodeValid(string)
Validates the provided OTP code against the stored code.
public bool IsCodeValid(string code)
Parameters
codestringThe OTP code to validate.
Returns
- bool
Returns
trueif the provided code matches the stored code and is not expired; otherwise,false.