Show / Hide Table of Contents

OathSession Class

Namespace: Yubico.YubiKey.Oath Assembly: Yubico.YubiKey.dll

The main entry-point for all OATH related operations.

C#
public sealed class OathSession : ApplicationSession
Inheritance object ApplicationSession OathSession

Constructors

Name Description
OathSession(IYubiKeyDevice, ScpKeyParameters?)

Create an instance of OathSession class, the object that represents the OATH application on the YubiKey.

Properties

Name Description
IsPasswordProtected

Indicates whether the OATH application on the YubiKey is password-protected or not, whether password verification is required before operations can be executed.

KeyCollector

The Delegate this class will call when it needs a password to unlock the OATH application.

Methods

Name Description
AddCredential(string)

Adds a credential from the string that received from the QR reader or manually from the server.

AddCredential(string?, string, CredentialType, CredentialPeriod)

Adds a new credential or overwrites the existing one on the YubiKey with default parameters.

AddCredential(Credential)

Adds a new credential or overwrites the existing one on the YubiKey.

CalculateAllCredentials(ResponseFormat)

Gets OTP (One-Time Password) values for all configured credentials on the YubiKey.

CalculateCredential(string?, string, CredentialType, CredentialPeriod, ResponseFormat)

Gets an OTP code for the specific credential.

CalculateCredential(Credential, ResponseFormat)

Gets an OTP (One-Time Password) value for the specific credential on the YubiKey.

Dispose(bool)
GetCredentials()

Gets all configured credentials on the YubiKey.

RemoveCredential(string?, string, CredentialType, CredentialPeriod)

Removes an existing credential from the YubiKey.

RemoveCredential(Credential)

Removes an existing credential from the YubiKey.

RenameCredential(string?, string, string?, string, CredentialType, CredentialPeriod)

Renames an existing credential on the YubiKey by setting new issuer and account names.

RenameCredential(Credential, string?, string)

Renames an existing credential on the YubiKey by setting new issuer and account names.

ResetApplication()

Resets the YubiKey's OATH application back to a factory default state.

SetPassword()

Sets the password.

TrySetPassword(ReadOnlyMemory<byte>, ReadOnlyMemory<byte>)

Verify the currentPassword in order to set the OATH application in the YubiKey to be password-protected with the given newPassword.

TryUnsetPassword(ReadOnlyMemory<byte>)

Try to set the OATH application in the YubiKey to no longer be password-protected. This operation requires verifying the current password provided.

TryVerifyPassword()

Attempts to verify the password.

TryVerifyPassword(ReadOnlyMemory<byte>)

Try to verify using the given password.

UnsetPassword()

Unsets the password.

VerifyPassword()

Verify the password, throw an exception if the user cancels or the verification failed.

In this article
Back to top Generated by DocFX