vaultfs 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,298 +1,205 @@
1
- # VaultFS — Secure File System Simulator
1
+ <div align="center">
2
2
 
3
- A CLI-based file system simulator built entirely in **Core Java** with real **OAuth 2.0 authentication** (Google & GitHub), a built-in **React login frontend**, and advanced **data structure implementations** — Stack, Queue, BST, HashMap, LinkedList, Graphs, and Sorting.
3
+ # 🔐 VaultFS
4
4
 
5
- ---
6
-
7
- ## One-Line Install
5
+ [![npm version](https://img.shields.io/npm/v/vaultfs?color=green&label=npm)](https://www.npmjs.com/package/vaultfs)
6
+ [![npm downloads](https://img.shields.io/npm/dm/vaultfs?color=blue)](https://www.npmjs.com/package/vaultfs)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![Node.js](https://img.shields.io/badge/Node.js-18%2B-brightgreen)](https://nodejs.org)
9
+ [![Java](https://img.shields.io/badge/Java-11%2B-orange)](https://adoptium.net)
10
+ [![Auth Server](https://img.shields.io/badge/Auth%20Server-Live%20on%20Render-purple)](https://vaultfs-auth-server.onrender.com)
8
11
 
9
- ### Recommended (all platforms)
12
+ **A CLI-based secure file system simulator built in Core Java**
13
+ **with real OAuth 2.0 authentication and 9 advanced data structures**
10
14
 
11
- ```bash
12
- npm install -g vaultfs
13
- ```
15
+ [Install](#-install) • [Usage](#-usage) • [Architecture](#-architecture) • [Data Structures](#-data-structures) • [Commands](#-commands)
14
16
 
15
- Then just type `vaultfs` — that's it.
17
+ </div>
16
18
 
17
19
  ---
18
20
 
19
- ### Manual Install (no npm)
20
-
21
- > No package manager required. The installer handles everything.
22
-
23
- **macOS / Linux / WSL:**
21
+ ## Install
24
22
 
25
23
  ```bash
26
- curl -fsSL https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/install.sh | bash
27
- ```
28
-
29
- **Windows (Command Prompt):**
30
-
31
- ```
32
- curl -fsSL https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/install.bat -o install.bat && install.bat
33
- ```
34
-
35
- **Uninstall:**
36
-
37
- ```bash
38
- curl -fsSL https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/uninstall.sh | bash
24
+ npm install -g vaultfs
39
25
  ```
40
-
41
- **Upgrade:**
42
-
26
+ Then just type:
43
27
  ```bash
44
- # Re-run the installer — it will detect existing install and offer upgrade
45
- curl -fsSL https://raw.githubusercontent.com/ThreatGuardian/vaultfs-core/main/install.sh | bash
28
+ vaultfs
46
29
  ```
30
+ > Requires Java 11+ and Node.js 18+
47
31
 
48
32
  ---
49
33
 
50
- ## Quick Start
51
-
52
- ### Prerequisites
34
+ ## 🏗 Architecture
53
35
 
54
- - **Java 11+**
55
- - **Node.js 18+** (only needed once, to build the frontend)
56
-
57
- ### 1. Clone the Repository
58
-
59
- ```bash
60
- git clone https://github.com/ThreatGuardian/vaultfs-core.git
61
- cd vaultfs-core
62
36
  ```
63
-
64
- ### 2. Set Up Environment Variables (Optional)
65
-
66
- The project uses a `.env` file for OAuth and Firestore credentials. **This file is gitignored for security.**
67
-
68
- ```bash
69
- cp .env.example .env
37
+ ┌─────────────────────────────────────────────────────┐
38
+ │ User's Machine │
39
+ │ │
40
+ │ npm install -g vaultfs │
41
+ │ ↓ │
42
+ │ vaultfs (Node.js launcher) │
43
+ │ ↓ │
44
+ │ java -cp ~/.vaultfs/out Main │
45
+ │ ↓ │
46
+ │ Opens browser ──────────────────────────────┐ │
47
+ └───────────────────────────────────────────────│─────┘
48
+
49
+
50
+ ┌─────────────────────────────────────────────────────┐
51
+ │ Render Cloud (Auth Server) │
52
+ │ │
53
+ │ vaultfs-auth-server.onrender.com │
54
+ │ ↓ │
55
+ │ /auth/login → Google or GitHub OAuth │
56
+ │ ↓ │
57
+ │ Credentials NEVER leave this server │
58
+ │ ↓ │
59
+ │ /auth/poll → sends token back to CLI │
60
+ └─────────────────────────────────────────────────────┘
61
+
62
+
63
+ ┌─────────────────────────────────────────────────────┐
64
+ │ User's Terminal │
65
+ │ │
66
+ │ ✅ Logged in as John (google) │
67
+ │ Welcome back, John! │
68
+ │ │
69
+ │ ~/.vaultfs> _ │
70
+ └─────────────────────────────────────────────────────┘
70
71
  ```
71
72
 
72
- > **Without a `.env` file, the app still runs perfectly** — you'll just log in as a Guest. OAuth (Google/GitHub) login requires valid credentials in `.env`.
73
-
74
- ### 3. Build the Frontend
75
-
76
- The frontend uses Firebase for Google sign-in. Create its own `.env` file:
77
-
78
- ```bash
79
- cd frontend
80
- cp .env.example .env
81
- # Fill in your Firebase project config from https://console.firebase.google.com
82
- npm install
83
- npm run build
84
- cd ..
85
- ```
86
-
87
- ### 4. Compile & Run
88
-
89
- ```bash
90
- # Compile all Java sources
91
- javac -d out src/models/*.java src/datastructures/*.java src/utils/*.java src/auth/*.java src/sync/*.java src/filesystem/*.java src/Main.java
92
-
93
- # Run
94
- java -cp out Main
95
- ```
96
-
97
- The app will open a browser for login. Choose **Google**, **GitHub**, or **Continue as Guest**.
98
-
99
73
  ---
100
74
 
101
- ## Setting Up OAuth (Optional)
102
-
103
- If you want Google/GitHub login instead of Guest mode, follow these steps.
104
-
105
- ### Google OAuth Setup
106
-
107
- 1. Go to [Google Cloud Console → Credentials](https://console.cloud.google.com/apis/credentials)
108
- 2. Click **Create Credentials** → **OAuth client ID**
109
- 3. Select **Web application** as the type
110
- 4. Under **Authorized redirect URIs**, add:
111
- ```
112
- http://localhost:9000/callback/google
113
- ```
114
- 5. Click **Create** and copy the **Client ID** and **Client Secret**
115
- 6. Paste them into your `.env` file:
116
- ```env
117
- GOOGLE_CLIENT_ID=your-client-id-here.apps.googleusercontent.com
118
- GOOGLE_CLIENT_SECRET=your-client-secret-here
119
- ```
120
-
121
- ### GitHub OAuth Setup
122
-
123
- 1. Go to [GitHub → Developer Settings → OAuth Apps](https://github.com/settings/developers)
124
- 2. Click **New OAuth App**
125
- 3. Fill in:
126
- - **Application name:** `VaultFS`
127
- - **Homepage URL:** `http://localhost:9000`
128
- - **Authorization callback URL:** `http://localhost:9000/callback/github`
129
- 4. Click **Register application**
130
- 5. Copy the **Client ID**, then click **Generate a new client secret** and copy it
131
- 6. Paste them into your `.env` file:
132
- ```env
133
- GITHUB_CLIENT_ID=your-client-id-here
134
- GITHUB_CLIENT_SECRET=your-client-secret-here
135
- ```
136
-
137
- After saving `.env`, restart the app and the Google/GitHub buttons will work.
75
+ ## 🔐 Authentication
138
76
 
139
- ---
77
+ VaultFS uses a **centralized auth server** deployed on Render.
78
+ Your OAuth credentials never touch the user's machine.
140
79
 
141
- ## Data Structures Used
80
+ | Provider | Status |
81
+ |---|---|
82
+ | Google OAuth 2.0 | ✅ Live |
83
+ | GitHub OAuth | ✅ Live |
84
+ | Guest Mode | ✅ No setup needed |
142
85
 
143
- | Data Structure | Feature | Concept |
144
- |---|---|---|
145
- | **Stack** | `cd -` (go back to previous directory) | LIFO directory history |
146
- | **Queue** | `mkdir a ; cd a ; create f.txt` (chained commands) | FIFO command buffer |
147
- | **Binary Search Tree** | `find <filename>` (global search) | O(log n) name lookup |
148
- | **HashMap** | `cd /deep/absolute/path` (instant jump) | O(1) path resolution |
149
- | **Sorting (Merge/Quick)** | `ls -size`, `ls -name`, `ls -date` | Custom comparator sorting |
150
- | **Graph + HashSet** | `ln -s <target> <link>` (symlinks) | Directed graph + cycle detection |
151
- | **LinkedList + Array** | `info <file>` (shows disk blocks) | File fragmentation simulation |
152
- | **N-ary Tree** | Directory hierarchy | Parent-child file system |
153
- | **MaxHeap** | `topk <k> <path>` | Top-k largest files |
86
+ Auth server: https://vaultfs-auth-server.onrender.com
154
87
 
155
88
  ---
156
89
 
157
- ## CLI Tool Commands
90
+ ## 🧠 Data Structures
158
91
 
159
- | Command | Description |
160
- |---|---|
161
- | `vaultfs` | Launch VaultFS |
162
- | `vaultfs --version` | Show installed version |
163
- | `vaultfs update` | Pull latest and rebuild automatically |
164
- | `vaultfs doctor` | Health check diagnoses install issues |
165
- | `vaultfs uninstall` | *coming soon* |
92
+ | Data Structure | Feature | Complexity |
93
+ |---|---|---|
94
+ | **Stack** | `cd -` directory history | O(1) |
95
+ | **Queue** | Chained commands with `;` | O(1) |
96
+ | **Binary Search Tree** | `find <filename>` global search | O(log n) |
97
+ | **HashMap** | `cd /deep/path` instant jump | O(1) |
98
+ | **Merge/Quick Sort** | `ls -size`, `ls -name`, `ls -date` | O(n log n) |
99
+ | **Graph + HashSet** | `ln -s` symlinks + cycle detection | O(V+E) |
100
+ | **LinkedList + Array** | `info` disk block simulation | O(n) |
101
+ | **N-ary Tree** | Directory hierarchy | O(n) |
102
+ | **MaxHeap** | `topk <k>` largest files | O(n log k) |
166
103
 
167
104
  ---
168
105
 
169
- ## Commands
106
+ ## 💻 Commands
170
107
 
171
108
  ### Navigation
172
-
173
109
  | Command | Description |
174
110
  |---|---|
175
- | `pwd` | Print current directory path |
176
- | `cd <dir>` | Navigate into a directory |
111
+ | `pwd` | Print current directory |
112
+ | `cd <dir>` | Navigate into directory |
177
113
  | `cd ..` | Go one level up |
178
- | `cd /` | Go to filesystem root |
179
- | `cd -` | Go back to previous directory (Stack) |
180
-
181
- ### Directory Operations
182
-
183
- | Command | Description |
184
- |---|---|
185
- | `mkdir <name>` | Create a directory |
186
- | `rmdir <name>` | Delete an empty directory |
187
- | `rmdir -f <name>` | Force delete directory and all contents |
188
- | `rename dir <old> <new>` | Rename a directory |
114
+ | `cd /` | Go to root |
115
+ | `cd -` | Go back (Stack) |
189
116
 
190
117
  ### File Operations
191
-
192
118
  | Command | Description |
193
119
  |---|---|
194
- | `create <name>` | Create an empty file |
120
+ | `create <name>` | Create a file |
195
121
  | `delete <name>` | Delete a file |
122
+ | `mkdir <name>` | Create a directory |
123
+ | `rmdir <name>` | Delete empty directory |
124
+ | `rmdir -f <name>` | Force delete directory |
196
125
  | `rename file <old> <new>` | Rename a file |
197
- | `info <name>` | Show file metadata + disk block allocation |
198
-
199
- ### Listing & Search
126
+ | `rename dir <old> <new>` | Rename a directory |
127
+ | `info <name>` | File metadata + disk blocks |
200
128
 
129
+ ### Search & Listing
201
130
  | Command | Description |
202
131
  |---|---|
203
- | `ls` | List files and folders |
204
- | `ls -l` | Detailed listing with size, type, date |
205
- | `ls -size` | Sort by file size (descending) |
132
+ | `ls` | List contents |
133
+ | `ls -l` | Detailed listing |
134
+ | `ls -size` | Sort by size |
206
135
  | `ls -name` | Sort alphabetically |
207
- | `ls -date` | Sort by modified date (newest first) |
208
- | `find <name>` | Fast global search using BST |
209
- | `search -t <type>` | Find all files of a given type |
210
- | `tree <path>` | Print ASCII directory tree |
211
- | `topk <k> <path>` | Top k largest files in a path |
212
-
213
- ### Symlinks
136
+ | `ls -date` | Sort by date |
137
+ | `find <name>` | Global search via BST |
138
+ | `search -t <type>` | Find by file type |
139
+ | `tree <path>` | ASCII directory tree |
140
+ | `topk <k> <path>` | Top k largest files |
214
141
 
142
+ ### Symlinks & System
215
143
  | Command | Description |
216
144
  |---|---|
217
- | `ln -s <target> <link_name>` | Create a symbolic link (with cycle detection) |
218
-
219
- ### System
220
-
221
- | Command | Description |
222
- |---|---|
223
- | `whoami` | Show logged-in user details |
224
- | `logout` | Clear auth tokens and exit |
145
+ | `ln -s <target> <link>` | Create symlink |
146
+ | `whoami` | Show logged-in user |
147
+ | `logout` | Clear auth and exit |
225
148
  | `help` | Show all commands |
226
149
  | `clear` | Clear terminal |
227
- | `exit` | Save state and exit |
228
-
229
- > **Tip:** You can chain multiple commands with `;` — e.g. `mkdir test ; cd test ; create hello.txt`
150
+ | `exit` | Save and exit |
230
151
 
231
152
  ---
232
153
 
233
- ## Project Structure
154
+ ## 🛠 CLI Tool
234
155
 
235
- ```
236
- vaultfs-core/
237
- ├── src/
238
- │ ├── models/
239
- │ │ ├── FileMetadata.java # File metadata + disk block reference
240
- │ │ └── FileNode.java # Directory node in the tree
241
- │ ├── datastructures/
242
- │ │ ├── DirectoryTree.java # N-ary tree + HashMap lookups + BST
243
- │ │ ├── BinarySearchTree.java # Custom BST for O(log n) file search
244
- │ │ ├── DiskSimulator.java # LinkedList + Array block fragmentation
245
- │ │ ├── FileLinkedList.java # Custom singly LinkedList for files
246
- │ │ ├── FileHashMap.java # Custom HashMap with separate chaining
247
- │ │ └── FileHeap.java # Custom MaxHeap for top-k queries
248
- │ ├── auth/
249
- │ │ ├── AuthManager.java # Login flow, whoami, logout
250
- │ │ ├── OAuthConfig.java # Reads credentials from .env
251
- │ │ └── OAuthHandler.java # Google/GitHub OAuth 2.0 code exchange
252
- │ ├── sync/
253
- │ │ └── FirestoreSync.java # Async push to Firestore
254
- │ ├── filesystem/
255
- │ │ ├── FileSystem.java # Core engine — all DS + disk ops
256
- │ │ ├── DiskService.java # Disk I/O helpers + metadata builder
257
- │ │ └── SearchService.java # Type search + size formatting
258
- │ ├── utils/
259
- │ │ ├── EnvParser.java # .env file parser
260
- │ │ ├── JsonExporter.java # Serializes state to state.json
261
- │ │ ├── Logger.java # Lightweight structured logger
262
- │ │ ├── Colors.java # ANSI color codes
263
- │ │ └── Banner.java # ASCII art banner
264
- │ └── Main.java # CLI entry point + command registry
265
- ├── bin/
266
- │ ├── vaultfs-npm.js # npm global binary entry point
267
- │ └── postinstall.js # Automatic post-install setup
268
- ├── frontend/ # React + Vite login UI (served by Java)
269
- │ └── .env.example # Firebase config template for frontend
270
- ├── .env.example # Backend OAuth/Firestore config template
271
- ├── package.json # npm package config (npm install -g vaultfs)
272
- ├── .npmignore # Files excluded from npm publish
273
- ├── version.txt # Current version number
274
- ├── install.sh # One-line installer (macOS/Linux/WSL)
275
- ├── install.bat # One-line installer (Windows)
276
- ├── uninstall.sh # Uninstaller (macOS/Linux/WSL)
277
- ├── .gitignore
278
- ├── FEATURE_SPEC.md # Data structure feature specifications
279
- └── README.md
280
- ```
156
+ | Command | Description |
157
+ |---|---|
158
+ | `vaultfs` | Launch VaultFS |
159
+ | `vaultfs --version` | Show version |
160
+ | `vaultfs update` | Pull latest and rebuild |
161
+ | `vaultfs doctor` | Health check |
281
162
 
282
163
  ---
283
164
 
284
- ## Compatibility
165
+ ## 🖥 Compatibility
285
166
 
286
167
  | Platform | Status |
287
168
  |---|---|
288
- | macOS (Intel + Apple Silicon) | ✅ Supported |
289
- | Linux (Ubuntu, Debian, Arch) | ✅ Supported |
290
- | WSL2 (Windows Subsystem for Linux) | ✅ Supported |
291
- | Windows (Command Prompt) | ✅ Supported |
292
- | Windows (PowerShell) | ⚠️ Use CMD or WSL instead |
169
+ | macOS (Intel + Apple Silicon) | ✅ |
170
+ | Linux (Ubuntu, Debian, Arch) | ✅ |
171
+ | WSL2 | ✅ |
172
+ | Windows (CMD / PowerShell) | ✅ |
173
+
174
+ ---
175
+
176
+ ## 📁 Project Structure
177
+
178
+ ```
179
+ vaultfs-core/
180
+ ├── src/ # Core Java source
181
+ │ ├── auth/ # OAuth + auth flow
182
+ │ ├── datastructures/ # All 9 DS implementations
183
+ │ ├── filesystem/ # File system engine
184
+ │ ├── models/ # File + directory models
185
+ │ ├── sync/ # Firestore sync
186
+ │ ├── utils/ # Logger, colors, banner
187
+ │ └── Main.java # CLI entry point
188
+ ├── auth-server/ # Node.js OAuth server (Render)
189
+ │ └── server.js # Express auth server
190
+ ├── frontend/ # React login UI
191
+ ├── bin/ # npm launcher scripts
192
+ │ ├── vaultfs-npm.js # CLI entry point
193
+ │ └── postinstall.js # Auto build + compile
194
+ ├── install.sh # Bash installer
195
+ ├── install.bat # Windows installer
196
+ ├── uninstall.sh # Uninstaller
197
+ ├── package.json # npm package config
198
+ └── version.txt # Current version
199
+ ```
293
200
 
294
201
  ---
295
202
 
296
- ## License
203
+ ## 📄 License
297
204
 
298
- MIT
205
+ MIT © [ThreatGuardian](https://github.com/ThreatGuardian)