We use a decentral protocol to deliver messages and the messages are only stored in the user's sphere (e.g. google drive integration, dropbox integration, simple file).
"In Matrix, every user runs one or more Matrix clients, which connect through to a Matrix homeserver. The homeserver stores all their personal chat history and user account information - much as a mail client connects through to an IMAP/SMTP server. Just like email, you can either run your own Matrix homeserver and control and own your own communications and history or use one hosted by someone else (e.g. matrix.org) - there is no single point of control or mandatory service provider in Matrix, unlike WhatsApp, Facebook, Hangouts, etc."
Drawbacks
Single point of failure: Matrix home server (user can still choose another one)
Matrix is designed so that the home server stores the messages for the user
Matrix doesn't directly support key pair authentication
Matrix has a room design supporting more than two participants. This brings a lot of overhead which we don't need since we only want to support messages between two parties.
Benefits
Matrix is an established protocol
Matrix provides bridges to a lot of other services https://matrix.org/bridges/ e.g. email, WhatsApp, telegram, ...
Implementation Suggestion
Change the server implementation so that it deletes messages after they are delivered to everyone involved.
We use the Identity Service API to build a service allowing ethereum key pair authentication
graph TB
subgraph sg0[Alice]
id0(Dapp)
id7[(Messages)]
end
id0 --> id9[Chain]
id0 --> id7
id0 --> id1[ENS Mail Homeserver]
id1 --> id5[ENS Mail Identity Server]
id4(Bob)
id4 --> id1
id1 -.- id2[Other Homeserver]
id1 --- id3[Bridges]
id2 -.-id6(Max)
id5 --> id9
classDef green fill:#9f6,stroke:#333
classDef orange fill:#f96,stroke:#333
class id0,id4,id6,id7,id8 green
class id1,id5 orange
Matrix Option 2
Same as Matrix Option 1 but we drop the idea that the user stores the messages in their sphere and let the messages on the homeserver.
graph TB
subgraph sg0[Alice]
id0(Dapp)
end
id0 --> id9[Chain]
id0 --> id1[ENS Mail Homeserver]
id1 --> id7[(Messages)]
id1 --> id5[ENS Mail Identity Server]
id4(Bob)
id4 --> id1
id1 -.- id2[Other Homeserver]
id1 --- id3[Bridges]
id2 -.-id6(Max)
id5 --> id9
classDef green fill:#9f6,stroke:#333
classDef orange fill:#f96,stroke:#333
class id0,id4,id6,id8 green
class id1,id5,id7 orange
Minimal Delivery Service Option
We take the current backend service and change the implementation so that messages are deleted after they are delivered. In a second step we can make it more decentral and support inter delivery service communication (like matrix). This means a user could run their own or use a third party delivery service by changing an ENS text record (possible text record name: eth.mail.home.service). The delivery service would forward messages to the target delivery service by looking up the ENS record and sending it to the registered service URL.
graph TB
subgraph sg0[Alice]
id0(Dapp)
id7[(Messages)]
end
id0 --> id9[Chain]
id0 --> id7
id0 --> id1[ENS Mail Home Delivery Service]
id4(Bob)
id4 --> id1
id1 -.- id2[Other Delivery Service]
id1 --- id3[Bridges]
id2 -.-id6(Max)
id1 --> id9
id2 --> id9
classDef green fill:#9f6,stroke:#333
classDef orange fill:#f96,stroke:#333
class id0,id4,id6,id7,id8 green
class id1,id5 orange
Drawbacks
Not an established protocol
Single point of failure: Default Delivery Service (user can still choose another one)
Benefits
No overhead (e.g. rooms, identity server)
Less complex => faster development
Note
For all the mentioned options we need to provide a server storing the messages until they are delivered. If we don't want this we need to use some kind of peer-to-peer solution which isn't a solution for our use case because this would require the user to be online all the time.
Suggestion
I slightly prefer using the minimal delivery service option because the current Matrix server implementations aren't a 100% fit for our needs and matrix comes with a lot of overhead. The minimal delivery service option should also be faster to implement. I still like the matrix protocol and we should consider using it in the future for example if we want to enable group chats. But also if we use Matrix in the future I think we need to write our own Matrix server implementation or we build a bridge between our service and Matrix.