AtHeartEngineer 480a95ffbe Added Rate Commitment hasher (#46)
Anywhere we are adding/accessing an identity commitment, we need to
replace it with the hash of the identityCommitment and the
userMessageLimit together.

Here is how to use the hasher I added:
```ts
getRateCommitmentHash(
  BigInt(identityCommitment),
  BigInt(room.userMessageLimit ? room.userMessageLimit : 1)
).toString()
```

We need to add this to `addIdentityToIdentityListRooms` and
`addIdentityToBandadaRooms` when users join.

We also need to add this to the `/rooms/:idc` route, where we have to
hash the idc with every rooms `userMessageLimit` to see what rooms they
are in. (OR we can make another database model to map identity
commitments to rooms, this is probably smarter and would prevent someone
from trying to DDOS our server just by requesting what rooms they are
in, hashing takes a decent bit of CPU when you do it a lot).
2023-08-23 19:53:48 -04:00
2023-08-03 15:18:17 -04:00
2023-08-23 19:53:46 -04:00
2023-07-12 00:30:44 -04:00
2023-08-04 13:53:35 -04:00
2023-07-12 00:30:44 -04:00
2023-08-22 14:15:38 -04:00
2023-07-12 14:51:32 -04:00



Discreetly is an anonymous, gated, chat application. Under the hood it uses a multiple zero-knowledge protocols such as RLN (Rate-Limiting Nullifier) to rate limit messages and Semaphore for identity management and group membership.



📖 Contents


📚 Technologies

Semaphore

Semaphore Identities are the core of Rate Limiting Nullifiers (RLN), CryptKeeper, and Bandada, providing support for anonymous signalling and experimental voting mechanisms within each chat room.

RLNjs

Rate Limiting Nullifier (RLN) is used to control the frequency of user interactions, thereby providing a robust mechanism to prevent spam.

Bandada

Bandada is employed for the management of user and group interactions within Semaphore Identity Commitments.

Express.js

MongoDB

Prisma

SocketIO


📖 Getting started

See the frontend to set that up as well

Install dependencies

npm i

Set environment variables given in the .env.example

PASSWORD= //password for admin endpoints
NODE_ENV= //development
DATABASE_URL= //MongoDB Atlas URL
DATABASE_URL_TEST= //MongoDB Atlas URL same as above or a seperate cluster for testing

Initialize Prisma

npx prisma db init && npx prisma db push

Run the server

npm run dev

Server information and endpoints will display in the console in development mode

Running tests

npm run test

🔩 Usage

Endpoint Expected Response
[ '/', '/api' ]
Status: 200 OK
{ "id": "0", "name": "localhost", "version": "0.0.2" }
[ '/rooms/:idc', '/api/rooms/:idc' ]
Status: 200 OK
[ "" ]
[ '/room/:id', '/api/room/:id' ]
Status: 200 OK
{ "roomId": "", "name": "", "rateLimit": , "userMessageLimit": }
[ '/join', '/api/join' ]
Status: 200 OK
{ "status": "valid", "roomIds": [], }

Style Guide

  • Single Quotes
Description
No description provided
Readme 1.3 MiB
Languages
TypeScript 99.6%
JavaScript 0.4%