Skip to content

tjdragon/nilchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Nillion Chat Web App

NilChat / Nillion Network

NCWA (Nillion Chat Web App) uses the Nillion network to store messages in a peer-to-peer fashion. Think of NCWA as a WhatsApp or Signal or Telegram, but in a peer-to-peer way without the reliance of a central server or authority.

The goal is to develop a light web client for NCWA, equivalent to WhatsApp Web (https://web.whatsapp.com/)

The idea is to develop a quick PoC to showcase the capability, not to develop a production-ready app for millions of users.

Backend Endpoints

See chat_app_server.py

Account creation

POST /create-account
Associates an email address with a backend generated user key (note we can get the user id from the user key). This association is done once.

Get the current user id

GET /account
Retrieves the current user id to be displayed

Returns true if the email exists in the system

GET /email
Checks if an email is registered - so that we can store a message for that user

Stores a message for a given user

POST /message
Stores a message for a given user email Associates in the backend the target user email, alongside the store message id

Lists all messages for a given user

GET /messages
Reads all messages from a given user id This goes through the list of stored messages ids and read them from the network and return them

SQL

CREATE TABLE NilAccount (
    user_email varchar(255),
    user_key varchar(255),
    user_id varchar(255),
    PRIMARY KEY (user_email)
);

CREATE TABLE NilMessage (
    from_user_email varchar(255),
    to_user_email varchar(255),
    store_id varchar(255),
    read boolean default false,
    PRIMARY KEY (from_user_email, to_user_email, store_id)
);

NilAccount stores on-off data post registration - i.e., first time the user logs in. user_key, node_key and user_id are generated by gen_user_keys.

NilMessage stores all messages via the store_ids.

About

NilChat / Nillion Network

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages