DreamSpace is a full-stack web application designed for the secure distribution of high-value 3D assets. Unlike traditional file storage platforms, DreamSpace implements a Hybrid Cryptographic Architecture, ensuring that sensitive 3D models are encrypted at rest and can only be decrypted inside the authenticated user's browser session.
The defining feature of DreamSpace is its Secure Handshake & Delivery Protocol. Files are never directly downloaded in plain form; instead, they are streamed in an encrypted state and decrypted client-side.
- Upon successful login and OTP verification, the React frontend generates a fresh RSA-2048 key pair using the Web Crypto API.
- This key pair is unique to the current session.
- The public key is sent to the backend server.
- The private key remains only in the browser’s RAM and is never stored or transmitted.
- When a Creator uploads a 3D model, the server generates a unique AES-256 symmetric key for that file.
- The file is encrypted using this AES key before being stored.
- The AES key is encrypted using the Server’s RSA Public Key.
- The encrypted AES key is stored in MongoDB alongside the file metadata.
-
Even if the database or file storage is compromised:
- Attackers cannot decrypt the files.
- The AES keys are locked behind the server’s private key.
This is the core re-encryption mechanism that makes DreamSpace unique.
-
Request
- The authenticated user requests a file download.
-
Server Decryption
- The server uses its RSA Private Key to decrypt the stored AES file key.
-
Re-Encryption
- The AES key is immediately re-encrypted using the User’s Session Public Key.
-
Secure Transport
-
The server streams:
- The still-encrypted file
- The re-encrypted AES key
-
-
Client-Side Decryption
- The browser decrypts the AES key using the session private key.
- The AES key is used to decrypt the file in memory only.
- The decrypted file is then offered for download.
-
User passwords are never stored in plain text.
-
Passwords are hashed using Bcrypt (salt rounds = 10) during registration.
-
During login, the entered password is hashed and compared with the stored hash.
-
This protects against:
- Rainbow table attacks
- Database leaks
-
Each uploaded file generates a SHA-256 hash.
-
The hash is stored in the database.
-
Upon download, the hash is recomputed and verified to ensure:
- No tampering
- No corruption during encryption or storage
- React (Vite) – Fast and modern UI framework
- TypeScript – Strong typing for cryptographic logic
- Web Crypto API – Native, high-performance browser cryptography
- Tailwind CSS – Responsive and clean styling
- Axios – HTTP requests with interceptors
- Node.js & Express – RESTful API architecture
- MongoDB (Mongoose) – Flexible NoSQL metadata storage
- Node Crypto – Server-side cryptographic operations
- Multer – Secure multipart file uploads
- Bcrypt – Password hashing
- JWT – Stateless authentication
- Nodemailer – OTP-based two-factor authentication
- Node.js (v18+)
- MongoDB (Local or Atlas)
- Git
git clone https://github.com/yourusername/dreamspace.git
cd dreamspacecd backend
npm installCreate a .env file inside the backend folder:
MONGO_URI=mongodb://localhost:27017/dreamspace
JWT_SECRET=your_secret_jwt_key
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_specific_passwordFor Gmail, use an App Password, not your normal login password.
node utils/keys.jsEnsure private.pem and public.pem exist in:
backend/keys/
node seed/seedRoles.jsnode server.jsOpen a new terminal:
cd client
npm install
npm run dev- User – Browse, search, and securely download models
- Creator – Upload new 3D models and cover images
- Admin – Manage users and all uploaded assets
-
Register
- Create an account
- Receive OTP via email
-
Verify
- Enter OTP
- Secure session and key exchange established
-
Upload (Creator)
- Navigate to
/upload - Upload
.objor.zipfiles with cover images - Files are encrypted immediately
- Navigate to
-
Download (User)
- Browse models on the Home page
- Click Secure Download
- Client-side decryption occurs transparently
dreamspace/
├── backend/
│ ├── controllers/ # Auth & Model logic
│ ├── models/ # Mongoose Schemas (User, Model, RolePerm)
│ ├── routes/ # API endpoints
│ ├── storage/ # Encrypted files
│ └── server.js # Backend entry point
│
└── client/
├── src/
│ ├── api/ # Axios configuration
│ ├── components/# UI components
│ ├── context/ # AuthContext (Session keys in memory)
│ ├── pages/ # Home, Upload, Login
│ └── utils/ # Client-side cryptography
└── main.tsx