Class NfcYubiKeyDevice

java.lang.Object
com.yubico.yubikit.android.transport.nfc.NfcYubiKeyDevice
All Implemented Interfaces:
com.yubico.yubikit.core.YubiKeyDevice

public class NfcYubiKeyDevice extends Object implements com.yubico.yubikit.core.YubiKeyDevice
  • Constructor Details

    • NfcYubiKeyDevice

      public NfcYubiKeyDevice(android.nfc.Tag tag, int timeout, ExecutorService executorService)
      Instantiates session for nfc tag interaction
      Parameters:
      tag - the tag that has been discovered
      timeout - timeout, in milliseconds, to use for NFC communication
  • Method Details

    • getTag

      public android.nfc.Tag getTag()
      Returns:
      NFC tag that has been discovered
    • readNdef

      public byte[] readNdef() throws IOException
      Throws:
      IOException
    • remove

      public void remove(Runnable onRemoved)
      Closes the device and waits for physical removal.

      This method signals that we are done with the device and can be used to wait for the user to physically remove the YubiKey from NFC scan range, to avoid triggering NFC YubiKey detection multiple times in quick succession.

    • 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
    • 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
    • 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
    • isYubiKey

      public boolean isYubiKey()
      Probe the nfc device whether it is a Yubico hardware.
      Returns:
      true if this device is a YubiKey or a Security Key by Yubico.
    • toString

      public String toString()
      Overrides:
      toString in class Object