22 lines
1.0 KiB
JavaScript
22 lines
1.0 KiB
JavaScript
"use strict";
|
|
/**
|
|
* CLI: re-encrypt database secrets with the current ENCRYPTION_KEY.
|
|
* Usage:
|
|
* 1. Set ENCRYPTION_KEY_PREVIOUS to the old key
|
|
* 2. Set ENCRYPTION_KEY to the new key
|
|
* 3. npm run rotate-encryption-key
|
|
*/
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const encryptionRotationService_1 = require("../services/encryptionRotationService");
|
|
const encryptionRotationReminderService_1 = require("../services/encryptionRotationReminderService");
|
|
async function main() {
|
|
const stats = await (0, encryptionRotationService_1.rotateAllEncryptedData)();
|
|
await (0, encryptionRotationReminderService_1.recordEncryptionKeyRotatedAt)();
|
|
console.log('[rotate-encryption-key] Completed:', stats);
|
|
console.log('Remove ENCRYPTION_KEY_PREVIOUS from the environment after verifying the application.');
|
|
}
|
|
main().catch((e) => {
|
|
console.error('[rotate-encryption-key] Failed:', e instanceof Error ? e.message : e);
|
|
process.exit(1);
|
|
});
|
|
//# sourceMappingURL=rotateEncryptionKey.js.map
|