Class DesktopDeviceSelector
A selector can target a device either by its serial number (preferred when
available) or by its fingerprint (a fallback identifier derived from the
underlying USB device path or PCSC terminal name). Selectors derived from device records (via
YubiKitManager.listDeviceRecords()) may contain both identifiers, allowing
lookup by either.
Serial number selection is preferred because serial numbers are stable across
unplug/replug cycles and across processes. Use forSerial(int) when the device serial is
known.
Fingerprint selection is a fallback for devices that do not expose a serial
number (e.g. certain Security Key models). Note that fingerprints are not guaranteed to
be stable across unplug/replug cycles or across process restarts — they are derived from
OS-assigned device paths. Use forFingerprint(String) when serial is unavailable.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic DesktopDeviceSelectorforFingerprint(String fingerprint) Creates a selector that targets a device by its fingerprint.static DesktopDeviceSelectorforSerial(int serial) Creates a selector that targets a device by its serial number.@Nullable StringReturns the fingerprint used for selection, ornullif unavailable.@Nullable IntegerReturns the serial number used for selection, ornullif this selector uses only a fingerprint.inthashCode()toString()
-
Method Details
-
forSerial
Creates a selector that targets a device by its serial number.- Parameters:
serial- the device serial number- Returns:
- a serial-based selector
-
forFingerprint
Creates a selector that targets a device by its fingerprint.The fingerprint is typically the HID device path or PCSC terminal name. It is not guaranteed to be stable across unplug/replug cycles or process restarts.
- Parameters:
fingerprint- the device fingerprint- Returns:
- a fingerprint-based selector
-
getSerial
Returns the serial number used for selection, ornullif this selector uses only a fingerprint. -
getFingerprint
Returns the fingerprint used for selection, ornullif unavailable.When the selector was created via
forSerial(int), the fingerprint isnull. When derived from a device record, the fingerprint is always populated. -
equals
-
hashCode
public int hashCode() -
toString
-