This guide provides instructions for setting up the local databases, Cloud Firestore synchronization, zero-knowledge vault metadata, and Google Gemini AI for AstralNotes on both Android (com.astralquarks.notes) and Web (astralnotesweb).
AstralNotes utilizes an Offline-First Reactive Architecture across platforms:
+------------------------------------+ +------------------------------------+
| Android Jetpack Compose | | Web TypeScript PWA |
| (Compose UI, ViewModels, Coroutines) | | (Vite, IndexedDB, Web Crypto) |
+-----------------+------------------+ +-----------------+------------------+
│ │
▼ ▼
+------------------------------------+ +------------------------------------+
| Local Room Database | | Local IndexedDB |
| (SQLite / DAO / KSP) | | ("astral_notes_db" store) |
+-----------------+------------------+ +-----------------+------------------+
│ │
│ (AES-256-GCM Encrypted Notes & Vault Meta) │
▼ ▼
+----------------------------------------------------------------------------------+
| Google Cloud Firestore |
| - user/{uid}/notes/{noteId} (Encrypted/Plaintext user notes) |
| - user/{uid}/vault_meta/config (Salt, Wrapped VMK, Verifier Token) |
| - shares/{shareId} (Ephemeral encrypted shared links) |
+----------------------------------------------------------------------------------+
Both Android and Web share the same Firebase backend project for seamless cross-platform note synchronization.
- Navigate to the Firebase Console.
- Create a new project or select an existing project.
- In Project Settings, click Add app and select Android.
- Package Name:
com.astralquarks.notes - Generate and paste your development or release SHA-1 certificate fingerprint:
keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey - Download
google-services.jsonand place it in theapp/directory of the project.
Security Notice: Do not commit
google-services.jsonor personal API keys into public version control. It is already included in.gitignore.
- In Project Settings, click Add app and select Web.
- Register the web app and obtain the configuration object.
- Configure
web/src/firebase.tswith your project configuration:export const firebaseConfig = { apiKey: "YOUR_API_KEY", authDomain: "YOUR_PROJECT_ID.firebaseapp.com", projectId: "YOUR_PROJECT_ID", storageBucket: "YOUR_PROJECT_ID.firebasestorage.app", messagingSenderId: "YOUR_SENDER_ID", appId: "YOUR_APP_ID" };
- In the Firebase Console, go to Build > Authentication > Sign-in method.
- Enable Google as a sign-in provider.
- Add your support email and configure OAuth credentials matching your Google Cloud Console setup.
- Navigate to Build > Firestore Database and click Create Database.
- Go to the Rules tab, replace the contents with the following rules, and click Publish:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// User notes collection (read and write allowed only for the owning user)
match /user/{userId}/notes/{noteId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Zero-knowledge vault metadata (salt, wrapped master key, verifier token)
match /user/{userId}/vault_meta/{docId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
// Read-only ephemeral shared notes
match /shares/{shareId} {
// Anyone can read a shared note if it is unexpired
allow read: if resource == null ||
resource.data.expiresAt == null ||
resource.data.expiresAt > request.time.toMillis();
// Only the authenticated author can create, update, or revoke their share
allow create: if request.auth != null && request.resource.data.ownerUid == request.auth.uid;
allow update, delete: if request.auth != null && resource.data.ownerUid == request.auth.uid;
}
}
}AstralNotes features client-side zero-knowledge encryption for sensitive notes:
- Key Derivation (PBKDF2): When you configure a vault password, a 256-bit Key Encryption Key (KEK) is derived using 100,000 PBKDF2 iterations and a cryptographic salt.
- Master Vault Key (VMK): A random 256-bit AES-GCM Vault Master Key is generated. It encrypts and decrypts all vault notes.
- Key Wrapping: The VMK is encrypted by the KEK and stored in Firestore under
user/{uid}/vault_meta/config. - Decryption in Memory: When unlocking your vault, your password unwraps the VMK into volatile application memory. The plaintext password and VMK are never stored on disk or sent over the network.
- Sync Parity: Locked notes synced to Firestore are encrypted before transmission (
isEncrypted: true,encryptedData,iv).
AstralNotes operates with zero server-side or bundled API keys. Each user connects their own personal key:
- Obtain a free API key from Google AI Studio.
- Open AstralNotes on Android or Web.
- Navigate to Settings > Google Gemini Intelligence (or tap the Sparkle icon on any note).
- Paste your key into Custom Gemini API Key and select your preferred model (
gemini-3.7-flash,gemini-3.5-flash, etc.). - Tap Save Gemini Config.
- Exporting:
- Navigating to Backup & Restore generates a standardized JSON snapshot of all notes.
- If locked notes are present, entering the vault password decrypts the notes and re-encrypts them with a salted backup key.
- Importing:
- Selecting an exported JSON file reconstructs notes with intact tags, colors, and timestamps.
- If importing vault notes, entering the exported file's vault password unlocks them and re-encrypts them into your local vault session.
- Cross-Platform Compatibility:
- A backup generated on an Android phone can be restored directly into the web application, and vice versa.