aries_cloudagent.connections package

Subpackages

Submodules

aries_cloudagent.connections.base_manager module

Class to provide some common utilities.

For Connection, DIDExchange and OutOfBand Manager.

class aries_cloudagent.connections.base_manager.BaseConnectionManager(profile: aries_cloudagent.core.profile.Profile)[source]

Bases: object

Class to provide utilities regarding connection_targets.

RECORD_TYPE_DID_DOC = 'did_doc'
RECORD_TYPE_DID_KEY = 'did_key'
async add_key_for_did(did: str, key: str)[source]

Store a verkey for lookup against a DID.

Parameters
  • did – The DID to associate with this key

  • key – The verkey to be added

async create_did_document(did_info: aries_cloudagent.wallet.did_info.DIDInfo, svc_endpoints: Optional[Sequence[str]] = None, mediation_records: Optional[List[aries_cloudagent.protocols.coordinate_mediation.v1_0.models.mediation_record.MediationRecord]] = None) aries_cloudagent.connections.models.diddoc.diddoc.DIDDoc[source]

Create our DID doc for a given DID.

Parameters
  • did_info – The DID information (DID and verkey) used in the connection

  • svc_endpoints – Custom endpoints for the DID Document

  • mediation_record – The record for mediation that contains routing_keys and service endpoint

Returns

The prepared DIDDoc instance

async create_static_connection(my_did: Optional[str] = None, my_seed: Optional[str] = None, their_did: Optional[str] = None, their_seed: Optional[str] = None, their_verkey: Optional[str] = None, their_endpoint: Optional[str] = None, their_label: Optional[str] = None, alias: Optional[str] = None, mediation_id: Optional[str] = None) Tuple[aries_cloudagent.wallet.did_info.DIDInfo, aries_cloudagent.wallet.did_info.DIDInfo, aries_cloudagent.connections.models.conn_record.ConnRecord][source]

Register a new static connection (for use by the test suite).

Parameters
  • my_did – override the DID used in the connection

  • my_seed – provide a seed used to generate our DID and keys

  • their_did – provide the DID used by the other party

  • their_seed – provide a seed used to generate their DID and keys

  • their_verkey – provide the verkey used by the other party

  • their_endpoint – their URL endpoint for routing messages

  • alias – an alias for this connection record

Returns

my DIDInfo, their DIDInfo, new ConnRecord instance

Return type

Tuple

diddoc_connection_targets(doc: aries_cloudagent.connections.models.diddoc.diddoc.DIDDoc, sender_verkey: str, their_label: Optional[str] = None) Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget][source]

Get a list of connection targets from a DID Document.

Parameters
  • doc – The DID Document to create the target from

  • sender_verkey – The verkey we are using

  • their_label – The connection label they are using

async fetch_connection_targets(connection: aries_cloudagent.connections.models.conn_record.ConnRecord) Sequence[aries_cloudagent.connections.models.connection_target.ConnectionTarget][source]

Get a list of connection targets from a ConnRecord.

Parameters

connection – The connection record (with associated DIDDoc) used to generate the connection target

async fetch_did_document(did: str) Tuple[aries_cloudagent.connections.models.diddoc.diddoc.DIDDoc, aries_cloudagent.storage.record.StorageRecord][source]

Retrieve a DID Document for a given DID.

Parameters

did – The DID to search for

async find_connection(their_did: str, my_did: Optional[str] = None, my_verkey: Optional[str] = None, auto_complete=False) Optional[aries_cloudagent.connections.models.conn_record.ConnRecord][source]

Look up existing connection information for a sender verkey.

Parameters
  • their_did – Their DID

  • my_did – My DID

  • my_verkey – My verkey

  • auto_complete – Should this connection automatically be promoted to active

Returns

The located ConnRecord, if any

async find_did_for_key(key: str) str[source]

Find the DID previously associated with a key.

Parameters

key – The verkey to look up

async find_inbound_connection(receipt: aries_cloudagent.transport.inbound.receipt.MessageReceipt) Optional[aries_cloudagent.connections.models.conn_record.ConnRecord][source]

Deserialize an incoming message and further populate the request context.

Parameters

receipt – The message receipt

Returns

The ConnRecord associated with the expanded message, if any

async get_connection_targets(*, connection_id: Optional[str] = None, connection: Optional[aries_cloudagent.connections.models.conn_record.ConnRecord] = None)[source]

Create a connection target from a ConnRecord.

Parameters
  • connection_id – The connection ID to search for

  • connection – The connection record itself, if already available

async get_endpoints(conn_id: str) Tuple[Optional[str], Optional[str]][source]

Get connection endpoints.

Parameters

conn_id – connection identifier

Returns

Their endpoint for this connection

async record_did(did: str)[source]

Record DID for later use.

This is required to correlate sender verkeys back to a connection.

async remove_keys_for_did(did: str)[source]

Remove all keys associated with a DID.

Parameters

did – The DID for which to remove keys

async resolve_connection_targets(did: str, sender_verkey: Optional[str] = None, their_label: Optional[str] = None) List[aries_cloudagent.connections.models.connection_target.ConnectionTarget][source]

Resolve connection targets for a DID.

async resolve_didcomm_services(did: str, service_accept: Optional[Sequence[str]] = None) Tuple[pydid.BaseDIDDocument, List[pydid.DIDCommService]][source]

Resolve a DIDComm services for a given DID.

async resolve_inbound_connection(receipt: aries_cloudagent.transport.inbound.receipt.MessageReceipt) Optional[aries_cloudagent.connections.models.conn_record.ConnRecord][source]

Populate the receipt DID information and find the related ConnRecord.

Parameters

receipt – The message receipt

Returns

The ConnRecord associated with the expanded message, if any

async resolve_invitation(did: str, service_accept: Optional[Sequence[str]] = None) Tuple[str, List[str], List[str]][source]

Resolve invitation with the DID Resolver.

Parameters

did – Document ID to resolve

async store_did_document(did_doc: aries_cloudagent.connections.models.diddoc.diddoc.DIDDoc)[source]

Store a DID document.

Parameters

did_doc – The DIDDoc instance to persist

async verification_methods_for_service(doc: pydid.BaseDIDDocument, service: pydid.DIDCommService) Tuple[List[pydid.VerificationMethod], List[pydid.VerificationMethod]][source]

Dereference recipient and routing keys.

Returns verification methods for a DIDComm service to enable extracting key material.

exception aries_cloudagent.connections.base_manager.BaseConnectionManagerError(*args, error_code: Optional[str] = None, **kwargs)[source]

Bases: aries_cloudagent.core.error.BaseError

BaseConnectionManager error.