Class UsbYubiKeyDevice
- java.lang.Object
-
- com.yubico.yubikit.android.transport.usb.UsbYubiKeyDevice
-
- All Implemented Interfaces:
com.yubico.yubikit.core.YubiKeyDevice
,java.io.Closeable
,java.lang.AutoCloseable
public class UsbYubiKeyDevice extends java.lang.Object implements com.yubico.yubikit.core.YubiKeyDevice, java.io.Closeable
-
-
Constructor Summary
Constructors Constructor Description UsbYubiKeyDevice(android.hardware.usb.UsbManager usbManager, android.hardware.usb.UsbDevice usbDevice)
Creates the instance of usb session to interact with the yubikey device.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
com.yubico.yubikit.core.UsbPid
getPid()
com.yubico.yubikit.core.Transport
getTransport()
android.hardware.usb.UsbDevice
getUsbDevice()
Returns yubikey device attached to the android device with the android device acting as the USB host.boolean
hasPermission()
<T extends com.yubico.yubikit.core.YubiKeyConnection>
voidrequestConnection(java.lang.Class<T> connectionType, com.yubico.yubikit.core.util.Callback<com.yubico.yubikit.core.util.Result<T,java.io.IOException>> callback)
void
setOnClosed(java.lang.Runnable onClosed)
boolean
supportsConnection(java.lang.Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)
-
-
-
Constructor Detail
-
UsbYubiKeyDevice
public UsbYubiKeyDevice(android.hardware.usb.UsbManager usbManager, android.hardware.usb.UsbDevice usbDevice) throws java.lang.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:
java.lang.IllegalArgumentException
- when the usbDevice is not a recognized YubiKey
-
-
Method Detail
-
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(java.lang.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(java.lang.Class<T> connectionType, com.yubico.yubikit.core.util.Callback<com.yubico.yubikit.core.util.Result<T,java.io.IOException>> callback)
- Specified by:
requestConnection
in interfacecom.yubico.yubikit.core.YubiKeyDevice
-
setOnClosed
public void setOnClosed(java.lang.Runnable onClosed)
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
-