mirror of
https://github.com/XFox111/SimpleOTP.git
synced 2026-04-22 08:00:45 +03:00
Major 2.0 (#20)
* New 2.0 version + DependencyInjection library * Updated docs and repo settings (devcontainers, vscode, github, etc.) * Added tests * Fixed bugs * Minor test project refactoring * Updated projects - Added symbol packages - Updated package versions to pre-release * Updated SECURITY.md * Added GitHub Actions workflows
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
namespace SimpleOTP.DependencyInjection;
|
||||
|
||||
/// <summary>
|
||||
/// Provides methods for generating and validating One-Time Passwords.
|
||||
/// </summary>
|
||||
public interface IOtpService
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates an OTP URI for specified user and secret.
|
||||
/// </summary>
|
||||
/// <param name="username">The username of the user.</param>
|
||||
/// <param name="secret">The secret to use.</param>
|
||||
/// <param name="counter">(only for HOTP) The counter to use.</param>
|
||||
/// <returns>The generated URI.</returns>
|
||||
public Uri CreateUri(string username, OtpSecret secret, long counter = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an OTP code for specified user and secret.
|
||||
/// </summary>
|
||||
/// <param name="secret">The secret to use.</param>
|
||||
/// <param name="counter">(only for HOTP) The counter to use.</param>
|
||||
public OtpCode GenerateCode(OtpSecret secret, long counter = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Validates an OTP code for specified user and secret.
|
||||
/// </summary>
|
||||
/// <param name="code">The code to validate.</param>
|
||||
/// <param name="secret">The secret to use.</param>
|
||||
/// <param name="resyncValue">The resync value. Shows how much the code is ahead or behind the current counter value.</param>
|
||||
/// <param name="counter">(only for HOTP) The counter to use.</param>
|
||||
/// <returns><c>true</c> if the code is valid; otherwise, <c>false</c>.</returns>
|
||||
public bool ValidateCode(OtpCode code, OtpSecret secret, out int resyncValue, long counter = 0);
|
||||
}
|
||||
Reference in New Issue
Block a user