acapy_plugin_toolbox/static_connections.py
async def handle(self, context: RequestContext, responder: BaseResponder):
        """Handle static connection creation request."""

        connection_mgr = ConnectionManager(context)
        wallet: BaseWallet = await context.inject(BaseWallet)

        # Make our info for the connection
        my_info = await wallet.create_local_did()

        # Create connection record
        connection = ConnectionRecord(
            initiator=ConnectionRecord.INITIATOR_SELF,
            my_did=my_info.did,
            their_did=context.message.static_did,
            their_label=context.message.label,
            their_role=context.message.role if context.message.role else None,
            state=ConnectionRecord.STATE_ACTIVE,
            invitation_mode=ConnectionRecord.INVITATION_MODE_STATIC
        )

        # Construct their did doc from the basic components in message
        diddoc = DIDDoc(context.message.static_did)
        public_key = PublicKey(
            did=context.message.static_did,
            ident="1",
            value=context.message.static_key,
            pk_type=PublicKeyType.ED25519_SIG_2018,
            controller=context.message.static_did
        )
        service = Service(
            did=context.message.static_did,
            ident="indy",
            typ="IndyAgent",
            recip_keys=[public_key],
            routing_keys=[],
            endpoint=context.message.static_endpoint
        )
        diddoc.set(public_key)
        diddoc.set(service)

        # Save
        await connection_mgr.store_did_document(diddoc)
        await connection.save(
            context,
            reason='Created new static connection'
        )

        # Prepare response
        info = StaticConnectionInfo(
            did=my_info.did,
            key=my_info.verkey,
            endpoint=context.settings.get("default_endpoint")
        )
        info.assign_thread_from(context.message)
        await responder.send_reply(info)
        return
Handle static connection creation request.
Handle static connection creation request.
Handle static connection creation request .
async def handle(self, context: RequestContext, responder: BaseResponder):
        connection_mgr = ConnectionManager(context)
        wallet: BaseWallet = await context.inject(BaseWallet)
        my_info = await wallet.create_local_did()
        connection = ConnectionRecord(
            initiator=ConnectionRecord.INITIATOR_SELF,
            my_did=my_info.did,
            their_did=context.message.static_did,
            their_label=context.message.label,
            their_role=context.message.role if context.message.role else None,
            state=ConnectionRecord.STATE_ACTIVE,
            invitation_mode=ConnectionRecord.INVITATION_MODE_STATIC
        )
        diddoc = DIDDoc(context.message.static_did)
        public_key = PublicKey(
            did=context.message.static_did,
            ident="1",
            value=context.message.static_key,
            pk_type=PublicKeyType.ED25519_SIG_2018,
            controller=context.message.static_did
        )
        service = Service(
            did=context.message.static_did,
            ident="indy",
            typ="IndyAgent",
            recip_keys=[public_key],
            routing_keys=[],
            endpoint=context.message.static_endpoint
        )
        diddoc.set(public_key)
        diddoc.set(service)
        await connection_mgr.store_did_document(diddoc)
        await connection.save(
            context,
            reason='Created new static connection'
        )
        info = StaticConnectionInfo(
            did=my_info.did,
            key=my_info.verkey,
            endpoint=context.settings.get("default_endpoint")
        )
        info.assign_thread_from(context.message)
        await responder.send_reply(info)
        return
async def handle ( self , context : RequestContext , responder : BaseResponder ) : connection_mgr = ConnectionManager ( context ) wallet : BaseWallet = await context . inject ( BaseWallet ) my_info = await wallet . create_local_did ( ) connection = ConnectionRecord ( initiator = ConnectionRecord . INITIATOR_SELF , my_did = my_info . did , their_did = context . message . static_did , their_label = context . message . label , their_role = context . message . role if context . message . role else None , state = ConnectionRecord . STATE_ACTIVE , invitation_mode = ConnectionRecord . INVITATION_MODE_STATIC ) diddoc = DIDDoc ( context . message . static_did ) public_key = PublicKey ( did = context . message . static_did , ident = "1" , value = context . message . static_key , pk_type = PublicKeyType . ED25519_SIG_2018 , controller = context . message . static_did ) service = Service ( did = context . message . static_did , ident = "indy" , typ = "IndyAgent" , recip_keys = [ public_key ] , routing_keys = [ ] , endpoint = context . message . static_endpoint ) diddoc . set ( public_key ) diddoc . set ( service ) await connection_mgr . store_did_document ( diddoc ) await connection . save ( context , reason = 'Created new static connection' ) info = StaticConnectionInfo ( did = my_info . did , key = my_info . verkey , endpoint = context . settings . get ( "default_endpoint" ) ) info . assign_thread_from ( context . message ) await responder . send_reply ( info ) return
Handle static connection creation request.
Handle static connection creation request .
"""Handle static connection creation request.""" # Make our info for the connection # Create connection record # Construct their did doc from the basic components in message # Save # Prepare response
self
context
RequestContext
responder
BaseResponder