@encoradb/cli
v0.2.0-beta
Published
**EncoraDB CLI** is the essential command-line toolkit for managing database encryption in EncoraDB applications. It enables database schema scanning (`scan`), configuration verification (`verify`), zero-downtime batch migrations (`migrate`), and key rota
Maintainers
Readme
@encoradb/cli
EncoraDB CLI is the essential command-line toolkit for managing database encryption in EncoraDB applications. It enables database schema scanning (scan), configuration verification (verify), zero-downtime batch migrations (migrate), and key rotation (rotate-keys).
🚀 Installation
# Global Install
npm install -g @encoradb/cli
# or
pnpm add -g @encoradb/cli
# Local Dev Install
pnpm add --save-dev @encoradb/cli📦 Commands
encoradb migrate
Batch encrypt existing database tables in chunked batches with zero downtime.
Usage:
encoradb migrate -c <connection-string> [options]Options:
-c, --connection <url>: Database connection string (PostgreSQL / MySQL / SQLite).-t, --table <name>: Specific table to migrate (defaults to all tables in config).-b, --batch-size <number>: Number of rows per batch chunk (default:500).-d, --dry-run: Inspect database schema and count unencrypted plaintext rows without writing data.--config <path>: Path to.encoradb.jsonconfiguration file (default:.encoradb.json).
Examples:
# Dry run inspection (safe, no database writes)
encoradb migrate -c postgres://user:pass@localhost:5432/mydb --dry-run
# Live batch migration
encoradb migrate -c postgres://user:pass@localhost:5432/mydb -b 500encoradb scan
Introspect your database to automatically find sensitive columns (like passwords, emails, SSNs) and generate a suggested .encoradb.json configuration.
encoradb scan postgres://user:pass@localhost:5432/mydbencoradb verify
Validates your current configuration file (.encoradb.json) and performs a live encryption test to ensure your Master Key is working correctly.
encoradb verifyencoradb rotate-keys
Securely rotate your Master Key by re-encrypting data in your database from an old key to a new key.
encoradb rotate-keys postgres://user:pass@localhost:5432/mydb⚙️ Configuration (.encoradb.json)
{
"masterKey": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"mode": "local",
"encryptColumns": {
"users": ["email", "ssn"]
},
"searchableColumns": {
"users": ["email"]
}
}📄 License
MIT
