Skip to content

Aarav-S2005/PrivatePages

Repository files navigation

PrivatePages

End-to-end encrypted journaling app with a zero-knowledge server. Only the user can read their journal entries.


Features

  • End-To-End Encrypted (e2ee) all journal entries are e2ee on the client side before sent to server
  • Zero-Knowledge Server The server never see your plain text, passkey or your master key
  • Date based journaling All journals are indexed by date, you may revisit your entries via calendar

Tech Stack

Frontend

  • NextJS app router
  • TailwindCSS
  • TipTap Editor
  • ReactBits Components

Backend

  • NextJS api routes
  • MongoDB

Cryptography

  • Web Crypto API
  • AES-GCM for encrypting journals
  • PBKDF2 for key derivation from passkey

How encryption works?

  1. User signs up with username, password, and a passkey.
  2. A master key is randomly generated on the client side.
  3. KEK (key encryption key) is derived from the user's passkey.
  4. The master key is encrypted using KEK and stored on the server.
  5. Server now knows about:
    • Encrypted master key
    • master key IV
    • Salt
    • iterations
  6. On login the encrypted master key is decrypted on client side using user's passkey.
  7. All journal entries are encrypted and decrypted using master key.

Security Note

The master key is not by any chance recoverable. Therefore store your passkey in a safe location. Losing passkey will result in losing access to your data.


Local Setup

git clone "https://github.com/Aarav-S2005/PrivatePages.git"

cd PrivatePages
pnpm install
pnpm dev

Setup environment variables

  • create a .env.local file in root folder
  • fill up the following
MONGO_URI=mongodb://localhost:27017/  
JWT_SECRET=<JWT SECRET>
FRONTEND_URL=http://localhost:3000/  
NEXT_PUBLIC_API_URL=http://localhost:3000/api  
EMAIL_USER=<YOUR EMAIL> 
EMAIL_PASS=<YOUR EMAIL APP PASSWORD (DO NOT PASTE YOUR ACTUAL GMAIL PASSWORD)>

About

End-to-end encrypted journaling app with a zero-knowledge server. Only the user can read their journal entries.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages