From 3725832c4acb4b295a8e325798314edcba2360c2 Mon Sep 17 00:00:00 2001 From: Ari Palo Date: Fri, 1 Apr 2022 06:53:56 +0300 Subject: [PATCH] feat: IsPasswordProtected method --- oath.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/oath.go b/oath.go index 6df1bd7..4ae57b6 100644 --- a/oath.go +++ b/oath.go @@ -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 {