waitForConnection

suspend fun List<MdocTransport>.waitForConnection(eSenderKey: EcPublicKey, coroutineScope: CoroutineScope = CoroutineScope(Dispatchers.IO)): MdocTransport

A helper for waiting until someone connects to a transport.

The list of transports must contain transports that all all in the state MdocTransport.State.ADVERTISING.

The first connection which a remote peer connects to is returned and the other ones are closed.

Return

the MdocTransport a remote peer connected to, will be in MdocTransport.State.CONNECTING or MdocTransport.State.CONNECTED state.

Parameters

eSenderKey

This should be set to EDeviceKey if using forward engagement or EReaderKey if using reverse engagement.

coroutineScope

the CoroutineScope used for waiting for the connections to be made.