1
0
mirror of https://github.com/XFox111/SimpleOTP.git synced 2026-04-22 08:00:45 +03:00
1
simpleotp.dependencyinjection.iotpservice
Eugene Fox edited this page 2024-09-18 17:22:16 +03:00

IOtpService

Namespace: SimpleOTP.DependencyInjection

Provides methods for generating and validating One-Time Passwords.

public interface IOtpService

Attributes NullableContextAttribute

Methods

CreateUri(String, OtpSecret, Int64)

Creates an OTP URI for specified user and secret.

Uri CreateUri(string username, OtpSecret secret, long counter)

Parameters

username String
The username of the user.

secret OtpSecret
The secret to use.

counter Int64
(only for HOTP) The counter to use.

Returns

Uri
The generated URI.

GenerateCode(OtpSecret, Int64)

Creates an OTP code for specified user and secret.

OtpCode GenerateCode(OtpSecret secret, long counter)

Parameters

secret OtpSecret
The secret to use.

counter Int64
(only for HOTP) The counter to use.

Returns

OtpCode

ValidateCode(OtpCode, OtpSecret, Int32&, Int64)

Validates an OTP code for specified user and secret.

bool ValidateCode(OtpCode code, OtpSecret secret, Int32& resyncValue, long counter)

Parameters

code OtpCode
The code to validate.

secret OtpSecret
The secret to use.

resyncValue Int32&
The resync value. Shows how much the code is ahead or behind the current counter value.

counter Int64
(only for HOTP) The counter to use.

Returns

Boolean
true if the code is valid; otherwise, false.