Documentation ¶
Index ¶
- Variables
- type OathAccounts
- func (oa *OathAccounts) Code(account string) (string, error)
- func (oa *OathAccounts) GetPassword() (string, error)
- func (oa *OathAccounts) GetSerial() string
- func (oa *OathAccounts) HasAccount(account string) (bool, error)
- func (oa *OathAccounts) IsAvailable() bool
- func (oa *OathAccounts) IsPasswordProtected() bool
- func (oa *OathAccounts) List() ([]string, error)
- func (oa *OathAccounts) SetPassword(password string) error
- func (oa *OathAccounts) SetPasswordPrompt(prompt func(ctx context.Context) (string, error)) error
- type Ykman
Constants ¶
This section is empty.
Variables ¶
var ErrCommandInterrupted = errors.New("ykman command interrupted")
ErrCommandInterrupted indicates ykman process was killed by an external signal (such as SIGINT or SIGTERM).
var ErrCommandNotFound = errors.New("ykman command not found")
ErrCommandNotFound indicates ykman executable not found from $PATH. To resolve the error, user should install the ykman CLI tool and try again.
var ErrDeviceNotFound = errors.New("yubikey device not found")
ErrDeviceNotFound indicates Yubikey device is not connected to host machine.
var ErrDeviceRemoved = errors.New("yubikey device removed")
ErrDeviceRemoved means the Yubikey device was physically removed during the operation from the host machine.
var ErrDeviceSerial = errors.New("invalid device serial")
ErrDeviceSerial indicates incorrect Yubikey Device Serial Number. The serial number must be at least 8 digits long string.
var ErrDeviceTimeout = errors.New("yubikey device timeout")
ErrDeviceTimeout indicates Yubikey device timed out, usually because it was not touched during ykman's timeout period.
var ErrNoPassword = errors.New("password not set")
ErrNoPassword is returned when trying to retrieve a the password but it has not been resolved by password prompt (yet).
var ErrOathAccountCodeParseFailed = errors.New("oath account code could not be parsed")
ErrOathAccountCodeParseFailed indicates that valid OATH account code was not received.
var ErrOathAccountNotFound = errors.New("oath account not found")
ErrOathAccountNotFound indicates that the given OATH account name does not exists.
var ErrOathAccountPasswordIncorrect = errors.New("oath application password is incorrect")
ErrOathAccountPasswordIncorrect indicates a wrong password for OATH application.
var ErrOathAccountPasswordProtected = errors.New("oath application is password protected")
ErrOathAccountPasswordProtected indicates that the OATH application requires a password.
var ErrPasswordNotAllowedWithPrompt = errors.New("password string not allowed when using prompt")
ErrPasswordNotAllowedWithPrompt indicates that password should not be passed when using prompt.
var ErrPasswordSetup = errors.New("cannot set password")
ErrPasswordSetup means password string could not be configured and is usually returned when trying to set both password and password prompt which are mutually exclusive.
var ErrPromptSetup = errors.New("cannot set password prompt")
ErrPromptSetup means password prompt could not be configured and is usually returned when trying to set both password and password prompt which are mutually exclusive.
Functions ¶
This section is empty.
Types ¶
type OathAccounts ¶
type OathAccounts struct {
// contains filtered or unexported fields
}
OathAccounts represents a the main functionality of Yubikey OATH accounts.
func New ¶
func New(ctx context.Context, serial string) (OathAccounts, error)
New defines a new instance of OathAccounts.
func (*OathAccounts) Code ¶
func (oa *OathAccounts) Code(account string) (string, error)
Code requests a Time-based one-time password (TOTP) 6-digit code for given account (such as "<issuer>:<name>") from Yubikey OATH application.
func (*OathAccounts) GetPassword ¶
func (oa *OathAccounts) GetPassword() (string, error)
GetPassword returns the password that successfully unlocked the Yubikey OATH application.
func (*OathAccounts) GetSerial ¶
func (oa *OathAccounts) GetSerial() string
GetSerial returns the currently configured Yubikey device serial.
func (*OathAccounts) HasAccount ¶ added in v0.3.3
func (oa *OathAccounts) HasAccount(account string) (bool, error)
HasAccount returns a boolean indicating if the device has the given account configured in its OATH application.
func (*OathAccounts) IsAvailable ¶ added in v0.3.0
func (oa *OathAccounts) IsAvailable() bool
IsAvailable checks whether the Yubikey device is connected & available
func (*OathAccounts) IsPasswordProtected ¶ added in v0.2.0
func (oa *OathAccounts) IsPasswordProtected() bool
IsPasswordProtected checks whether the OATH application is password protected
func (*OathAccounts) List ¶
func (oa *OathAccounts) List() ([]string, error)
List returns a list of configured accounts in the Yubikey OATH application.
func (*OathAccounts) SetPassword ¶
func (oa *OathAccounts) SetPassword(password string) error
SetPassword directly configures the Yubikey OATH application password. Mutually exclusive with SetPasswordPrompt.
func (*OathAccounts) SetPasswordPrompt ¶
SetPasswordPrompt configures a function that will be called upon if/when the Yubikey OATH application password is required. Mutually exclusive with SetPassword.