aries / net.globalid.aries.message.outbound

Package net.globalid.aries.message.outbound

Types

OutboundMessage

A pair of an agent message, that the agent wants to send, and the corresponding connection record. Based on the connection record data, the agent message should be appropriately encrypted and forwarded/routed.

data class OutboundMessage

OutboundMessageContext

Represents an outbound agent message with additional context. An outbound message must be associated with some "connection context" to know which keys to use for encryption and where to send the packed message.

sealed class OutboundMessageContext

OutboundPackage

A package with all the info that is needed to send a message.

data class OutboundPackage

Functions

toOutboundContext

Returns an OutboundMessageContext constructed from an AgentMessage and a given ConnectionRecord. This only puts the connection ID in the context.

fun AgentMessage.toOutboundContext(connection: ConnectionRecord): Single<OutboundMessageContext>

Returns an OutboundMessageContext constructed from an AgentMessage and a given ConnectionContext. The connection context from the record is checked and the corresponding outbound context is constructed.

fun AgentMessage.toOutboundContext(connectionContext: ConnectionContext): Single<OutboundMessageContext>

toOutboundMessage

Returns an OutboundMessage constructed from an AgentMessage and a given ConnectionRecord. The outbound message might not be constructable, based on the state of the record. In that case, an error is returned.

fun AgentMessage.toOutboundMessage(record: ConnectionRecord): Single<OutboundMessage>

Returns an OutboundMessage constructed from an AgentMessage and a given ServiceDecorator. In this case, the message can always be constructed as the decorator contains all the needed data. We generate a new key pair for this message so that the receiver can send a response (it needs to be encrypted with our public/verification key).

fun AgentMessage.toOutboundMessage(agent: Agent, serviceDecorator: ServiceDecorator): Single<OutboundMessage>

Returns an OutboundMessage constructed from an OutboundMessageContext. Based on the connection context, above functions are called.

fun OutboundMessageContext.toOutboundMessage(agent: Agent, connectionService: ConnectionService): Single<OutboundMessage>