acapy_agent.messaging.decorators package

Submodules

acapy_agent.messaging.decorators.attach_decorator module

acapy_agent.messaging.decorators.base module

Classes for managing a collection of decorators.

class acapy_agent.messaging.decorators.base.BaseDecoratorSet(models: dict | None = None)[source]

Bases: OrderedDict

Collection of decorators.

add_model(key: str, model: Type[BaseModel])[source]

Add a registered decorator model.

copy() BaseDecoratorSet[source]

Return a copy of the decorator set.

extract_decorators(message: Mapping, schema: Type[marshmallow.Schema] = None, serialized: bool = True, skip_attrs: Sequence[str] = None) OrderedDict[source]

Extract decorators and return the remaining properties.

field(name: str) BaseDecoratorSet[source]

Access a named decorated field.

property fields: OrderedDict

Acessor for the set of currently defined fields.

has_field(name: str) bool[source]

Check for the existence of a named decorator field.

load_decorator(key: str, value, serialized=False)[source]

Convert a decorator value to its loaded representation.

property models: dict

Accessor for the models dictionary.

property prefix: str

Accessor for the decorator prefix.

remove_field(name: str)[source]

Remove a named decorated field.

remove_model(key: str)[source]

Remove a registered decorator model.

to_dict(prefix: str | None = None) OrderedDict[source]

Convert to a dictionary (serialize).

Raises:

BaseModelError – on decorator validation errors

exception acapy_agent.messaging.decorators.base.DecoratorError(*args, error_code: str | None = None, **kwargs)[source]

Bases: BaseError

Base error for decorator issues.

acapy_agent.messaging.decorators.default module

Default decorator set implementation.

class acapy_agent.messaging.decorators.default.DecoratorSet(models: dict | None = None)[source]

Bases: BaseDecoratorSet

Default decorator set implementation.

acapy_agent.messaging.decorators.localization_decorator module

The localization decorator (~l10n) for message localization information.

class acapy_agent.messaging.decorators.localization_decorator.LocalizationDecorator(*, locale: str | None = None, localizable: Sequence[str] = None, catalogs: Sequence[str] = None)[source]

Bases: BaseModel

Class representing the localization decorator.

class Meta[source]

Bases: object

LocalizationDecorator metadata.

schema_class = 'LocalizationDecoratorSchema'
class acapy_agent.messaging.decorators.localization_decorator.LocalizationDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Localization decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

LocalizationDecoratorSchema metadata.

model_class

alias of LocalizationDecorator

acapy_agent.messaging.decorators.please_ack_decorator module

The please-ack decorator to request acknowledgement.

class acapy_agent.messaging.decorators.please_ack_decorator.PleaseAckDecorator(message_id: str | None = None, on: Sequence[str] = None)[source]

Bases: BaseModel

Class representing the please-ack decorator.

class Meta[source]

Bases: object

PleaseAckDecorator metadata.

schema_class = 'PleaseAckDecoratorSchema'
class acapy_agent.messaging.decorators.please_ack_decorator.PleaseAckDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

PleaseAck decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

PleaseAckDecoratorSchema metadata.

model_class

alias of PleaseAckDecorator

acapy_agent.messaging.decorators.service_decorator module

A message decorator for services.

A service decorator adds routing information to a message so agent can respond without needing to perform a handshake.

class acapy_agent.messaging.decorators.service_decorator.ServiceDecorator(*, endpoint: str, recipient_keys: List[str], routing_keys: List[str] | None = None)[source]

Bases: BaseModel

Class representing service decorator.

class Meta[source]

Bases: object

ServiceDecorator metadata.

schema_class = 'ServiceDecoratorSchema'
property endpoint

Accessor for service endpoint.

Returns:

This service’s serviceEndpoint

property recipient_keys

Accessor for recipient keys.

Returns:

This service’s recipientKeys

property routing_keys

Accessor for routing keys.

Returns:

This service’s routingKeys

class acapy_agent.messaging.decorators.service_decorator.ServiceDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Thread decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

ServiceDecoratorSchema metadata.

model_class

alias of ServiceDecorator

acapy_agent.messaging.decorators.signature_decorator module

Model and schema for working with field signatures within message bodies.

class acapy_agent.messaging.decorators.signature_decorator.SignatureDecorator(*, signature_type: str | None = None, signature: str | None = None, sig_data: str | None = None, signer: str | None = None)[source]

Bases: BaseModel

Class representing a field value signed by a known verkey.

class Meta[source]

Bases: object

SignatureDecorator metadata.

schema_class = 'SignatureDecoratorSchema'
TYPE_ED25519SHA512 = 'signature/1.0/ed25519Sha512_single'
async classmethod create(value, signer: str, wallet: BaseWallet, timestamp=None) SignatureDecorator[source]

Create a Signature.

Sign a field value and return a newly constructed SignatureDecorator representing the resulting signature.

Parameters:
  • cls – SignatureDecorator class

  • value – Value to sign

  • signer – Verkey of the signing party

  • wallet – The wallet to use for the signature

  • timestamp – Timestamp to use for the signature

Returns:

The created SignatureDecorator object

decode() Tuple[object, int][source]

Decode the signature to its timestamp and value.

Returns:

A tuple of (decoded message, timestamp)

async verify(wallet: BaseWallet) bool[source]

Verify the signature against the signer’s public key.

