denetwork-chat-server
TypeScript icon, indicating that this package has built-in type declarations

1.0.59 • Public • Published

DeNetwork Chat

A total solution of decentralized chat that supports peer-to-peer private chat, multi-person group chat, and anonymous chat.

How it works

1. Security

1.1. Private Chat

Everyone knows the story of Alice and Bob. Yes, they use their two pairs of public and private keys for encryption. It's an asymmetric encryption algorithm, all messages are strongly encrypted on their devices using their private keys before being sent to each other over the network.

If you want to know more about this, please Google: Encryption with ECDH, AES-256.

1.2. Group Chat

Using a symmetric encryption algorithm, the encryption key is generated on the client when the room was created and is only stored on the user's device.

The cooler thing is that the creator can choose whether to set a separate password for each chat room.

When someone was invited to join a chat room, the symmetric encryption key will be sent to the new invitee by the inviter in an end-to-end manner. Once they agreed to join, the encryption key will be stored on the new invitee's device.

In other words, only the people in the chat room know the encryption key. The encryption key is exchanged end-to-end, without going through any servers.

Therefore, whether you are using one-on-one private chats or group chats with multiple participants, Metabeem decentralized chat system can guarantee the absolute security of all participants and the chat content throughout the entire lifecycle.

1.3. Throat limitation

1.3.1. For a single IP, gateway restriction policy

1.3.2. Limitation of message sending rate

1.3.3. Limitation of message body size

2. Privacy

2.1. User

Users are uniquely defined by their wallet address, which means that a wallet address is a user. If you know a person's wallet address, you can send him a direct message using DeNetwork Chat system.

2.2. Persistence

All messages are strongly encrypted by user's private key and retained on the relay server for 90 days.

Models

1. Join chat room

2. Leave chat room

3. New message

4. Pull messages

Process

1. Create chat room

on client-side

For the sake of security and privacy, the server does not participate in any operations or data in creating a chat room. The entire process of creating a chat room is completed by the clients. For details, please refer to: DeNetwork Chat Client

1. Invite someone to join a chat room

on client-side

2. Join chat room

on client-side

3. Leave chat room

4. Delete chat room

Creating and deleting chat rooms is the sole responsibility of the client. The server only saves the corresponding relationship between the room numbers and socket handles of these chat rooms.

5. Handle new messages

5.1. broadcast message

if the message has not been broadcast according to the bloom-filter
    broadcast the message
end if

5.2. save message to queue

//  serves client devices that are often offline and online
if the message does not exist in local queue according to the bloom-filter
    if the message does not exist in local queue
        push message to queue
    end if
end if

5.3. send message

if the message.room is in local rooms
    //  excluding sender
    send the message to everyone in the room
end if

5.4. done

6. Pull messages

Every chat message package of everyone will be synchronized to each relay in real time. The client pulls messages from the relay it is connected to by timestamp from the message queue.

Readme

Keywords

none

Package Sidebar

Install

npm i denetwork-chat-server

Weekly Downloads

53

Version

1.0.59

License

MIT

Unpacked Size

115 kB

Total Files

67

Last publish

Collaborators

  • dekuan