Skip to content

Commit

Permalink
Merge pull request #4 from aripalo/is-password-protected
Browse files Browse the repository at this point in the history
feat: IsPasswordProtected method
  • Loading branch information
aripalo authored Apr 1, 2022
2 parents b0550fb + 3725832 commit 302a61e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions oath.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,18 @@ func (oa *OathAccounts) GetSerial() string {
return oa.serial
}

// IsPasswordProtected checks whether the OATH application is password protected
func (oa *OathAccounts) IsPasswordProtected() bool {
queryOptions := ykmanOptions{
serial: oa.serial,
password: "",
args: []string{"list"},
}

_, err := executeYkman(oa.ctx, queryOptions)
return err == ErrOathAccountPasswordProtected
}

// SetPassword directly configures the Yubikey OATH application password.
// Mutually exclusive with SetPasswordPrompt.
func (oa *OathAccounts) SetPassword(password string) error {
Expand Down

0 comments on commit 302a61e

Please sign in to comment.