Parameters:

wallet – Wallet to use to verify signature

Returns:

True if verification succeeds else False

class acapy_agent.messaging.decorators.signature_decorator.SignatureDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

SignatureDecorator schema.

class Meta[source]

Bases: object

SignatureDecoratorSchema metadata.

model_class

alias of SignatureDecorator

acapy_agent.messaging.decorators.thread_decorator module

A message decorator for threads.

A thread decorator identifies a message that may require additional context from previous messages.

class acapy_agent.messaging.decorators.thread_decorator.ThreadDecorator(*, thid: str | None = None, pthid: str | None = None, sender_order: int | None = None, received_orders: Mapping | None = None)[source]

Bases: BaseModel

Class representing thread decorator.

class Meta[source]

Bases: object

ThreadDecorator metadata.

schema_class = 'ThreadDecoratorSchema'
property pthid

Accessor for parent thread identifier.

Returns:

This thread’s pthid

property received_orders: dict

Get received orders.

Returns:

The highest sender_order value that the sender has seen from other sender(s) on the thread.

property sender_order: int

Get sender order.

Returns:

A number that tells where this message fits in the sequence of all messages that the current sender has contributed to this thread

property thid

Accessor for thread identifier.

Returns:

This thread’s thid

class acapy_agent.messaging.decorators.thread_decorator.ThreadDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Thread decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

ThreadDecoratorSchema metadata.

model_class

alias of ThreadDecorator

acapy_agent.messaging.decorators.timing_decorator module

The timing decorator (~timing).

This decorator allows the timing of agent messages to be communicated and constrained.

class acapy_agent.messaging.decorators.timing_decorator.TimingDecorator(*, in_time: str | datetime = None, out_time: str | datetime = None, stale_time: str | datetime = None, expires_time: str | datetime = None, delay_milli: int | None = None, wait_until_time: str | datetime = None)[source]

Bases: BaseModel

Class representing the timing decorator.

class Meta[source]

Bases: object

TimingDecorator metadata.

schema_class = 'TimingDecoratorSchema'
class acapy_agent.messaging.decorators.timing_decorator.TimingDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Timing decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

TimingDecoratorSchema metadata.

model_class

alias of TimingDecorator

acapy_agent.messaging.decorators.trace_decorator module

A message decorator for trace events.

A trace decorator identifies a responsibility on the processor to record information on message processing events.

class acapy_agent.messaging.decorators.trace_decorator.TraceDecorator(*, target: str | None = None, full_thread: bool = True, trace_reports: Sequence | None = None)[source]

Bases: BaseModel

Class representing trace decorator.

class Meta[source]

Bases: object

TraceDecorator metadata.

schema_class = 'TraceDecoratorSchema'
append_trace_report(trace_report: TraceReport)[source]

Append a trace report to this decorator.

property full_thread

Accessor for full_thread flag.

Returns:

The full_thread flag

property target

Accessor for trace target.

Returns:

The target for tracing messages

property trace_reports

Set of trace reports for this message.

Returns:

The trace reports that have been logged on this message/thread so far. (Only for target=”message”.)

class acapy_agent.messaging.decorators.trace_decorator.TraceDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Trace decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

TraceDecoratorSchema metadata.

model_class

alias of TraceDecorator

class acapy_agent.messaging.decorators.trace_decorator.TraceReport(*, msg_id: str | None = None, thread_id: str | None = None, traced_type: str | None = None, timestamp: str | None = None, str_time: str | None = None, handler: str | None = None, elapsed_milli: int | None = None, outcome: str | None = None)[source]

Bases: BaseModel

Class representing a Trace Report.

class Meta[source]

Bases: object

TraceReport metadata.

schema_class = 'TraceReport'
property elapsed_milli

Accessor for elapsed_milli.

Returns:

The sender elapsed_milli

property handler

Accessor for handler.

Returns:

The sender handler

property msg_id

Accessor for msg_id.

Returns:

The msg_id

property outcome

Accessor for outcome.

Returns:

The sender outcome

property str_time

Accessor for str_time.

Returns:

Formatted representation of the sender timestamp

property thread_id

Accessor for thread_id.

Returns:

The thread_id

property timestamp

Accessor for timestamp.

Returns:

The sender timestamp

property traced_type

Accessor for traced_type.

Returns:

The sender traced_type

class acapy_agent.messaging.decorators.trace_decorator.TraceReportSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Trace report schema.

class Meta[source]

Bases: object

TraceReportSchema metadata.

model_class

alias of TraceReport

acapy_agent.messaging.decorators.transport_decorator module

The transport decorator (~transport).

This decorator allows changes to agent response behaviour and queue status updates.

class acapy_agent.messaging.decorators.transport_decorator.TransportDecorator(*, return_route: str | None = None, return_route_thread: str | None = None, queued_message_count: int | None = None)[source]

Bases: BaseModel

Class representing the transport decorator.

class Meta[source]

Bases: object

TransportDecorator metadata.

schema_class = 'TransportDecoratorSchema'
class acapy_agent.messaging.decorators.transport_decorator.TransportDecoratorSchema(*args: Any, **kwargs: Any)[source]

Bases: BaseModelSchema

Transport decorator schema used in serialization/deserialization.

class Meta[source]

Bases: object

TransportDecoratorSchema metadata.

model_class

alias of TransportDecorator