This API is built with the NestJS framework and utilized MongoDB as a database.
- Modify .env.example to
.envand alter the contents with the relevant data. - Run
npm installto install relevant node modules - Run
npm startto start the API
You will find documentation about the API's endpoints and their supported methods, required data for requests, and format of responses.
- Description: Allows a user to sign up and create a new account.
- Method:
POST - Request Body:
{ "name": "user", "password": "epicpassword", "email": "admin@cyberwright.org" } - Response:
{ "access_token": "JWT_TOKEN" }
- Description: Allows a user to log in to an existing account.
- Method:
POST - Request Body:
{ "password": "epicpassword", "email": "admin@cyberwright.org" } - Response:
{ "access_token": "JWT_TOKEN" }
- Description: Endpoint to check if a JWT token is valid or not
- Method:
GET - Response:
{ "valid": true }
- Description: Endpoint to recieve Google callback code and exchange for an access token
- Method:
POST - Request Body:
{ "code": "[google code]", "redirect_uri": "http://localhost:12345/" } - Response:
{ "access_token": "JWT_TOKEN" }
All requests to this endpoint require an access token attached as a Bearer token in the Authorization header.
- Description: Returns an authorized user's account information (name, email, profile picture, etc.).
- Method:
GET - Response:
{ "name": "user", "email": "admin@cyberwright.org", "pfp": "https://pfp" }
- Description: Allows a user to change their password.
- Method:
POST - Request Body:
{ "new_password": "epicpassword" } - Response:
{ "changed": true }
- Description: Allows a user to check if their account is disabled.
- Method:
GET - Response:
{ "disabled": true }
All requests to this endpoint require an access token attached as a Bearer token in the Authorization header.
- Description: Allows a user to initiate an upload session and obtain an upload id.
- Method:
POST - Request Body:
{ "dir_name": "test", "num_files": 3 } - Response:
{ "uid": "UUID" }
- Description: Allows a user to upload files to the associated upload ID.
- Method:
POST - Request Body:
(Form data)
uid=Upload ID file=@test.txt - Response:
{ "uploaded": true }
- Description: Allows a user to scan the uploaded files.
- Method:
POST - Request Body:
{ "uid": "Upload ID", } - Response:
{ "diagnostics": [] }
- Description: Allows a user to check and obtain their upload's diagnostics
- Method:
POST - Request Body:
{ "uid": "Upload ID", } - Response:
{ "status": "Some status message", "diagnostics": [] || null }