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 voidclose()com.yubico.yubikit.core.UsbPidgetPid()com.yubico.yubikit.core.TransportgetTransport()android.hardware.usb.UsbDevicegetUsbDevice()Returns yubikey device attached to the android device with the android device acting as the USB host.booleanhasPermission()<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)voidsetOnClosed(java.lang.Runnable onClosed)booleansupportsConnection(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.IllegalArgumentExceptionCreates 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:
UsbPidfor the device's product id
-
getTransport
public com.yubico.yubikit.core.Transport getTransport()
- Specified by:
getTransportin interfacecom.yubico.yubikit.core.YubiKeyDevice
-
supportsConnection
public boolean supportsConnection(java.lang.Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)
- Specified by:
supportsConnectionin 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:
requestConnectionin interfacecom.yubico.yubikit.core.YubiKeyDevice
-
setOnClosed
public void setOnClosed(java.lang.Runnable onClosed)
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
-