Class NfcYubiKeyDevice

  • All Implemented Interfaces:
    com.yubico.yubikit.core.YubiKeyDevice

    public class NfcYubiKeyDevice
    extends java.lang.Object
    implements com.yubico.yubikit.core.YubiKeyDevice
    • Constructor Summary

      Constructors 
      Constructor Description
      NfcYubiKeyDevice​(android.nfc.Tag tag, int timeout, java.util.concurrent.ExecutorService executorService)
      Instantiates session for nfc tag interaction
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      android.nfc.Tag getTag()  
      com.yubico.yubikit.core.Transport getTransport()  
      boolean isYubiKey()
      Probe the nfc device whether it is a Yubico hardware.
      byte[] readNdef()  
      void remove​(java.lang.Runnable onRemoved)
      Closes the device and waits for physical removal.
      <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)  
      boolean supportsConnection​(java.lang.Class<? extends com.yubico.yubikit.core.YubiKeyConnection> connectionType)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NfcYubiKeyDevice

        public NfcYubiKeyDevice​(android.nfc.Tag tag,
                                int timeout,
                                java.util.concurrent.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 Detail

      • getTag

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

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

        public void remove​(java.lang.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​(java.lang.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​(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 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.