Driven Pass API

๐Ÿ“‹ Description

Browsing the internet can be a very fun activity, but at the same time, very dangerous. Numerous studies and surveys (national and international) show that the number of virtual scams continues to grow. Which raises the question: how to protect ourselves? This API allows you to securely store your credit card information, websites, wifi credentials, notes and more.


๐Ÿ’ป Technologies and concepts

  • REST APIs
  • JWTs & refresh tokens
  • Node.js
  • TypeScript
  • ORM
  • SQL

๐Ÿš€ Routes

๐Ÿ  Authentication

POST /signup
    - Route to register a new user
    - headers: {}
    - body:{
        "email": "lorem@loremipsum.com",
        "senha": "loremipsum"
}
POST /signin
    - Route to sign in 
    - headers: {}
    - body: {
    "email": "lorem@loremipsum.com",
    "password": "loremipsum"
    }

๐ŸŒ Website credentials

POST /credential (authenticated)
    - Route to create a credential
    - headers: { "Authorization": "Bearer $token" }
    - body: {
    "email": "ipsum@dolor.set",
    "password": "ipsumlorem",
    "title": "My beautiful instagram credentials",
    "url": "https://instagram.com/
    }
GET /credential/:credentialId (authenticated)
    - Get specific credential of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
GET /credential/= (authenticated)
    - Get all credentials of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
DELETE /credential/:credentialId (authenticated)
    - Delete specific credential of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}

๐Ÿ“ถ Wi-fi credentials

POST /wifi (authenticated)
    - Route to create a wi-fi credential
    - headers: { "Authorization": "Bearer $token" }
    - body: {
    "ssid": "Pergasus",
    "password": "ipsumlorem",
    "title": "Personal hotspot"
    }
GET /wifi/:wifiId (authenticated)
    - Get specific wi-fi credential of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
GET /wifi/= (authenticated)
    - Get all wi-fi credentials of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
DELETE /wifi/:wifiId (authenticated)
    - Delete specific wi-fi credential of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}

๐Ÿ—’๏ธ Safe notes

POST /safenote (authenticated)
    - Route to create a safe note
    - headers: { "Authorization": "Bearer $token" }
    - body: {
    "title": "My lovely secret",
    "content": "Lorem ipsum dolor set"
    }
GET /safenote/:safenoteId (authenticated)
    - Get specific safe note of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
GET /safenote/= (authenticated)
    - Get all safe notes of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
DELETE /safenote/:safenoteId (authenticated)
    - Delete safe note credential of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}

๐Ÿ’ณ Credit card credentials

POST /credit-card (authenticated)
    - Route to create a safe note
    - headers: { "Authorization": "Bearer $token" }
    - body: {
    "name": "Coleman R C Gallant",
     "number": "1494-2313-1244-11",
     "expiry": "07/2030",
     "cvv": 289,
     "password": 1984,
     "isVirtual": false,
     "type": "Credit",
     "title": "My purple MasterCard CC"
}
GET /credit-card/:creditCardId (authenticated)
    - Get specific credit card of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
GET /credit-card/= (authenticated)
    - Get all credit cards of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}
DELETE /credit-card/:creditCardId (authenticated)
    - Delete credit card credentials of an authenticated user
    - headers: { "Authorization": "Bearer $token" }
    - body: {}

๐Ÿ Running the aplication

This project was initialized with Create React App, so make sure you have the latest stable version of [Node.js](https:/ /nodejs.org/en/download/) and npm running locally.

โคต๏ธ Clone this repository on your machine:

git clone https://github.com/f7lipe/projeto19-drivenpass

โš™๏ธ Create a .env file in the root of your project folder and configute it to look something like this

   PORT = 5000
   DATABASE_URL = postgres://postgres:password6@database_url/database_name
   MODE = DEV
   JWT_SECRET = "secret"
   CRYPT_KEY = "secret"

๐Ÿ’ป Inside the folder, run the following command to install the dependencies.

npm install

๐Ÿ—ƒ๏ธ Build the database

npx prisma db push

๐Ÿ Finished the process, just start the server

npm run dev

โš ๏ธ If your .env file is set to MODE = DEV all creation routes will return an object with the information entered into the database

๐Ÿ”ฅ Hot tip

If you are using Thunder Client, import the thunder_client_template.json to your Thunder Client extension and enjoy the benefits of all routes already configured.