aries_cloudagent.protocols.connections.v1_0 package

Subpackages

Submodules

aries_cloudagent.protocols.connections.v1_0.manager module

Classes to manage connections.

class aries_cloudagent.protocols.connections.v1_0.manager.ConnectionManager(profile: Profile)[source]

Bases: BaseConnectionManager

Class for managing connections.

async accept_response(response: ConnectionResponse, receipt: MessageReceipt) ConnRecord[source]

Accept a connection response.

Process a ConnectionResponse message by looking up the connection request and setting up the pairwise connection.

Parameters
  • response – The ConnectionResponse to accept

  • receipt – The message receipt

Returns

The updated ConnRecord representing the connection

Raises
async create_invitation(my_label: Optional[str] = None, my_endpoint: Optional[str] = None, auto_accept: Optional[bool] = None, public: bool = False, multi_use: bool = False, alias: Optional[str] = None, routing_keys: Optional[Sequence[str]] = None, recipient_keys: Optional[Sequence[str]] = None, metadata: Optional[dict] = None, mediation_id: Optional[str] = None) Tuple[ConnRecord, ConnectionInvitation][source]

Generate new connection invitation.

This interaction represents an out-of-band communication channel. In the future and in practice, these sort of invitations will be received over any number of channels such as SMS, Email, QR Code, NFC, etc.

Structure of an invite message:

{
    "@type": "https://didcomm.org/connections/1.0/invitation",
    "label": "Alice",
    "did": "did:sov:QmWbsNYhMrjHiqZDTUTEJs"
}

Or, in the case of a peer DID:

{
    "@type": "https://didcomm.org/connections/1.0/invitation",
    "label": "Alice",
    "did": "did:peer:oiSqsNYhMrjHiqZDTUthsw",
    "recipient_keys": ["8HH5gYEeNc3z7PYXmd54d4x6qAfCNrqQqEB3nS7Zfu7K"],
    "service_endpoint": "https://example.com/endpoint"
    "routing_keys": ["9EH5gYEeNc3z7PYXmd53d5x6qAfCNrqQqEB4nS7Zfu6K"],
}
Parameters
  • my_label – label for this connection

  • my_endpoint – endpoint where other party can reach me

  • auto_accept – auto-accept a corresponding connection request (None to use config)

  • public – set to create an invitation from the public DID

  • multi_use – set to True to create an invitation for multiple use

  • alias – optional alias to apply to connection for later use

Returns

A tuple of the new ConnRecord and ConnectionInvitation instances

async create_request(connection: ConnRecord, my_label: Optional[str] = None, my_endpoint: Optional[str] = None, mediation_id: Optional[str] = None) ConnectionRequest[source]

Create a new connection request for a previously-received invitation.

Parameters
  • connection – The ConnRecord representing the invitation to accept

  • my_label – My label

  • my_endpoint – My endpoint

Returns

A new ConnectionRequest message to send to the other agent

async create_response(connection: ConnRecord, my_endpoint: Optional[str] = None, mediation_id: Optional[str] = None) ConnectionResponse[source]

Create a connection response for a received connection request.

Parameters
  • connection – The ConnRecord with a pending connection request

  • my_endpoint – The endpoint I can be reached at

  • mediation_id – The record id for mediation that contains routing_keys and

  • endpoint (service) –

Returns

A tuple of the updated ConnRecord new ConnectionResponse message

manager_error_to_problem_report(e: ConnectionManagerError, message: Union[ConnectionRequest, ConnectionResponse], message_receipt) tuple[aries_cloudagent.protocols.connections.v1_0.messages.problem_report.ConnectionProblemReport, Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget]][source]

Convert ConnectionManagerError to problem report.

property profile: Profile

Accessor for the current profile.

Returns

The profile for this connection manager

async receive_invitation(invitation: ConnectionInvitation, their_public_did: Optional[str] = None, auto_accept: Optional[bool] = None, alias: Optional[str] = None, mediation_id: Optional[str] = None) ConnRecord[source]

Create a new connection record to track a received invitation.

Parameters
  • invitation – The ConnectionInvitation to store

  • auto_accept – set to auto-accept the invitation (None to use config)

  • alias – optional alias to set on the record

Returns

The new ConnRecord instance

async receive_problem_report(conn_rec: ConnRecord, report: ConnectionProblemReport)[source]

Receive problem report.

async receive_request(request: ConnectionRequest, receipt: MessageReceipt) ConnRecord[source]

Receive and store a connection request.

Parameters
  • request – The ConnectionRequest to accept

  • receipt – The message receipt

Returns

The new or updated ConnRecord instance

exception aries_cloudagent.protocols.connections.v1_0.manager.ConnectionManagerError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: BaseError

Connection error.

aries_cloudagent.protocols.connections.v1_0.message_types module

Message type identifiers for Connections.

aries_cloudagent.protocols.connections.v1_0.routes module

Connection handling admin routes.

class aries_cloudagent.protocols.connections.v1_0.routes.AcceptInvitationQueryStringSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Parameters and validators for accept invitation request query string.

class aries_cloudagent.protocols.connections.v1_0.routes.AcceptRequestQueryStringSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Parameters and validators for accept conn-request web-request query string.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnIdRefIdMatchInfoSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Path parameters and validators for request taking connection and ref ids.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionListSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Result schema for connection list.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionMetadataQuerySchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Query schema for metadata.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionMetadataSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Result schema for connection metadata.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionMetadataSetRequestSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Request Schema for set metadata.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionModuleResponseSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Response schema for connection module.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionStaticRequestSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Request schema for a new static connection.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionStaticResultSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Result schema for new static connection.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionsConnIdMatchInfoSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Path parameters and validators for request taking connection id.

class aries_cloudagent.protocols.connections.v1_0.routes.ConnectionsListQueryStringSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Parameters and validators for connections list request query string.

class aries_cloudagent.protocols.connections.v1_0.routes.CreateInvitationQueryStringSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Parameters and validators for create invitation request query string.

class aries_cloudagent.protocols.connections.v1_0.routes.CreateInvitationRequestSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Request schema for invitation connection target.

class aries_cloudagent.protocols.connections.v1_0.routes.EndpointsResultSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Result schema for connection endpoints.

class aries_cloudagent.protocols.connections.v1_0.routes.InvitationResultSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Result schema for a new connection invitation.

class aries_cloudagent.protocols.connections.v1_0.routes.ReceiveInvitationQueryStringSchema(*args: Any, **kwargs: Any)[source]

Bases: OpenAPISchema

Parameters and validators for receive invitation request query string.

class aries_cloudagent.protocols.connections.v1_0.routes.ReceiveInvitationRequestSchema(*args: Any, **kwargs: Any)[source]

Bases: ConnectionInvitationSchema

Request schema for receive invitation request.

validate_fields(data, **kwargs)

Bypass middleware field validation: marshmallow has no data yet.

aries_cloudagent.protocols.connections.v1_0.routes.connection_sort_key(conn)[source]

Get the sorting key for a particular connection.

aries_cloudagent.protocols.connections.v1_0.routes.post_process_routes(app: aiohttp.web.Application)[source]

Amend swagger API.

async aries_cloudagent.protocols.connections.v1_0.routes.register(app: aiohttp.web.Application)[source]

Register routes.