Skip to content

DrivenPass is your newest password manager, where you can save data such as: credentials, networks, notes and cards

Notifications You must be signed in to change notification settings

thalesgomest/drivenpass-API

Repository files navigation

📑 Contents

📌 Project 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? There are several different ways to protect yourself. It all starts with using different and secure passwords. For a password to be security, it must contain several characters and numbers mixed in, not to mention that the longer it ii, etc. But how are we going to memorize giant passwords with no semantic meaning? It is to solve this pain that password managers were created! With them, we only create one “master” password and all other passwords kept secret! So when we need it, just remember the “master” password! DrivenPass is your newest password manager, where you can save data such as: credentials, networks, notes and cards

🚧 Status of work

status

✅ Features

  • Sign In and Sign Up account
  • Create/Get/Delete Credentials
  • Create/Get/Delete Notes
  • Create/Get/Delete Networks
  • Create/Get/Delete Bank Cards

📮 API Documentation

🔐Authentication

Sign Up

POST /auth/signup

Request:

Body Type Description
name string Required → user name
email string Required → user email
password string Required → user password
confirmPassword string Required → user password

Password length min(10)

Response:

{
    "message": "user created"
}

Sign In

POST /auth/signin

Request:

Body Type Description
name string Required → user name
email string Required → user email

Response:

{
    "token": "jasonwebtoken (JWT)"
}

👤 Credentials

Create a credential

POST /credentials/${userId}/create

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Body Type Description
url string Required → credential url
username string Required → user name
password string Required → credential password
title string Required → credential password

Response:

{
    "message": "credential created"
}

Get all credentials by userId

GET /credentials/${userId}

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "credentials": [
        {
            "id": 3,
            "url": "http://ultimate-certification.name",
            "username": "LorenzoFranco_Batista",
            "password": "v7GcM",
            "title": "Unifei",
            "createdAt": "2022-07-18T19:46:40.846Z",
            "userId": 2
        }
    ]
}

Get a specific credential by userId and credentialId

GET /credentials/${userId}/${credentialId}

Request:

Params Type Description
userId integer Required → user Id
credentialId integer Required → credential Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "credential": [
        {
            "id": 3,
            "url": "http://ultimate-certification.name",
            "username": "LorenzoFranco_Batista",
            "password": "v7GcM",
            "title": "Unifei",
            "createdAt": "2022-07-18T19:46:40.846Z",
            "userId": 2
        }
    ]
}

Delete a specific credential by credentialId

DELETE /credentials/${userId}/${credentialId}

Request:

Params Type Description
userId integer Required → user Id
credentialId integer Required → credential Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "message": "credential deleted"
}

📝 Secrete Notes

Create a note

POST /notes/${userId}/create

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Body Type Description
title string Required → note title
content string Required → note content

title length min(50) and max(1000)

Response:

{
    "message": "credential created"
}

Get all notes by userId

GET /notes/${userId}

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "notes": [
        {
            "id": 1,
            "title": "consequatur",
            "content": "Ratione suscipit nihil quia dolore sunt minima omnis.",
            "createdAt": "2022-07-18T13:02:20.263Z",
            "userId": 2
        }
    ]
}

Get a specific note by userId and noteId

GET /notes/${userId}/${noteId}

Request:

Params Type Description
userId integer Required → user Id
noteId integer Required → note Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "note": {
        "id": 1,
        "title": "consequatur",
        "content": "Ratione suscipit nihil quia dolore sunt minima omnis.",
        "createdAt": "2022-07-18T13:02:20.263Z",
        "userId": 2
    }
}

Delete a specific note by noteId

DELETE /notes/${userId}/${notesId}

Request:

Params Type Description
userId integer Required → user Id
noteId integer Required → note Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "message": "Note deleted"
}

💳 Cards

Create a card

POST /cards/${userId}/create

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Body Type Description
title string Required → card title
number string Required → card number
cardholderName string Required → card holder name
securityCode string Required → user card security code
expirationDate string Required → card expiration date
password string Required → card password
isVirtual boolean Required → card is virtual
type string Required → user type

Number Format: "1111 1111 1111 1111"

Expiration Date Format: "MM/YY"

Password length: 4 and only numeric characters

Security Code length: 3 and only numeric characters

Valid types: [credit, debit, both]

Response:

{
    "message": "card created"
}

Get all cards by userId

GET /cards/${userId}

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "cards": [
        {
            "id": 2,
            "title": "vel qui expedita",
            "number": "1089 8176 0498 7127",
            "cardholderName": "CARLA H SILVA",
            "securityCode": "206",
            "expirationDate": "07/27",
            "password": "4964",
            "isVirtual": false,
            "type": "both",
            "createdAt": "2022-07-18T13:03:16.959Z",
            "userId": 1
        }
    ]
}

Get a specific card by userId and cardId

GET /cards/${userId}/${cardId}

Request:

Params Type Description
userId integer Required → user Id
cardId integer Required → card Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "card": {
        "id": 1,
        "title": "sed doloribus qui",
        "number": "3650 3177 0788 8589",
        "cardholderName": "CARLA H SILVA",
        "securityCode": "682",
        "expirationDate": "07/27",
        "password": "1265",
        "isVirtual": false,
        "type": "both",
        "createdAt": "2022-07-18T13:03:01.120Z",
        "userId": 1
    }
}

Delete a specific card by cardId

DELETE /cards/${userId}/${cardId}

Request:

Params Type Description
userId integer Required → user Id
cardId integer Required → card Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "message": "card deleted"
}

📶 Networks

Create a network

POST /wifis/${userId}/create

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Body Type Description
title string Required → wifi title
name string Required → wifi name
password string Required → wifi password

Response:

{
    "message": "wifi created"
}

Get all wifis by userId

GET /wifis/${userId}

Request:

Params Type Description
userId integer Required → user Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "wifis": [
        {
            "id": 1,
            "title": "sit",
            "name": "possimus",
            "password": "xSxR7jefH4rZ3aB",
            "createdAt": "2022-07-18T13:03:46.190Z",
            "userId": 1
        }
    ]
}

Get a specific note by userId and wifiId

GET /wifis/${userId}/${wifiId}

Request:

Params Type Description
userId integer Required → user Id
wifiId integer Required → wifi Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "wifi": {
        "id": 1,
        "title": "sit",
        "name": "possimus",
        "password": "xSxR7jefH4rZ3aB",
        "createdAt": "2022-07-18T13:03:46.190Z",
        "userId": 1
    }
}

Delete a specific note by wifiId

DELETE /wifis/${userId}/${wifiId}

Request:

Params Type Description
userId integer Required → user Id
wifiId integer Required → wifi Id

Headers Type Description
Authentication string Required → token

Authorization format: Bearer jsonwebtoken

Response:

{
    "message": "Wifi deleted"
}

🔑 Environment Variables

To run this project, you will need to add the following environment variables to your .env file

DATABASE_URL = postgres://UserName:Password@Hostname:5432/DatabaseName

PORT = number #recommended:5000

JWT_SECRET = any string

CRYPTR_SECRET = any string

⚙️ How to run

# Clone this repoository
$ git clone https://github.com/thalesgomest/drivenpass-API.git

# Change to project directory
$ cd cd drivenpass-API

# Install all dependencies
$ npm install

# Start the server
$ npm run start

📚 Lessons Learned

In this project I learned a lot about how to structure an API with TypeScript and database with Prisma

🛠️ Build with

uses-postgresql uses-prisma uses-typescript uses-node uses-express built-with-heroku built-with-vsc

📫 Contact

About

DrivenPass is your newest password manager, where you can save data such as: credentials, networks, notes and cards

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published