diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de35c47..a50c198 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -33,6 +33,4 @@ jobs: done - name: Run Cypress tests - uses: cypress-io/github-action@v6 - env: - VITE_ENCRYPTION_KEY: '1234567890' \ No newline at end of file + uses: cypress-io/github-action@v6 \ No newline at end of file diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index e15367d..a195e00 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -1,10 +1,11 @@ import CryptoJS from 'crypto-js'; export function encryptData(data: string): string { - return CryptoJS.AES.encrypt(data, import.meta.env.VITE_ENCRYPTION_KEY as string).toString(); + const encryptionKey = import.meta.env.VITE_ENCRYPTION_KEY as string || 'test_key'; + return CryptoJS.AES.encrypt(data, encryptionKey).toString(); } export function decryptData(ciphertext: string): string { - const bytes = CryptoJS.AES.decrypt(ciphertext, import.meta.env.VITE_ENCRYPTION_KEY as string); + const bytes = CryptoJS.AES.decrypt(ciphertext, import.meta.env.VITE_ENCRYPTION_KEY as string || 'test_key'); return bytes.toString(CryptoJS.enc.Utf8); }