Walkthrough

Andre Martins edited this page Jan 28, 2015 · 1 revision
Clone this wiki locally

This is a description and walkthrough for the XDI Cloud Messenger.

Scenario

XDI Cloud Messenger is a web application, made to demonstrate how XDI can be used as a message exchange protocol. In this example it is shown a simple use case where two users send messages to each other. It is also covered how each user can control who can send him messages.

This two clouds will be used:

=andre / [=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe
=miguel / [=]!:uuid:e09163f0-be14-4891-ab6d-87268ac73dd3

Walkthrough

Step 1: User authentication

As this application uses the Root Link Contract, the user should authenticate using the respective secret token.


Step 2: Messages

On the left, it is shown the list of messages in the user's inbox. On the right is the message which is opened. The user =miguel has sent a message to =andre.

This message, which is stored in =andre's graph, is represented in XDI like this:

[=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe[$messages]!:uuid:437aae64-a7ce-46d5-9396-2b3a1872fb03/$from/[=]!:uuid:e09163f0-be14-4891-ab6d-87268ac73dd3
[=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe[$messages]!:uuid:437aae64-a7ce-46d5-9396-2b3a1872fb03<#content>&/&/"This is my first cloud message.\n\nMiguel"
[=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe[$messages]!:uuid:437aae64-a7ce-46d5-9396-2b3a1872fb03<$t>&/&/"2015-01-28T16:50:29+0100"

Step 3: Authorizing senders

As it can be observed, =miguel is part of the =andre's authorized senders. This means that =andre had added =miguel in the past and that's why he was able to get a message from him.

On XDI level this authorization is represented as a Link Contract which gives access to =miguel to write ($set operation) under =andre's graph. This is only possible if =miguel would send a valid signature.

([=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe/[=]!:uuid:e09163f0-be14-4891-ab6d-87268ac73dd3)(#messages$do$if$and/$true){$from}/$is/[=]!:uuid:e09163f0-be14-4891-ab6d-87268ac73dd3
([=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe/[=]!:uuid:e09163f0-be14-4891-ab6d-87268ac73dd3)(#messages$do$if$and/$true){$msg}<$sig><$valid>&/&/true
([=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe/[=]!:uuid:e09163f0-be14-4891-ab6d-87268ac73dd3)#messages$do/$set/[=]!:uuid:50f47072-e6a8-4c5c-ac18-499035ab46fe[$messages]

When =andre tries to reply =miguel's message, he gets an error. He does not belong to =miguel authorized senders list.

=miguel adds =andre as an authorized sender, creating the link contract in his cloud and allowing =andre to write in his graph.

Finally, =andre is able to send the message to =miguel.