aries / net.globalid.aries.message / AgentMessage

AgentMessage

abstract class AgentMessage

An abstract model for all messages between agents. Note: all fields are marked as transient, because a custom adapter is used for converting these fields to JSON. If an implementation (re)declares any of these fields, it should also mark them as transient.

Constructors

<init>

An abstract model for all messages between agents. Note: all fields are marked as transient, because a custom adapter is used for converting these fields to JSON. If an implementation (re)declares any of these fields, it should also mark them as transient.

AgentMessage(id: String = UUID.randomUUID().toString(), type: String)

Properties

id

is a sufficiently unique message identifier represented as a String, created by the sender.

var id: String

type

is a String representing the message type. Based on this, further message processing (by an appropriate service) can be done.

val type: String

Functions

addDecorator

Adds a single decorator

fun addDecorator(decorator: MessageDecorator): Unit

getDecorators

Gets list of decorators

fun getDecorators(): Set<MessageDecorator>

getServiceDecorator

Gets the ServiceDecorator if it's in the current message, otherwise null.

fun getServiceDecorator(): ServiceDecorator?

getThreadDecorator

Gets the thread decorator if it's in the current message, otherwise null

fun getThreadDecorator(): ThreadDecorator?

requireThreadDecorator

Gets the thread decorator.

fun requireThreadDecorator(): ThreadDecorator

setDecorators

Adds decorators to the current message

fun setDecorators(decorators: Set<MessageDecorator>): Unit

Companion Object Properties

ID_JSON_NAME

const val ID_JSON_NAME: String

TYPE_JSON_NAME

const val TYPE_JSON_NAME: String

Extension Functions

addThread

Adds the thread decorator with threadId to the current message

fun AgentMessage.addThread(threadId: String): Unit

getThreadId

Returns the message thread id

fun AgentMessage.getThreadId(): String

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>

Inheritors

AckMessage

This message is an explicit acknowledgment for a message referenced by ~thread.thid (this message must have a thread decorator with a thread ID). AckMessage is adopted by other protocols, so the implementations must specify the correct type so that the correct message processor receives the message.

abstract class AckMessage : AgentMessage

BasicMessage

An agent message for the basic message protocol.

data class BasicMessage : AgentMessage

ConnectionInvitationMessage

Connection invitation message

data class ConnectionInvitationMessage : AgentMessage

ConnectionProblemReportMessage

Represents a problem report message used to communicate problems during the request and response phase. There are no errors during the invitation phase.

data class ConnectionProblemReportMessage : AgentMessage

ConnectionRequestMessage

The connection request message is used to communicate the DID document of the invitee to the inviter using the provisional connection information present in the connection_invitation message.

data class ConnectionRequestMessage : AgentMessage

ConnectionResponseMessage

The connection response message is used to complete the connection

data class ConnectionResponseMessage : AgentMessage

CredentialIssueMessage

Credential issue message

class CredentialIssueMessage : AgentMessage

CredentialOfferMessage

Credential offer message

class CredentialOfferMessage : AgentMessage

CredentialRequestMessage

Credential request message

class CredentialRequestMessage : AgentMessage

ForwardMessage

Forward message is used when sending message across multiple agents that do not need to know the details of a domain

data class ForwardMessage : AgentMessage

PresentationProposalMessage

This is an optional message sent by the prover to the verifier:

data class PresentationProposalMessage : AgentMessage

PresentationRequestMessage

This is a message from a verifier to a prover. It describes values that need to be revealed and predicates that need to be fulfilled.

data class PresentationRequestMessage : AgentMessage

PresentationResponseMessage

This is a response to a presentation request

data class PresentationResponseMessage : AgentMessage

TrustPingMessage

The trust ping message is used as the first message in the trust ping protocol.

data class TrustPingMessage : AgentMessage

TrustPingResponseMessage

The trust ping response message is used as the second message in the trust ping protocol. Note: don't forget to add a ThreadDecorator before sending the response.

data class TrustPingResponseMessage : AgentMessage