- Fix saveWiFiPassword to use encrypted passwords map instead of decrypted - Fix getWiFiPassword to decrypt from encrypted storage - Fix test expectations for migration and encryption functions - Remove unused error variables to fix linting warnings - All 27 tests now passing with proper encryption/decryption flow The WiFi credentials cache feature was already implemented but had bugs where encrypted and decrypted password maps were being mixed. This commit ensures proper encryption is maintained throughout the storage lifecycle.
Backend Scripts
This directory contains database utility scripts for development and testing.
Environment Variables
These scripts require environment variables to be set. Create a .env file in the backend/ directory with the following variables:
# Database Configuration
DB_HOST=your-database-host
DB_PORT=5432
DB_NAME=your-database-name
DB_USER=your-database-user
DB_PASSWORD=your-database-password
# Legacy API Configuration
LEGACY_API_USERNAME=your-username
LEGACY_API_TOKEN=your-jwt-token
Available Scripts
create-test-user.js
Creates a test user with a known OTP code for development/testing.
Usage:
cd backend
node scripts/create-test-user.js
This will create a user with:
- Email:
test@test.com - OTP:
123456
inspect-db.js
Inspects the database schema to understand table structure and columns.
Usage:
cd backend
node scripts/inspect-db.js
check-legacy-deployments.js
Checks synchronization between WellNuo database and Legacy API deployments.
Usage:
cd backend
node check-legacy-deployments.js
fix-legacy-deployments.js
Creates missing legacy deployments for beneficiaries.
Usage:
cd backend
node fix-legacy-deployments.js
Security
⚠️ IMPORTANT: Never commit files containing actual credentials to the repository. Always use environment variables for sensitive information.
- Database credentials should be stored in
backend/.env(this file is git-ignored) - See
backend/.env.examplefor the required format