|
8 | 8 | }
|
9 | 9 | },
|
10 | 10 | "source": [
|
11 |
| - "# Mediator" |
| 11 | + "# Mediator\n", |
| 12 | + "\n", |
| 13 | + "A mediator is an agent that mediates DIDComm messages on behalf of other agents. Specifically Alice can request this agent act as a mediator for their messages, then when creating an invitation, she specifies the mediators endpoint as the place for messages to be sent and adds the mediators keys for routing of these messages. Anyone wishing to send Alice a DIDComm message must first encrypt under Alice's key then again under the Mediators key before sending the message to the endpoint specified by Alice. The mediators endpoint.\n", |
| 14 | + "\n", |
| 15 | + "### Useful Material\n", |
| 16 | + "\n", |
| 17 | + "* [Aries-RFC-046 Mediators and Relays](https://github.com/hyperledger/aries-rfcs/tree/master/concepts/0046-mediators-and-relays)\n", |
| 18 | + "* [Aries-RFC-094 Cross Domain Messaging](https://github.com/hyperledger/aries-rfcs/tree/master/concepts/0094-cross-domain-messaging)\n", |
| 19 | + "* [DIDComm Messaging Specification - Routing](https://identity.foundation/didcomm-messaging/spec/#routing)" |
12 | 20 | ]
|
13 | 21 | },
|
14 | 22 | {
|
|
24 | 32 | },
|
25 | 33 | {
|
26 | 34 | "cell_type": "code",
|
27 |
| - "execution_count": null, |
| 35 | + "execution_count": 2, |
28 | 36 | "metadata": {},
|
29 |
| - "outputs": [], |
| 37 | + "outputs": [ |
| 38 | + { |
| 39 | + "name": "stdout", |
| 40 | + "output_type": "stream", |
| 41 | + "text": [ |
| 42 | + "IPython autoawait is `on`, and set to use `asyncio`\n" |
| 43 | + ] |
| 44 | + } |
| 45 | + ], |
30 | 46 | "source": [
|
31 | 47 | "%autoawait\n",
|
32 | 48 | "import time\n",
|
|
48 | 64 | },
|
49 | 65 | {
|
50 | 66 | "cell_type": "code",
|
51 |
| - "execution_count": null, |
| 67 | + "execution_count": 3, |
52 | 68 | "metadata": {},
|
53 | 69 | "outputs": [],
|
54 | 70 | "source": [
|
|
62 | 78 | },
|
63 | 79 | {
|
64 | 80 | "cell_type": "code",
|
65 |
| - "execution_count": null, |
| 81 | + "execution_count": 4, |
66 | 82 | "metadata": {},
|
67 | 83 | "outputs": [],
|
68 | 84 | "source": [
|
|
81 | 97 | "source": [
|
82 | 98 | "### 3. Listen for webhooks and register default listeners\n",
|
83 | 99 | "\n",
|
84 |
| - "TODO: Explore mediator webhook stuff" |
| 100 | + "TODO: Implement mediator webhooks. These currently need to be implemented in ACA-Py first. We could even help do this. See issue - https://github.com/hyperledger/aries-cloudagent-python/issues/950 " |
85 | 101 | ]
|
86 | 102 | },
|
87 | 103 | {
|
88 | 104 | "cell_type": "code",
|
89 |
| - "execution_count": null, |
| 105 | + "execution_count": 5, |
90 | 106 | "metadata": {},
|
91 | 107 | "outputs": [],
|
92 | 108 | "source": [
|
|
123 | 139 | },
|
124 | 140 | {
|
125 | 141 | "cell_type": "code",
|
126 |
| - "execution_count": null, |
| 142 | + "execution_count": 6, |
127 | 143 | "metadata": {},
|
128 |
| - "outputs": [], |
| 144 | + "outputs": [ |
| 145 | + { |
| 146 | + "name": "stdout", |
| 147 | + "output_type": "stream", |
| 148 | + "text": [ |
| 149 | + "Connection Handler Called\n", |
| 150 | + "Connection 98e7d448-5a16-40b0-bab6-afe9e7b2f96f in State invitation\n", |
| 151 | + "Connection Handler Called\n", |
| 152 | + "Connection 98e7d448-5a16-40b0-bab6-afe9e7b2f96f in State invitation\n", |
| 153 | + "Connection ID 98e7d448-5a16-40b0-bab6-afe9e7b2f96f\n", |
| 154 | + "Invitation\n", |
| 155 | + "{'@type': 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation', '@id': '4d68d1f0-83d4-49b9-bb96-9ac35283878d', 'serviceEndpoint': 'https://6512c3c6a284.ngrok.io', 'label': 'MEDIATOR', 'recipientKeys': ['8kPjcAdzMdf8giMrsWackJRDHEUeG6uoDu7ECVm1yGrY']}\n", |
| 156 | + "Connection Handler Called\n", |
| 157 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State invitation\n", |
| 158 | + "Connection Handler Called\n", |
| 159 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State invitation\n", |
| 160 | + "Connection Handler Called\n", |
| 161 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State request\n", |
| 162 | + "Connection Handler Called\n", |
| 163 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State request\n", |
| 164 | + "Connection Handler Called\n", |
| 165 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State response\n", |
| 166 | + "Connection Handler Called\n", |
| 167 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State response\n", |
| 168 | + "Connection Handler Called\n", |
| 169 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State active\n", |
| 170 | + "Connection Handler Called\n", |
| 171 | + "Connection ab02b489-033d-4378-8202-ad31751d64f0 in State active\n" |
| 172 | + ] |
| 173 | + } |
| 174 | + ], |
129 | 175 | "source": [
|
130 | 176 | "# Create Invitation\n",
|
131 | 177 | "invite = await agent_controller.connections.create_invitation(multi_use=\"true\")\n",
|
|
146 | 192 | "source": [
|
147 | 193 | "### Copy the invitation output to any agent that you needs to establish a mediator. For example where you came from - [Alice](http://localhost:8888/lab/tree/Alice/Part%202%20-%20Mediation%20of%20communication%20-%20Alice.ipynb)\n",
|
148 | 194 | "\n",
|
149 |
| - "exmaple invitation you're supposed to cop:\n", |
| 195 | + "**Example** invitation you're supposed to copy:\n", |
150 | 196 | "\n",
|
151 | 197 | "{'@type': 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation', '@id': 'fee0f080-88c2-49b1-9869-9117524f010c', 'label': 'MEDIATOR', 'serviceEndpoint': 'https://f6d0c3340147.ngrok.io', 'recipientKeys': ['53gFmaMTJXVy5xBKJKZeRJYs6dL7SNG55gR1W6WuAvpN']}"
|
152 | 198 | ]
|
|
168 | 214 | },
|
169 | 215 | {
|
170 | 216 | "cell_type": "code",
|
171 |
| - "execution_count": null, |
| 217 | + "execution_count": 7, |
172 | 218 | "metadata": {
|
173 | 219 | "pycharm": {
|
174 | 220 | "name": "#%%\n"
|
175 | 221 | }
|
176 | 222 | },
|
177 |
| - "outputs": [], |
| 223 | + "outputs": [ |
| 224 | + { |
| 225 | + "name": "stdout", |
| 226 | + "output_type": "stream", |
| 227 | + "text": [ |
| 228 | + "Mediation Record\n", |
| 229 | + "connection_id ab02b489-033d-4378-8202-ad31751d64f0\n", |
| 230 | + "State granted\n" |
| 231 | + ] |
| 232 | + } |
| 233 | + ], |
178 | 234 | "source": [
|
179 | 235 | "response = await agent_controller.mediation.get_mediation_records()\n",
|
180 | 236 | "\n",
|
|
227 | 283 | "name": "python",
|
228 | 284 | "nbconvert_exporter": "python",
|
229 | 285 | "pygments_lexer": "ipython3",
|
230 |
| - "version": "3.8.5" |
| 286 | + "version": "3.7.6" |
231 | 287 | },
|
232 | 288 | "pycharm": {
|
233 | 289 | "stem_cell": {
|
|
0 commit comments