From 0191f9c36654512e835d3ddc4c2c311b24acd5fc Mon Sep 17 00:00:00 2001 From: joerger Date: Wed, 7 May 2025 16:52:16 -0700 Subject: [PATCH] Expose CheckPIN method. --- v2/piv/piv.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/v2/piv/piv.go b/v2/piv/piv.go index a4d884e..7c166f2 100644 --- a/v2/piv/piv.go +++ b/v2/piv/piv.go @@ -260,6 +260,14 @@ func ykLogin(tx *scTx, pin string) error { return nil } +// CheckPIN checks if PIN verification is required for this transaction or not. +// +// Generally, it is not necessary to call this method directly as PIN will only be +// prompted as needed by default. +func (yk *YubiKey) CheckPIN() bool { + return ykLoginNeeded(yk.tx) +} + func ykLoginNeeded(tx *scTx) bool { cmd := apdu{instruction: insVerify, param2: 0x80} _, err := tx.Transmit(cmd)