Class UsbYubiKeyDevice

java.lang.Object
com.yubico.yubikit.android.transport.usb.UsbYubiKeyDevice
All Implemented Interfaces:
com.yubico.yubikit.core.YubiKeyDevice, Closeable, AutoCloseable

public class UsbYubiKeyDevice extends Object implements com.yubico.yubikit.core.YubiKeyDevice, 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

    Modifier and Type
    Method
    Description
    void
     
    com.yubico.yubikit.core.UsbPid
     
    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>
    T
    openConnection(Class<T> connectionType)
     
    <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)
     
    void
     
    boolean
    supportsConnection(Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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 devices
      usbDevice - 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 interface com.yubico.yubikit.core.YubiKeyDevice
    • supportsConnection

      public boolean supportsConnection(Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)
      Specified by:
      supportsConnection in interface com.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 interface com.yubico.yubikit.core.YubiKeyDevice
    • openConnection

      public <T extends com.yubico.yubikit.core.YubiKeyConnection> T openConnection(Class<T> connectionType) throws IOException
      Specified by:
      openConnection in interface com.yubico.yubikit.core.YubiKeyDevice
      Throws:
      IOException
    • setOnClosed

      public void setOnClosed(Runnable onClosed)
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object