Skip to content

About

API do DrivenPass, um gerenciador de senhas desenvolvido com TypeScript, Node.js, Express e PostgreSQL.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

projeto19-drivenpass

DrivenPass API, a password manager built with TypeScript, Node.js, Express, Prisma and Postgres.

DrivenPass

Built With


Description

DrivenPass is the API of a password manager.


Features

  • Create account;
  • Access an account;
  • Create credential;
  • Search credentials;
  • Delete credential;
  • Create safe note;
  • Search safe notes;
  • Delete safe note;
  • Create card;
  • Search cards;
  • Delete card;
  • Create a wi-fi log;
  • Search wi-fi logs;
  • Delete a wi-fi log.

API Reference

Create account

POST /sign-up

Request:

Body Type Description
email string Required. User mail.
password string Required. User password.

Password must be at least 10 characters

Access an account

POST /sign-in

Request:

Body Type Description
email string Required. User mail
password string Required. User password

Password must be at least 10 characters

Response:

{
  "token": 11111111111
}

Create credential

POST /credentials

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Body Type Description
title string Required. Credential name.
url string Required. Valid url.
username string Required. Username.
password string Required. Password.

Cannot create two different credentials with the same title

Response:

{
  "id": 1,
  "title": "Credential name",
  "url": "url",
  "username": "username",
  "password": "password",
  "userId": 1
}

Search credentials

GET /credentials

To search all user credentials

OR

GET /credentials?credentialId={id}

To search a specific credential

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Response:

If search all user credentials:

[
  {
    "id": 1,
    "title": "Credential name",
    "url": "url",
    "username": "username",
    "password": "password",
    "userId": 1
  },
  {
    ...
  }
]

OR

If search a specific credential:

{
    "id": 1,
    "title": "Credential name",
    "url": "url",
    "username": "username",
    "password": "password",
    "userId": 1
}

Delete credential

DELETE /credentials/${credentialId}

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Create safe note

POST /notes

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Body Type Description
title string Required. Note name.
note string Required. Note.

Title cannot be longer than 50 characters

The annotation no longer than 1000 characters

Cannot create two different annotations with the same title

Response:

{
  "id": 1,
  "title": "Annotation name",
  "note": "My annotation",
  "userId": 1
}

Search credentials

GET /notes

To search all user notes

OR

GET /notes?noteId={id}

To search a specific note

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Response:

If search all user notes:

[
  {
    "id": 1,
    "title": "Annotation name",
    "note": "My annotation",
    "userId": 1
  },
  {
    ...
  }
]

OR

If search a specific note:

{
    "id": 1,
    "title": "Annotation name",
    "note": "My annotation",
    "userId": 1
}

Delete note

DELETE /notes/${noteId}

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Create card

POST /cards

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Body Type Description
title string Required. Name given to the card.
cardNumber string Required. Card number.
cardholderName string Required. Card name.
securityCode string Required. Card security code.
expirationDate string Required. Card expiration date.
password string Required. Card password.
isVirtual boolean Required. Whether the card is virtual or not.
type string Required. Card type.

The card can only be of the following types: credit, debit, credit_debit

Cannot create two different cards with the same title

Response:

{
  "id": 1,
  "title": "Name given to the card",
  "cardNumber": "1111111111111111",
  "cardholderName": "MY NAME",
  "securityCode": "111",
  "expirationDate": "DD/MM",
  "password": "My password",
  "isVirtual": false,
  "type": "credit",
  "userId": 1
}

Search cards

GET /cards

To search all user cards

OR

GET /cards?cardId={id}

To search a specific card

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Response:

If search all user cards:

[
  {
    "id": 1,
    "title": "Name given to the card",
    "cardNumber": "1111111111111111",
    "cardholderName": "MY NAME",
    "securityCode": "111",
    "expirationDate": "DD/MM",
    "password": "My password",
    "isVirtual": false,
    "type": "credit",
    "userId": 1
  },
  {
    ...
  }
]

OR

If search a specific card:

{
  "id": 1,
  "title": "Name given to the card",
  "cardNumber": "1111111111111111",
  "cardholderName": "MY NAME",
  "securityCode": "111",
  "expirationDate": "DD/MM",
  "password": "My password",
  "isVirtual": false,
  "type": "credit",
  "userId": 1
}

Delete card

DELETE /cards/${cardId}

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Create a wi-fi log

POST /wi-fi

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Body Type Description
title string Required. Name given to the wi-fi network record.
networkName string Required. Network name.
password string Required. Wi-fi password.

Response:

{
  "id": 1,
  "title": "Name given to the wi-fi network record",
  "networkName": "Network name",
  "password": "My password",
  "userId": 1
}

Search wi-fi logs

GET /wi-fi

To search all user wi-fi

OR

GET /wi-fi?wifiId={id}

To search a specific wi-fi

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Response:

If search all user wi-fi:

[
  {
    "id": 1,
    "title": "Name given to the wi-fi network record",
    "networkName": "Network name",
    "password": "My password",
    "userId": 1
  },
  {
    ...
  }
]

OR

If search a specific wi-fi:

{
  "id": 1,
  "title": "Name given to the wi-fi network record",
  "networkName": "Network name",
  "password": "My password",
  "userId": 1
}

Delete a wi-fi log

DELETE /wi-fi/${wifiId}

Request:

Headers Type Description
Authorization string Required. User token.

The Authorization field must have the following format: Bearer ${token}

Environment Variables

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

PORT = number Recommended:5000

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

JWT_SECRET = any string

CRYPTR_SECRET = any string


Run Locally

Clone the project

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

Go to the project directory

  cd projeto19-drivenpass/

Install dependencies

  npm install

Start the server

  npm run start

The API deploy link is: https://back-projeto19-drivenpass.herokuapp.com/

About

API do DrivenPass, um gerenciador de senhas desenvolvido com TypeScript, Node.js, Express e PostgreSQL.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages