K9Crypt allows you to create and share encrypted messages.
Follow the steps below to set up K9Crypt:
- Node.js (>=12.x)
- MongoDB
- Clone the repository
git clone https://github.com/k9crypt/api.git
cd api
- Setup
.env
file
SECRET_KEY=ultra mega super secret key 101
DATABASE_URL=MONGODB_URI
- Install dependencies
npm install
- Start the server
node index.js
To create a room, send a POST request to the /room/create
endpoint with the userId, type (optional, default is 'public'), and password (required for private rooms) parameters in the request body. The response will contain the created room's ID.
To join a room, send a POST request to the /room/join
endpoint with the roomId, userId, and password (required for private rooms) parameters in the request body. The response will contain a message indicating the success of the join operation.
To leave a room, send a POST request to the /room/leave
endpoint with the roomId and userId parameters in the request body. The response will contain a message indicating the success of the leave operation.
To send a message to a room, send a POST request to the /room/message
endpoint with the roomId, userId, and message parameters in the request body. The response will contain a message indicating the success of the message sending operation.
To get the messages of a specific room, send a GET request to the /room/:roomId/messages
endpoint. The response will contain the decrypted messages of the room.
If an error occurs, the server will return an appropriate HTTP status code and error message in the response body.
Remember, messages are deleted every 2 hours.
If an error occurs, the server will return an appropriate HTTP status code and error message in the response body.
This project is licensed under the MIT License. See the LICENSE
file for more details.