Show / Hide Table of Contents

Code Constructor

Code()

Constructs an instance of Code class.

C#
public Code()

Code(string?, CredentialPeriod)

Constructs an instance of the Code class.

C#
public Code(string? value, CredentialPeriod period)

Parameters

Type Name Description
string value

The generated OTP code.

CredentialPeriod period

The credential period to calculate the OTP code validity.

Exceptions

Type Condition
ArgumentException

The provided period is invalid.

Remarks

The credential period is used to set a validity for OTP code. The validity for HOTP code is set to DateTimeOffset.MaxValue because HOTP code is not time-based. The validity for TOTP code is set to DateTimeOffset.Now + credential period (15, 30, or 60 seconds). Also, it is "rounded" to the nearest 15, 30, or 60 seconds. For example, it will start at 1:14:30 and not 1:14:34 if the timestep is 30 seconds.

In this article
Back to top Generated by DocFX