-
Notifications
You must be signed in to change notification settings - Fork 0
simpleotp.otpcode
Namespace: SimpleOTP
Represents a one-time password (OTP) code.
public struct OtpCodeInheritance Object → ValueType → OtpCode
Implements IEquatable<OtpCode>, IEquatable<String>, IXmlSerializable
Attributes SerializableAttribute, NullableContextAttribute, NullableAttribute, IsReadOnlyAttribute, JsonConverterAttribute
Gets a value indicating whether the OTP code can expire (true for TOTP, false for HOTP).
public bool CanExpire { get; }Gets the expiration time of the OTP code (TOTP only).
public Nullable<DateTimeOffset> ExpirationTime { get; }Initializes a new instance of the OtpCode struct with the specified value with no expiration time.
OtpCode(int code, int digits)code Int32
The value of the OTP code.
digits Int32
The number of digits in the OTP code.
ArgumentNullException
code is .
ArgumentException
code is not a valid numeric code.
Initializes a new instance of the OtpCode struct with the specified value and the expiration time.
OtpCode(int code, int digits, Nullable<DateTimeOffset> expirationTime)code Int32
The value of the OTP code.
digits Int32
The number of digits in the OTP code.
expirationTime Nullable<DateTimeOffset>
The expiration time of the OTP code (TOTP only).
ArgumentNullException
code is .
ArgumentException
code is not a valid numeric code.
Initializes a new instance of the OtpCode struct with the specified value with no expiration time.
OtpCode(string code)code String
The value of the OTP code.
ArgumentNullException
code is .
ArgumentException
code is not a valid numeric code.
Initializes a new instance of the OtpCode struct with the specified value and the expiration time.
OtpCode(string code, Nullable<DateTimeOffset> expirationTime)code String
The value of the OTP code.
expirationTime Nullable<DateTimeOffset>
The expiration time of the OTP code (TOTP only).
ArgumentNullException
code is .
ArgumentException
code is not a valid numeric code.
Returns a string representation of the OTP code.
string ToString()String
A string representation of the OTP code.
Returns a string representation of the OTP code.
string ToString(string format)format String
The format to use.
String
The string representation of the OTP code.
bool Equals(OtpCode other)other OtpCode
bool Equals(object obj)obj Object
bool Equals(string other)other String
int GetHashCode()XmlSchema GetSchema()XmlSchema
void ReadXml(XmlReader reader)reader XmlReader
void WriteXml(XmlWriter writer)writer XmlWriter
Parses the specified String into an OtpCode object.
OtpCode Parse(string code)code String
The string to parse.
ArgumentNullException
code is .
ArgumentException
code is not a valid numeric code.
Tries to parse the specified String into an OtpCode object.
bool TryParse(string code, OtpCode& result)code String
The string to parse.
result OtpCode&
The parsed OtpCode object.
Boolean
if code was parsed successfully; otherwise, .
©2025 Eugene Fox. Licensed under MIT license