aries_cloudagent.connections.models package
Subpackages
Submodules
aries_cloudagent.connections.models.conn_record module
Handle connection information interface with non-secrets storage.
- class aries_cloudagent.connections.models.conn_record.ConnRecord(*, connection_id: Optional[str] = None, my_did: Optional[str] = None, their_did: Optional[str] = None, their_label: Optional[str] = None, their_role: Optional[Union[str, aries_cloudagent.connections.models.conn_record.ConnRecord.Role]] = None, invitation_key: Optional[str] = None, invitation_msg_id: Optional[str] = None, request_id: Optional[str] = None, state: Optional[Union[str, aries_cloudagent.connections.models.conn_record.ConnRecord.State]] = None, inbound_connection_id: Optional[str] = None, error_msg: Optional[str] = None, routing_state: Optional[str] = None, accept: Optional[str] = None, invitation_mode: Optional[str] = None, alias: Optional[str] = None, their_public_did: Optional[str] = None, rfc23_state: Optional[str] = None, initiator: Optional[str] = None, connection_protocol: Optional[Union[str, aries_cloudagent.connections.models.conn_record.ConnRecord.Protocol]] = None, **kwargs)[source]
Bases:
aries_cloudagent.messaging.models.base_record.BaseRecord
Represents a single pairwise connection.
- ACCEPT_AUTO = 'auto'
- ACCEPT_MANUAL = 'manual'
- INVITATION_MODE_MULTI = 'multi'
- INVITATION_MODE_ONCE = 'once'
- INVITATION_MODE_STATIC = 'static'
- LOG_STATE_FLAG = 'debug.connections'
- class Protocol(value)[source]
Bases:
enum.Enum
Supported Protocols for Connection.
- RFC_0023 = 'didexchange/1.0'
- RFC_0160 = 'connections/1.0'
- property aries_protocol
Return used connection protocol.
- classmethod get(label: Union[str, aries_cloudagent.connections.models.conn_record.ConnRecord.Protocol])[source]
Get aries protocol enum for label.
- RECORD_ID_NAME = 'connection_id'
- RECORD_TYPE = 'connection'
- RECORD_TYPE_INVITATION = 'connection_invitation'
- RECORD_TYPE_METADATA = 'connection_metadata'
- RECORD_TYPE_REQUEST = 'connection_request'
- ROUTING_STATE_ACTIVE = 'active'
- ROUTING_STATE_ERROR = 'error'
- ROUTING_STATE_NONE = 'none'
- ROUTING_STATE_REQUEST = 'request'
- class Role(value)[source]
Bases:
enum.Enum
RFC 160 (inviter, invitee) = RFC 23 (responder, requester).
- REQUESTER = ('invitee', 'requester')
- RESPONDER = ('inviter', 'responder')
- classmethod get(label: Union[str, aries_cloudagent.connections.models.conn_record.ConnRecord.Role])[source]
Get role enum for label.
- property rfc160
Return RFC 160 (connection protocol) nomenclature.
- property rfc23
Return RFC 23 (DID exchange protocol) nomenclature.
- class State(value)[source]
Bases:
enum.Enum
Collator for equivalent states between RFC 160 and RFC 23.
On the connection record, the state has to serve for both RFCs. Hence, internally, RFC23 requester/responder states collate to their RFC160 condensed equivalent.
- ABANDONED = ('error', 'abandoned')
- COMPLETED = ('active', 'completed')
- INIT = ('init', 'start')
- INVITATION = ('invitation', 'invitation')
- REQUEST = ('request', 'request')
- RESPONSE = ('response', 'response')
- classmethod get(label: Union[str, aries_cloudagent.connections.models.conn_record.ConnRecord.State])[source]
Get state enum for label.
- property rfc160
Return RFC 160 (connection protocol) nomenclature.
- property rfc23
Return RFC 23 (DID exchange protocol) nomenclature to record logic.
- rfc23strict(their_role: aries_cloudagent.connections.models.conn_record.ConnRecord.Role)[source]
Return RFC 23 (DID exchange protocol) nomenclature to role as per RFC.
- TAG_NAMES = {'invitation_key', 'invitation_msg_id', 'my_did', 'request_id', 'state', 'their_did', 'their_public_did', 'their_role'}
- async attach_invitation(session: aries_cloudagent.core.profile.ProfileSession, invitation: Union[aries_cloudagent.protocols.connections.v1_0.messages.connection_invitation.ConnectionInvitation, aries_cloudagent.protocols.out_of_band.v1_0.messages.invitation.InvitationMessage])[source]
Persist the related connection invitation to storage.
- Parameters
session – The active profile session
invitation – The invitation to relate to this connection record
- async attach_request(session: aries_cloudagent.core.profile.ProfileSession, request: Union[aries_cloudagent.protocols.connections.v1_0.messages.connection_request.ConnectionRequest, aries_cloudagent.protocols.didexchange.v1_0.messages.request.DIDXRequest])[source]
Persist the related connection request to storage.
- Parameters
session – The active profile session
request – The request to relate to this connection record
- async delete_record(session: aries_cloudagent.core.profile.ProfileSession)[source]
Perform connection record deletion actions.
- Parameters
session (ProfileSession) – session
- async classmethod find_existing_connection(session: aries_cloudagent.core.profile.ProfileSession, their_public_did: str) Optional[aries_cloudagent.connections.models.conn_record.ConnRecord] [source]
Retrieve existing active connection records (public did).
- Parameters
session – The active profile session
their_public_did – Inviter public DID
- async metadata_delete(session: aries_cloudagent.core.profile.ProfileSession, key: str)[source]
Delete custom metadata associated with this connection.
- Parameters
session (ProfileSession) – session used for storage
key (str) – key of metadata to delete
- async metadata_get(session: aries_cloudagent.core.profile.ProfileSession, key: str, default: Optional[Any] = None) Any [source]
Retrieve arbitrary metadata associated with this connection.
- Parameters
session (ProfileSession) – session used for storage
key (str) – key identifying metadata
default (Any) – default value to get; type should be a JSON compatible value.
- Returns
metadata stored by key
- Return type
Any
- async metadata_get_all(session: aries_cloudagent.core.profile.ProfileSession) dict [source]
Return all custom metadata associated with this connection.
- Parameters
session (ProfileSession) – session used for storage
- Returns
dictionary representation of all metadata values
- Return type
- async metadata_set(session: aries_cloudagent.core.profile.ProfileSession, key: str, value: Any)[source]
Set arbitrary metadata associated with this connection.
- Parameters
session (ProfileSession) – session used for storage
key (str) – key identifying metadata
value (Any) – value to set
- async post_save(session: aries_cloudagent.core.profile.ProfileSession, *args, **kwargs)[source]
Perform post-save actions.
- Parameters
session – The active profile session
- async classmethod retrieve_by_alias(session: aries_cloudagent.core.profile.ProfileSession, alias: str) aries_cloudagent.connections.models.conn_record.ConnRecord [source]
Retrieve a connection record from an alias.
- Parameters
session – The active profile session
alias – The alias of the connection
- async classmethod retrieve_by_did(session: aries_cloudagent.core.profile.ProfileSession, their_did: Optional[str] = None, my_did: Optional[str] = None, their_role: Optional[str] = None) aries_cloudagent.connections.models.conn_record.ConnRecord [source]
Retrieve a connection record by target DID.
- Parameters
session – The active profile session
their_did – The target DID to filter by
my_did – One of our DIDs to filter by
my_role – Filter connections by their role
- async classmethod retrieve_by_invitation_key(session: aries_cloudagent.core.profile.ProfileSession, invitation_key: str, their_role: Optional[str] = None) aries_cloudagent.connections.models.conn_record.ConnRecord [source]
Retrieve a connection record by invitation key.
- Parameters
session – The active profile session
invitation_key – The key on the originating invitation
initiator – Filter by the initiator value
- async classmethod retrieve_by_invitation_msg_id(session: aries_cloudagent.core.profile.ProfileSession, invitation_msg_id: str, their_role: Optional[str] = None) Optional[aries_cloudagent.connections.models.conn_record.ConnRecord] [source]
Retrieve a connection record by invitation_msg_id.
- Parameters
session – The active profile session
invitation_msg_id – Invitation message identifier
initiator – Filter by the initiator value
- async classmethod retrieve_by_request_id(session: aries_cloudagent.core.profile.ProfileSession, request_id: str, their_role: Optional[str] = None) aries_cloudagent.connections.models.conn_record.ConnRecord [source]
Retrieve a connection record from our previous request ID.
- Parameters
session – The active profile session
request_id – The ID of the originating connection request
- async retrieve_invitation(session: aries_cloudagent.core.profile.ProfileSession) Union[aries_cloudagent.protocols.connections.v1_0.messages.connection_invitation.ConnectionInvitation, aries_cloudagent.protocols.out_of_band.v1_0.messages.invitation.InvitationMessage] [source]
Retrieve the related connection invitation.
- Parameters
session – The active profile session
- async retrieve_request(session: aries_cloudagent.core.profile.ProfileSession) Union[aries_cloudagent.protocols.connections.v1_0.messages.connection_request.ConnectionRequest, aries_cloudagent.protocols.didexchange.v1_0.messages.request.DIDXRequest] [source]
Retrieve the related connection invitation.
- Parameters
session – The active profile session
- class aries_cloudagent.connections.models.conn_record.ConnRecordSchema(*args: Any, **kwargs: Any)[source]
Bases:
marshmallow.
Schema to allow serialization/deserialization of connection records.
- class Meta[source]
Bases:
object
ConnRecordSchema metadata.
- model_class
alias of
aries_cloudagent.connections.models.conn_record.ConnRecord
- accept
- alias
- connection_id
- connection_protocol
- error_msg
- inbound_connection_id
- invitation_key
- invitation_mode
- invitation_msg_id
- my_did
- request_id
- rfc23_state
- routing_state
- their_did
- their_label
- their_public_did
- their_role
aries_cloudagent.connections.models.connection_target module
Record used to handle routing of messages to another agent.
- class aries_cloudagent.connections.models.connection_target.ConnectionTarget(*, did: Optional[str] = None, endpoint: Optional[str] = None, label: Optional[str] = None, recipient_keys: Optional[Sequence[str]] = None, routing_keys: Optional[Sequence[str]] = None, sender_key: Optional[str] = None)[source]
Bases:
aries_cloudagent.messaging.models.base.BaseModel
Record used to handle routing of messages to another agent.
- class aries_cloudagent.connections.models.connection_target.ConnectionTargetSchema(*args: Any, **kwargs: Any)[source]
Bases:
marshmallow.
ConnectionTarget schema.
- class Meta[source]
Bases:
object
ConnectionTargetSchema metadata.
- model_class
alias of
aries_cloudagent.connections.models.connection_target.ConnectionTarget
- did
- endpoint
- label
- recipient_keys
- routing_keys
- sender_key