From dbcac2c61c0f4c884e42b630d697cc53af711786 Mon Sep 17 00:00:00 2001 From: Pritam Singh Date: Thu, 6 Oct 2022 12:24:01 +0530 Subject: [PATCH] include image_url in oob invitation Signed-off-by: Pritam Singh --- aries_cloudagent/protocols/out_of_band/v1_0/manager.py | 3 +++ .../protocols/out_of_band/v1_0/messages/invitation.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/manager.py b/aries_cloudagent/protocols/out_of_band/v1_0/manager.py index 7f160ed63c..dd0843045a 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/manager.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/manager.py @@ -121,6 +121,7 @@ async def create_invitation( mediation_id, or_default=True, ) + image_url = self.profile.context.settings.get("image_url") if not (hs_protos or attachments): raise OutOfBandManagerError( @@ -235,6 +236,7 @@ async def create_invitation( services=[f"did:sov:{public_did.did}"], accept=service_accept if protocol_version != "1.0" else None, version=protocol_version or DEFAULT_VERSION, + image_url=image_url, ) our_recipient_key = public_did.verkey @@ -333,6 +335,7 @@ async def create_invitation( invi_msg.handshake_protocols = handshake_protocols invi_msg.requests_attach = message_attachments invi_msg.accept = service_accept if protocol_version != "1.0" else None + invi_msg.image_url = image_url invi_msg.services = [ ServiceMessage( _id="#inline", diff --git a/aries_cloudagent/protocols/out_of_band/v1_0/messages/invitation.py b/aries_cloudagent/protocols/out_of_band/v1_0/messages/invitation.py index 14b6eaaff6..e461201975 100644 --- a/aries_cloudagent/protocols/out_of_band/v1_0/messages/invitation.py +++ b/aries_cloudagent/protocols/out_of_band/v1_0/messages/invitation.py @@ -120,6 +120,7 @@ def __init__( *, comment: str = None, label: str = None, + image_url: str = None, handshake_protocols: Sequence[Text] = None, requests_attach: Sequence[AttachDecorator] = None, services: Sequence[Union[Service, Text]] = None, @@ -138,6 +139,7 @@ def __init__( # super().__init__(_id=_id, **kwargs) super().__init__(_type=msg_type, _version=version, **kwargs) self.label = label + self.image_url = image_url self.handshake_protocols = ( list(handshake_protocols) if handshake_protocols else [] ) @@ -208,6 +210,13 @@ class Meta: example="https://didcomm.org/my-family/1.0/my-message-type", ) label = fields.Str(required=False, description="Optional label", example="Bob") + image_url = fields.URL( + data_key="imageUrl", + required=False, + allow_none=True, + description="Optional image URL for out-of-band invitation", + example="http://192.168.56.101/img/logo.jpg", + ) handshake_protocols = fields.List( fields.Str( description="Handshake protocol",