Git Product home page Git Product logo

dm3-org / dm3 Goto Github PK

View Code? Open in Web Editor NEW
68.0 7.0 13.0 23.74 MB

The dm3 protocol | New standard of web3 messaging | Decentralized ENS-based registry | Secure end-to-end encryption | Easy dApp integration

Home Page: https://dm3.network

License: BSD 2-Clause "Simplified" License

HTML 0.16% CSS 1.61% TypeScript 97.74% JavaScript 0.24% Shell 0.16% Procfile 0.01% Dockerfile 0.02% Solidity 0.07%
decentralized messaging web3 ethereum encrypted pgp privacy scalable crosschain ens

dm3's People

Contributors

alexni245 avatar bhupesh-mfsi avatar bhupesh-ms avatar cjentzsch avatar hai-ko avatar karladler avatar malteish avatar steffenkux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dm3's Issues

UX improvements

  • Align connect and sign in buttons vertically
  • Put connect and sign in next to contact list
  • Add description to connect and sign in buttons
  • Make add account a form so that it can be submitted with enter
  • Change layout

Transport and storage

For the MVP, we store it on one of our servers, but in order to open it up and make it a true protocol, it needs more flexibility.

Options:
IPFS + Filecoin
Swarm
Matrix

Support user sphere message storage

Current

sequenceDiagram
    UI->>+BackendAPILib: getMessages()
    BackendAPILib->>+Backend: POST getMessages
    Backend-->>-BackendAPILib: Messages
    BackendAPILib-->>-UI: Messages

Goal

sequenceDiagram
    UI->>+MessagingHandler: getMessages()
    MessagingHandler->>+BackendAPILib: getNewMessages()
    BackendAPILib->>+DeliveryService: POST getMessages
    DeliveryService-->>-BackendAPILib: Messages
    Note right of MessagingHandler: "new" messages
    BackendAPILib-->>-MessagingHandler: Messages

    MessagingHandler->>MessagingHandler: decryptedMessages()

    MessagingHandler->>+StorageLib: storeMessages()
    StorageLib-->>-MessagingHandler: success

    MessagingHandler->>+StorageLib: getConversation()
    Note right of MessagingHandler: "new" + "old" messages
    StorageLib-->>-MessagingHandler: Messages
    MessagingHandler-->>-UI: Messages

Todo

  • Decide on storage framework
  • Implement messaging handler
  • Store outgoing messages

White Paper

  • Vision
  • Solution
  • Technical principles
  • Way to adoption
  • Token?

Create ReadMe

  • vision / the problem it solves
  • describe functionality
  • technical solution

Decide on message delivery options

Idea

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).

Options

Matrix Option 1

Matrix Architecture

https://github.com/matrix-org/synapse/#id2

client <----> homeserver <=====================> homeserver <----> client
       https://somewhere.org/_matrix      https://elsewhere.net/_matrix

"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

  1. Change the server implementation so that it deletes messages after they are delivered to everyone involved.
  2. 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.

Send encrypted messages

Lib

  • send()
    • getSecurityMode() Returns "best" security / encryption mode (sign or X25519_XSalsa20_Poly1305)
    • getEncryptionPubKey()
    • encrypt() encrypts the message itself but not the metadata
    • signEnvelop() necessary so that the message storage / transport service can verify the sender
    • send()

Create Bubble App

Functionality:

  • Write mail
  • Send signed mail
  • Encrypt mail with public key of receiver
  • read mail
  • decrypt mail
  • simple mailbox
  • connect with Metamask

Persistence sync state

  • Get persistence sync state
  • Sync state view
  • "Not synced" warning if browser is about to close

Receive signed messages

Front end

  • Fetch new messages
  • Show signature verified indicator

Lib

  • getMessages
    • check signatures of received messages

Backend

  • POST getMessages
  • POST -> WS sendMessage

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.