Skip to content

celsobenedetti/19-DrivenPass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Password and encryption manager


TypeScript Vue.js SASS

Node.js Express.js Prisma Postgres

Summary

  • The purpose of the app is to store sensitive data, like online account credentials, secure notes, document numbers, etc
  • The data is server-side encrypted and decrypted via the API
  • The supported item models are:
    • Credentials - username, password and url for a website
    • Notes - simple encrypted text notes
    • Cards - credit or debit card information
    • Wifi - wifi network name and password
    • Documents - personal document numbers

What I Learned

  • The fundamentals of Vue 3

  • Composition API, setup function, refs and reactivity, events

  • Slots and templates, provide/inject, suspense API, dynamic routing

  • More Prisma data modeling features

  • Issues of response and error handling consistency when scaling an API 🥲

🚀 Routes

  • The default responses are:
    • 200 - Successful GET request
    • 201 - Successful POST request
    • 204 - Successful DELETE request
    • 401 - Auth errors
    • 404 - Resource not found
    • 409 - Resource conflict on POST requests
    • 422 - Body validation error on POST requests

Auth

POST /signup
    - Route for creating a new user
    - body:{
        "email": "jon@doe.com",
        "password": "DonJoe27"
      }
    - response: {"token": "JWT_TOKEN"}
POST /signin
    - Route for signing an existing user
    - body:{
        "email": "jon@doe.com",
        "password": "DonJoe27"
    }
    - Response: {"token": JWT_TOKEN}
POST /auth/check
    - Route for validating cached jwt tokens
    - headers: {"Authorization": "Bearer TOKEN"}

Credentials

POST /credentials
    - Route for creating new encrypted credential
    - headers: {"Authorization": "Bearer TOKEN"}
    - body: {
        "title": "Website account",
        "email": "jon@doe.com",
        "password": "DonJoe27",
        "url": "http://website.com"
    }
GET /credentials
    - Route for finding all user credentials
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: array of credentials
GET /credentials/:id
    - Route for finding one user credential
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: credential
DELETE /credentials/:id
    - Route for deleting one user credential
    - headers: {"Authorization": "Bearer TOKEN"}

Notes

POST /notes
    - Route for creating new encrypted note
    - headers: {"Authorization": "Bearer TOKEN"}
    - body: {
        "title": "My important note",
        "content": "Important things to store",
    }
GET /notes
    - Route for finding all user notes
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: array of notes
GET /notes/:id
    - Route for finding one user note
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: note
DELETE /notes/:id
    - Route for deleting one user note
    - headers: {"Authorization": "Bearer TOKEN"}

Cards

POST /cards
    - Route for creating new encrypted card
    - headers: {"Authorization": "Bearer TOKEN"}
    - body: {
        "title": "Mustercard credit",
        "number": "1234 5678 8765 4321",
        "cardholderName": "Jon Doe Full Name Jr",
        "securityCode": "123",
        "expirationDate": "07/28",
        "password": "1234",
        "type": "CREDIT | DEBIT"
    }
GET /cards
    - Route for finding all user cards
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: array of cards
GET /cards/:id
    - Route for finding one user card
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: card
DELETE /cards/:id
    - Route for deleting one user card
    - headers: {"Authorization": "Bearer TOKEN"}

Wifi

POST /wifi
    - Route for creating new encrypted wifi
    - headers: {"Authorization": "Bearer TOKEN"}
    - body: {
        "title": "Home network",
        "network": "network2.4",
        "password": "password123",
    }
GET /wifi
    - Route for finding all user wifi
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: array of wifi
GET /wifi/:id
    - Route for finding one user wifi
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: wifi
DELETE /wifi/:id
    - Route for deleting one user wifi
    - headers: {"Authorization": "Bearer TOKEN"}

Documents

POST /docs
    - Route for creating new encrypted documents
    - headers: {"Authorization": "Bearer TOKEN"}
    - body: {
        "title": "Home network",
        "network": "network2.4",
        "password": "password123",
    }
GET /docs
    - Route for finding all user documents
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: array of docs
GET /docs/:id
    - Route for finding one user documents
    - headers: {"Authorization": "Bearer TOKEN"}
    - Response: document
DELETE /docs/:id
    - Route for deleting one user documents
    - headers: {"Authorization": "Bearer TOKEN"}