Class UsbYubiKeyDevice
java.lang.Object
com.yubico.yubikit.android.transport.usb.UsbYubiKeyDevice
- All Implemented Interfaces:
com.yubico.yubikit.core.YubiKeyDevice
,Closeable
,AutoCloseable
-
Constructor Summary
ConstructorDescriptionUsbYubiKeyDevice
(android.hardware.usb.UsbManager usbManager, android.hardware.usb.UsbDevice usbDevice) Creates the instance of usb session to interact with the yubikey device. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
com.yubico.yubikit.core.UsbPid
getPid()
com.yubico.yubikit.core.Transport
android.hardware.usb.UsbDevice
Returns yubikey device attached to the android device with the android device acting as the USB host.boolean
<T extends com.yubico.yubikit.core.YubiKeyConnection>
TopenConnection
(Class<T> connectionType) <T extends com.yubico.yubikit.core.YubiKeyConnection>
voidrequestConnection
(Class<T> connectionType, com.yubico.yubikit.core.util.Callback<com.yubico.yubikit.core.util.Result<T, IOException>> callback) void
setOnClosed
(Runnable onClosed) boolean
supportsConnection
(Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType) toString()
-
Constructor Details
-
UsbYubiKeyDevice
public UsbYubiKeyDevice(android.hardware.usb.UsbManager usbManager, android.hardware.usb.UsbDevice usbDevice) throws IllegalArgumentException Creates the instance of usb session to interact with the yubikey device.- Parameters:
usbManager
- UsbManager for accessing USB devicesusbDevice
- device connected over usb that has permissions to interact with- Throws:
IllegalArgumentException
- when the usbDevice is not a recognized YubiKey
-
-
Method Details
-
hasPermission
public boolean hasPermission() -
getUsbDevice
public android.hardware.usb.UsbDevice getUsbDevice()Returns yubikey device attached to the android device with the android device acting as the USB host. It describes the capabilities of the USB device and allows to get properties/name/product id/manufacturer of device- Returns:
- yubikey device connected over USB
-
getPid
public com.yubico.yubikit.core.UsbPid getPid()- Returns:
UsbPid
for the device's product id
-
getTransport
public com.yubico.yubikit.core.Transport getTransport()- Specified by:
getTransport
in interfacecom.yubico.yubikit.core.YubiKeyDevice
-
supportsConnection
public boolean supportsConnection(Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType) - Specified by:
supportsConnection
in interfacecom.yubico.yubikit.core.YubiKeyDevice
-
requestConnection
public <T extends com.yubico.yubikit.core.YubiKeyConnection> void requestConnection(Class<T> connectionType, com.yubico.yubikit.core.util.Callback<com.yubico.yubikit.core.util.Result<T, IOException>> callback) - Specified by:
requestConnection
in interfacecom.yubico.yubikit.core.YubiKeyDevice
-
openConnection
public <T extends com.yubico.yubikit.core.YubiKeyConnection> T openConnection(Class<T> connectionType) throws IOException - Specified by:
openConnection
in interfacecom.yubico.yubikit.core.YubiKeyDevice
- Throws:
IOException
-
setOnClosed
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
toString
-