Interface VerificationHelper.Listener

  • Enclosing class:
    VerificationHelper

    public static interface VerificationHelper.Listener
    Interface for listening to messages from the remote mdoc device.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void onDeviceConnected()
      Called when connected to a remote mdoc device.
      void onDeviceDisconnected​(boolean transportSpecificTermination)
      Called when the remote mdoc device disconnects normally, that is using the session termination functionality in the underlying protocols.
      void onDeviceEngagementReceived​(java.util.List<ConnectionMethod> connectionMethods)
      Called when a valid device engagement is received from QR code of NFC.
      void onError​(java.lang.Throwable error)
      Called when an unrecoverable error happens, for example if the remote device disconnects unexpectedly (e.g.
      void onMoveIntoNfcField()
      Called when NFC data transfer has been selected but the mdoc reader device isn't yet in the NFC field of the mdoc device.
      void onReaderEngagementReady​(byte[] readerEngagement)
      Called when using reverse engagement and the reader engagement is ready.
      void onResponseReceived​(byte[] deviceResponseBytes)
      Called when the remote mdoc device sends a response.
    • Method Detail

      • onReaderEngagementReady

        void onReaderEngagementReady​(@NonNull
                                     byte[] readerEngagement)
        Called when using reverse engagement and the reader engagement is ready. The app can display this as QR code (for 23220-4) or send it to a remote user agent as an mdoc:// URI (for 18013-7).
        Parameters:
        readerEngagement - the bytes of reader engagement.
      • onDeviceEngagementReceived

        void onDeviceEngagementReceived​(@NonNull
                                        java.util.List<ConnectionMethod> connectionMethods)
        Called when a valid device engagement is received from QR code of NFC.

        This is called either in response to VerificationHelper.setDeviceEngagementFromQrCode(String) or as a result of a NFC tap. The application should call VerificationHelper.connect(ConnectionMethod) in response to this callback to establish a connection.

        If reverse engagement is used, this is never called.

        Parameters:
        connectionMethods - a list of connection methods that can be used to establish a connection to the mdoc.
      • onMoveIntoNfcField

        void onMoveIntoNfcField()
        Called when NFC data transfer has been selected but the mdoc reader device isn't yet in the NFC field of the mdoc device.

        The application should instruct the user to move the mdoc reader device into the NFC field.

      • onDeviceConnected

        void onDeviceConnected()
        Called when connected to a remote mdoc device.

        At this point the application can start sending requests using VerificationHelper.sendRequest(byte[]).

      • onDeviceDisconnected

        void onDeviceDisconnected​(boolean transportSpecificTermination)
        Called when the remote mdoc device disconnects normally, that is using the session termination functionality in the underlying protocols.

        If this is called the application should call VerificationHelper.disconnect() and the object should no longer be used.

        Parameters:
        transportSpecificTermination - set to true if the termination mechanism used was transport specific.
      • onResponseReceived

        void onResponseReceived​(@NonNull
                                byte[] deviceResponseBytes)
        Called when the remote mdoc device sends a response. The deviceResponseBytes parameter contains the bytes of the DeviceResponse CBOR as specified in ISO/IEC 18013-5 section 8.3 Device Retrieval. The class DeviceResponseParser can be used to parse these bytes.
        Parameters:
        deviceResponseBytes - the device response.
      • onError

        void onError​(@NonNull
                     java.lang.Throwable error)
        Called when an unrecoverable error happens, for example if the remote device disconnects unexpectedly (e.g. without first sending a session termination request).

        If this is called the application should call VerificationHelper.disconnect() and the object should no longer be used.

        Parameters:
        error - the error.