aries_cloudagent.messaging package¶
Subpackages¶
- aries_cloudagent.messaging.actionmenu package
- Subpackages
- Submodules
- aries_cloudagent.messaging.actionmenu.base_service module
- aries_cloudagent.messaging.actionmenu.controller module
- aries_cloudagent.messaging.actionmenu.driver_service module
- aries_cloudagent.messaging.actionmenu.message_types module
- aries_cloudagent.messaging.actionmenu.routes module
- aries_cloudagent.messaging.actionmenu.util module
- aries_cloudagent.messaging.basicmessage package
- aries_cloudagent.messaging.connections package
- Subpackages
- aries_cloudagent.messaging.connections.handlers package
- aries_cloudagent.messaging.connections.messages package
- Submodules
- aries_cloudagent.messaging.connections.messages.connection_invitation module
- aries_cloudagent.messaging.connections.messages.connection_request module
- aries_cloudagent.messaging.connections.messages.connection_response module
- aries_cloudagent.messaging.connections.messages.problem_report module
- aries_cloudagent.messaging.connections.models package
- Submodules
- aries_cloudagent.messaging.connections.manager module
- aries_cloudagent.messaging.connections.message_types module
- aries_cloudagent.messaging.connections.routes module
- Subpackages
- aries_cloudagent.messaging.credential_definitions package
- aries_cloudagent.messaging.credentials package
- Subpackages
- aries_cloudagent.messaging.credentials.handlers package
- Submodules
- aries_cloudagent.messaging.credentials.handlers.credential_issue_handler module
- aries_cloudagent.messaging.credentials.handlers.credential_offer_handler module
- aries_cloudagent.messaging.credentials.handlers.credential_request_handler module
- aries_cloudagent.messaging.credentials.handlers.credential_stored_handler module
- aries_cloudagent.messaging.credentials.messages package
- Submodules
- aries_cloudagent.messaging.credentials.messages.credential_issue module
- aries_cloudagent.messaging.credentials.messages.credential_offer module
- aries_cloudagent.messaging.credentials.messages.credential_request module
- aries_cloudagent.messaging.credentials.messages.credential_stored module
- aries_cloudagent.messaging.credentials.models package
- aries_cloudagent.messaging.credentials.handlers package
- Submodules
- aries_cloudagent.messaging.credentials.manager module
- aries_cloudagent.messaging.credentials.message_types module
- aries_cloudagent.messaging.credentials.routes module
- Subpackages
- aries_cloudagent.messaging.decorators package
- Submodules
- aries_cloudagent.messaging.decorators.base module
- aries_cloudagent.messaging.decorators.default module
- aries_cloudagent.messaging.decorators.localization_decorator module
- aries_cloudagent.messaging.decorators.signature_decorator module
- aries_cloudagent.messaging.decorators.thread_decorator module
- aries_cloudagent.messaging.decorators.timing_decorator module
- aries_cloudagent.messaging.decorators.transport_decorator module
- aries_cloudagent.messaging.discovery package
- aries_cloudagent.messaging.introduction package
- Subpackages
- Submodules
- aries_cloudagent.messaging.introduction.base_service module
- aries_cloudagent.messaging.introduction.demo_service module
- aries_cloudagent.messaging.introduction.message_types module
- aries_cloudagent.messaging.introduction.routes module
- aries_cloudagent.messaging.models package
- aries_cloudagent.messaging.presentations package
- Subpackages
- Submodules
- aries_cloudagent.messaging.presentations.manager module
- aries_cloudagent.messaging.presentations.message_types module
- aries_cloudagent.messaging.presentations.routes module
- aries_cloudagent.messaging.problem_report package
- aries_cloudagent.messaging.routing package
- Subpackages
- aries_cloudagent.messaging.routing.handlers package
- Submodules
- aries_cloudagent.messaging.routing.handlers.forward_handler module
- aries_cloudagent.messaging.routing.handlers.route_query_request_handler module
- aries_cloudagent.messaging.routing.handlers.route_query_response_handler module
- aries_cloudagent.messaging.routing.handlers.route_update_request_handler module
- aries_cloudagent.messaging.routing.handlers.route_update_response_handler module
- aries_cloudagent.messaging.routing.messages package
- Submodules
- aries_cloudagent.messaging.routing.messages.forward module
- aries_cloudagent.messaging.routing.messages.route_query_request module
- aries_cloudagent.messaging.routing.messages.route_query_response module
- aries_cloudagent.messaging.routing.messages.route_update_request module
- aries_cloudagent.messaging.routing.messages.route_update_response module
- aries_cloudagent.messaging.routing.models package
- Submodules
- aries_cloudagent.messaging.routing.models.paginate module
- aries_cloudagent.messaging.routing.models.paginated module
- aries_cloudagent.messaging.routing.models.route_query_result module
- aries_cloudagent.messaging.routing.models.route_record module
- aries_cloudagent.messaging.routing.models.route_update module
- aries_cloudagent.messaging.routing.models.route_updated module
- aries_cloudagent.messaging.routing.handlers package
- Submodules
- aries_cloudagent.messaging.routing.manager module
- aries_cloudagent.messaging.routing.message_types module
- Subpackages
- aries_cloudagent.messaging.schemas package
- aries_cloudagent.messaging.trustping package
Submodules¶
aries_cloudagent.messaging.agent_message module¶
Agent message base class and schema.
-
class
aries_cloudagent.messaging.agent_message.
AgentMessage
(_id: str = None, _decorators: aries_cloudagent.messaging.decorators.base.BaseDecoratorSet = None)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModel
Agent message base class.
-
Handler
¶ Accessor for the agent message’s handler class.
Returns: Handler class
-
class
Meta
[source]¶ Bases:
object
AgentMessage metadata.
-
handler_class
= None¶
-
message_type
= None¶
-
schema_class
= None¶
-
-
assign_thread_from
(msg: aries_cloudagent.messaging.agent_message.AgentMessage)[source]¶ Copy thread information from a previous message.
Parameters: msg – The received message containing optional thread information
-
assign_thread_id
(thid: str, pthid: str = None)[source]¶ Assign a specific thread ID.
Parameters: - thid – The thread identifier
- pthid – The parent thread identifier
-
get_signature
(field_name: str) → aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator[source]¶ Get the signature for a named field.
Parameters: field_name – Field name to get the signature for Returns: A SignatureDecorator for the requested field name
-
set_signature
(field_name: str, signature: aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator)[source]¶ Add or replace the signature for a named field.
Parameters: - field_name – Field to set signature on
- signature – Signature for the field
-
sign_field
(field_name: str, signer_verkey: str, wallet: aries_cloudagent.wallet.base.BaseWallet, timestamp=None) → aries_cloudagent.messaging.decorators.signature_decorator.SignatureDecorator[source]¶ Create and store a signature for a named field.
Parameters: - field_name – Field to sign
- signer_verkey – Verkey of signer
- wallet – Wallet to use for signature
- timestamp – Optional timestamp for signature
Returns: A SignatureDecorator for newly created signature
Raises: ValueError
– If field_name doesn’t exist on this message
-
verify_signatures
(wallet: aries_cloudagent.wallet.base.BaseWallet) → bool[source]¶ Verify all associated field signatures.
Parameters: wallet – Wallet to use in verification Returns: True if all signatures verify, else false
-
verify_signed_field
(field_name: str, wallet: aries_cloudagent.wallet.base.BaseWallet, signer_verkey: str = None) → str[source]¶ Verify a specific field signature.
Parameters: - field_name – The field name to verify
- wallet – Wallet to use for the verification
- signer_verkey – Verkey of signer to use
Returns: The verkey of the signer
Raises: ValueError
– If field_name does not exist on this messageValueError
– If the verification failsValueError
– If the verkey of the signature does not match the- provided verkey
-
-
exception
aries_cloudagent.messaging.agent_message.
AgentMessageError
(*args, error_code: str = None, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelError
Base exception for agent message issues.
-
class
aries_cloudagent.messaging.agent_message.
AgentMessageSchema
(*args, **kwargs)[source]¶ Bases:
aries_cloudagent.messaging.models.base.BaseModelSchema
AgentMessage schema.
-
class
Meta
[source]¶ Bases:
object
AgentMessageSchema metadata.
-
model_class
= None¶
-
signed_fields
= None¶
-
-
check_dump_decorators
(obj, **kwargs)[source]¶ Pre-dump hook to validate and load the message decorators.
Parameters: obj – The AgentMessage object Raises: BaseModelError
– If a decorator does not validate
-
dump_decorators
(data, **kwargs)[source]¶ Post-dump hook to write the decorators to the serialized output.
Parameters: obj – The serialized data Returns: The modified data
-
extract_decorators
(data, **kwargs)[source]¶ Pre-load hook to extract the decorators and check the signed fields.
Parameters: data – Incoming data to parse
Returns: Parsed and modified data
Raises: ValidationError
– If a field signature does not correlate- to a field in the message
ValidationError
– If the message defines both a field signature- and a value for the same field
ValidationError
– If there is a missing field signature
-
class
aries_cloudagent.messaging.base_context module¶
aries_cloudagent.messaging.base_handler module¶
A Base handler class for all message handlers.
aries_cloudagent.messaging.error module¶
Messaging-related error classes and codes.
aries_cloudagent.messaging.message_delivery module¶
aries_cloudagent.messaging.outbound_message module¶
aries_cloudagent.messaging.protocol_registry module¶
aries_cloudagent.messaging.request_context module¶
Request context class.
A request context provides everything required by handlers and other parts of the system to process a message.
-
class
aries_cloudagent.messaging.request_context.
RequestContext
(*, base_context: aries_cloudagent.config.injection_context.InjectionContext = None, settings: Mapping[str, object] = None)[source]¶ Bases:
aries_cloudagent.config.injection_context.InjectionContext
Context established by the Conductor and passed into message handlers.
-
connection_ready
¶ Accessor for the flag indicating an active connection with the sender.
Returns: True if the connection is active, else False
-
connection_record
¶ Accessor for the related connection record.
-
copy
() → aries_cloudagent.messaging.request_context.RequestContext[source]¶ Produce a copy of the request context instance.
-
default_endpoint
¶ Accessor for the default agent endpoint (from agent config).
Returns: The default agent endpoint
-
default_label
¶ Accessor for the default agent label (from agent config).
Returns: The default label
-
message
¶ Accessor for the deserialized message instance.
Returns: This context’s agent message
-
message_receipt
¶ Accessor for the message receipt information.
Returns: This context’s message receipt information
-
aries_cloudagent.messaging.responder module¶
A message responder.
The responder is provided to message handlers to enable them to send a new message in response to the message being handled.
-
class
aries_cloudagent.messaging.responder.
BaseResponder
(*, connection_id: str = None, reply_session_id: str = None, reply_to_verkey: str = None)[source]¶ Bases:
abc.ABC
Interface for message handlers to send responses.
-
create_outbound
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], *, connection_id: str = None, reply_session_id: str = None, reply_thread_id: str = None, reply_to_verkey: str = None, target: aries_cloudagent.connections.models.connection_target.ConnectionTarget = None, target_list: Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget] = None) → aries_cloudagent.transport.outbound.message.OutboundMessage[source]¶ Create an OutboundMessage from a message payload.
-
send
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], **kwargs)[source]¶ Convert a message to an OutboundMessage and send it.
-
send_outbound
(message: aries_cloudagent.transport.outbound.message.OutboundMessage)[source]¶ Send an outbound message.
Parameters: message – The OutboundMessage to be sent
-
send_reply
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], *, connection_id: str = None, target: aries_cloudagent.connections.models.connection_target.ConnectionTarget = None, target_list: Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget] = None)[source]¶ Send a reply to an incoming message.
Parameters: - message – the AgentMessage, or pre-packed str or bytes to reply with
- connection_id – optionally override the target connection ID
- target – optionally specify a ConnectionTarget to send to
Raises: ResponderError
– If there is no active connection
-
-
class
aries_cloudagent.messaging.responder.
MockResponder
[source]¶ Bases:
aries_cloudagent.messaging.responder.BaseResponder
Mock responder implementation for use by tests.
-
send
(message: Union[aries_cloudagent.messaging.agent_message.AgentMessage, str, bytes], **kwargs)[source]¶ Convert a message to an OutboundMessage and send it.
-
send_outbound
(message: aries_cloudagent.transport.outbound.message.OutboundMessage)[source]¶ Send an outbound message.
-
aries_cloudagent.messaging.serializer module¶
aries_cloudagent.messaging.socket module¶
aries_cloudagent.messaging.util module¶
Utils for messages.
-
aries_cloudagent.messaging.util.
canon
(raw_attr_name: str) → str[source]¶ Canonicalize input attribute name for indy proofs and credential offers.
Parameters: raw_attr_name – raw attribute name Returns: canonicalized attribute name
-
aries_cloudagent.messaging.util.
datetime_to_str
(dt: Union[str, datetime.datetime]) → str[source]¶ Convert a datetime object to an indy-standard datetime string.
Parameters: dt – May be a string or datetime to allow automatic conversion
-
aries_cloudagent.messaging.util.
epoch_to_str
(epoch: int) → str[source]¶ Convert epoch seconds to indy-standard datetime string.
Parameters: epoch – epoch seconds
-
aries_cloudagent.messaging.util.
str_to_datetime
(dt: Union[str, datetime.datetime]) → datetime.datetime[source]¶ Convert an indy-standard datetime string to a datetime.
Using a fairly lax regex pattern to match slightly different formats. In Python 3.7 datetime.fromisoformat might be used.
Parameters: dt – May be a string or datetime to allow automatic conversion