Table of Contents

Class OtpCode

Namespace
SEBT.Portal.Core.Models.Auth
Assembly
SEBT.Portal.Core.dll

Represents a one-time password (OTP) code used for authentication purposes.

public record OtpCode
Inheritance
object
OtpCode

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

Code string
Email string
MinutesToExpire int

Properties

Code

public string Code { get; init; }

Property Value

string

Email

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

code string

The OTP code to validate.

Returns

bool

Returns true if the provided code matches the stored code and is not expired; otherwise, false.