Owner Recovery, Sync, and Data Protection Guide
This guide is separate from Windows installation and focuses on daily operations, recovery, and data safety for owners/admins.
1. Software Installation Guide (Operations View)
Use this order when setting up a new machine:
- Install the main software package (
Inventory_Installer.exe/backend_Installer.exeas provided by your team). - Start the application and complete outlet setup.
- Verify backend is reachable (
http://127.0.0.1:3000/health). - Confirm cloud settings are active (
sysConfig.encin install folder). - Run one test backup/sync and verify success status.
Important:
- This guide does not replace packaging/build instructions. For build pipeline and
.issscripts, use Windows installer developer guide.
2. Username Recovery Guide
Use when user forgot username.
Required:
- Correct
outletCode - Registered outlet contact email
Flow:
- User enters outlet code + email.
- System validates outlet and exact email match.
- System finds all active usernames under that outlet.
- System emails the username list to registered email.
If recovery fails:
- Check outlet is active.
- Check registered contact email exists.
- Ensure entered email exactly matches saved email.
3. Outlet Recovery Guide
Use when owner forgot outlet code.
Required:
- Registered email or phone linked to outlet
Flow:
- User requests recovery with contact (email/phone).
- System queries cloud records for matching active outlets.
- OTP is sent to registered email.
- After OTP verification, outlet list is returned and also emailed.
Security behavior:
- OTP expires in 10 minutes.
- Resend cooldown is enforced (about 3 minutes).
4. Forgot Password Guide
Use when user knows username but forgot password.
Required:
outletCodeusername- Access to registered outlet email inbox
Flow:
- Request password reset OTP.
- System validates outlet + username and sends OTP email.
- Enter OTP + new password.
- System hashes password and updates user record.
- User logs in with new password.
Rules:
- OTP valid for 10 minutes.
- OTP request cooldown is enforced (about 2 minutes).
- New password minimum length is 8 characters.
5. Last Data Sync Guide
Use when owner wants latest data on this machine before starting work or recovery.
Typical cases:
- Machine restored/reinstalled
- Internet outage ended
- Before accounting close
- Before full recovery
How to run:
- Login with authorized user.
- Run sync from recovery/settings flow.
- Wait for completion message.
- Confirm latest sync timestamp/status.
Why latest sync is useful for owner:
- Reduces risk of working on old data.
- Pulls most recent cloud backup state.
- Improves confidence before billing/reporting.
- Helps avoid data mismatch across terminals.
6. Where Data Is Stored
Local machine:
- App/runtime folder contains:
server.exe,run_hidden.vbs,license.key,sysConfig.enc,config.enc,client.json
- Local backup folder:
backups\backup_*.enc
- Backup status metadata:
backup_status.json
- Recovery OTP store:
data\otp_store.json
Cloud:
- Google Drive client folder(s) contain encrypted backup and config payloads.
- Google Sheet (
Clients,Update) stores outlet identity, status, and update metadata.
7. How Backups Are Protected
Current protections in system:
- Backups are encrypted archives (
.enc) before retention/upload. - Raw SQL dump is deleted after encryption step.
- Backup file integrity is verified before final retention/upload.
- Cloud cleanup keeps only latest backups in cloud script logic.
- Local retention cleanup removes older backups based on policy.
- OTP verification gates sensitive recovery operations.
- Recovery PIN hash is validated for outlet-level restore.
8. Owner Best Practices for Data Safety
- Keep at least one admin who regularly verifies backup success.
- Test full restore on a non-production machine every month.
- Keep outlet contact email/phone updated and accessible.
- Restrict who can perform recovery actions.
- Protect Google account used for script and drive (2FA recommended).
- Never share
sysConfig.enc,config.enc, or recovery credentials over chat. - Before major changes, confirm latest sync completed successfully.
9. Where This Logic Exists in Code
Username + password recovery:
backend\modules\passwordRecoveryController.jsbackend\modules\emailService.js
Outlet recovery + full recovery + OTP flows:
backend\controllers\public\recoveryController.jsinstaller\scriptgoogle.txt
Cloud sync and backup:
backend\modules\driveService.jsbackend\modules\sheetService.jsbackend\modules\updownconfig.jsbackend\modules\restore.jsbackend\modules\backupService.jsbackend\jobs\backupJob.jsbackend\utils\backupTracker.js