DataTransport

abstract class DataTransport(context: Context, val role: DataTransport.Role, options: DataTransportOptions)

Abstraction for data transfer between prover and verifier devices.

The data transfer is packetized, that is, data is delivered at the same granularity as it is sent. For example, if .sendMessage is used to send N bytes then this blob is what the remote peer will receive in the Listener.onMessageReceived callback.

Instances constructed from subclasses deriving from this class must be inert when constructed, that is, they must not do anything. This constraint exists to easily facilitate factory-patterns.

If an unrecoverable error is detected, this is conveyed using the Listener.onError callback.

This class can be used to implement both provers and verifiers.

Inheritors

Constructors

Link copied to clipboard
constructor(context: Context, role: DataTransport.Role, options: DataTransportOptions)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
interface Listener

Interface for listener.

Link copied to clipboard

Enumeration for the two different sides of a transport.

Properties

Link copied to clipboard

A MdocConnectionMethod instance that can be used to connect to this transport.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
abstract fun close()

Closes the connection with the remote mdoc or mdoc reader.

Link copied to clipboard
abstract fun connect()

Starts connecting to the remote mdoc or mdoc reader.

Link copied to clipboard

Returns the next message received, if any.

Link copied to clipboard
abstract fun sendMessage(data: ByteArray)

Sends data to the remote mdoc or mdoc reader.

Link copied to clipboard

Sends a transport-specific termination message.

Link copied to clipboard
abstract fun setEDeviceKeyBytes(encodedEDeviceKeyBytes: ByteArray)

Sets the bytes of EDeviceKeyBytes.

Link copied to clipboard
fun setListener(listener: DataTransport.Listener?, executor: Executor?)

Set the listener to be used for notification.

Whether the transport supports a transport-specific termination message.