Skip to content

Commit

Permalink
Add Mediation-Flows.md (#119)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Pinheiro <fabiomgpinheiro@gmail.com>
  • Loading branch information
FabioPinheiro authored and mineme0110 committed Apr 30, 2024
1 parent 44b4dc6 commit f74236a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
63 changes: 63 additions & 0 deletions Mediation-Flows.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Mediator

## Accept Invitation (Flow Diagram)

```mermaid
sequenceDiagram
participant Alice
participant Mediator
participant DID Resolver
note over Alice: Mediation client or Mediated Agent
rect rgb(0, 120, 255)
note right of Alice: Alice accepts the invitation and register for a mailbox.
Alice->>+Mediator: Register (HTTP)
Mediator->>+DID Resolver: Ask for Alice DID document
DID Resolver-->>-Mediator: DID document
note over Mediator: Confirm the identity
Mediator-->>-Alice: Registration done
note over Alice: Alice updates his DID document (adding serviceEndpoint)
end
```

---

## Send message through the mediator (Flow Diagram)

**Alice wants to send a message to Bob:**

```mermaid
sequenceDiagram
participant Alice
participant DID Resolver
participant Mediator
participant Bob
note over Bob: Mediation client or Mediated Agent
rect rgb(0, 120, 255)
Alice->>+DID Resolver: Ask for Bob DID document
DID Resolver-->>-Alice: DID document
note over Alice: Find the serviceEndpoint of Bob
note over Alice: Mediation Request
Alice->>+Mediator: Forward {Message to Bob}
opt Depending on the registration (config)
Mediator->>-Bob: Notify or send the playload to Bob
note over Mediator,Bob: This can be an Email, Webhook, Push API, WebSocket (that is already open), etc
end
end
rect rgb(0, 120, 255)
opt Bob read Message.
Bob->>+Mediator: Get message
opt If the cache is too old
Mediator->>+DID Resolver: Get updated Bob's DID document
DID Resolver-->>-Mediator: DID document
end
note over Mediator: Confirm the identity
Mediator-->>-Bob: {Message to Bob} (the playload of the Forward Message)
end
end
```
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ graph LR
For the fastest answers, join the [#atala-mediator][Link-Discord-Mediator] channel in the official Atala Discord and ask your questions, or just chat with other Atala developers and pioneers!


# Table of contents:
**More documentation:**
- [LICENSE](LICENSE) - Apache License, Version 2.0
- [Mediation Flows](Mediation-Flows.md) - Examples of mediation flows
- [Mediator Purpose](#Description)
- [Protocols Supported](#Protocols)
- [Mediator Protocol State and Flow](Coordinate-Mediation-Protocol.md)
Expand Down

0 comments on commit f74236a

Please sign in to comment.