Initial commit
This commit is contained in:
parent
0bcd5d781c
commit
d436382eda
2 changed files with 24 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "backend",
|
||||
"comment": "added by heartbeat"
|
||||
"comment": "added by heartbeat",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
|
|
|
|||
23
backend/src/services/encryption.test.js
Normal file
23
backend/src/services/encryption.test.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { encryptText, decryptText } from './encryption.js';
|
||||
|
||||
const TEST_KEY = 'YixWi1MYh77NMEQYSJZR+2IsVotTGIe+zTBEGEiWUfs='; // 32 bytes base64
|
||||
|
||||
process.env.DATA_ENCRYPTION_KEY = TEST_KEY;
|
||||
|
||||
const run = async () => {
|
||||
const plain = 'Hello, World! 123';
|
||||
const encrypted = encryptText(plain);
|
||||
const decrypted = decryptText(encrypted);
|
||||
|
||||
if (decrypted !== plain) {
|
||||
console.error('Decryption mismatch:', { plain, decrypted });
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log('Encryption tests passed');
|
||||
};
|
||||
|
||||
run().catch((err) => {
|
||||
console.error('Encryption tests failed:', err.message);
|
||||
process.exit(1);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue