Appearance
TOTP Class
Definition
Implementation of a Timebased One Time Password capability
- Namespace:
JASE.Crypto - Assembly:
JASE.Crypto.dll
Constructors
| Name | Description |
|---|---|
TOTP(byte[] secretKeyBytes, int size = null, int windowLength = null) | Initialize TOTP based on the secret key |
Fields
| Name | Description |
|---|---|
MaxSecretBytes | Maximum byte length of a secret key |
MinSecretBytes | Minimum byte length of a secret key |
Methods
| Name | Description |
|---|---|
string Compute() | Compute the One Time Password and return it as a string, initializes with DateTime.UtcNow |
string Compute(DateTime timestamp) | Compute the One Time Password and return it as a string |
TOTP FromBase32(string base32Secret, int size = null, int window = null, bool lenient = null) | Returns an instance of TOTP generated from the provided values |
string GenerateKey(int base32CharLength = null) | Method for generating a random key for use in One Time Passwords |
string GetCurrentCode(DateTime timestamp) | Compute the One Time Password and return it as a string |
int GetCurrentOtp(DateTime timestamp) | Compute the One Time Password and return it as an integer |
int RemainingSeconds() | Returns the seconds the Timebased One Time password is still valid |
bool ValidateCode(string code, DateTime? timestamp = null, int allowedSkew = null) | Validates a TOTP code against the current time and optional skew. |