Skip to content

Commit 8a6f668

Browse files
committed
chore: setup debug script
1 parent da7ccfa commit 8a6f668

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

mre-decrypt-key/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```
2+
npm install
3+
CRYPTO_KEY=xxx TO_DECRYPT=xxx node ./main.js
4+
```

mre-decrypt-key/main.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
const CryptoJS = require('crypto-js');
2+
3+
// This should be your secret key - in production, store this securely!
4+
const CRYPTO_KEY = process.env.CRYPTO_KEY ?? 'your-secret-key-here';
5+
const TO_DECRYPT = process.env.TO_DECRYPT ?? 'string-to-decrypt'
6+
7+
// Function to decrypt a string
8+
function decryptString(encryptedText) {
9+
return CryptoJS.AES.decrypt(encryptedText, CRYPTO_KEY)
10+
.toString(CryptoJS.enc.Utf8)
11+
.trim();
12+
}
13+
14+
const decrypted = decryptString(TO_DECRYPT);
15+
console.log(`Original: ${TO_DECRYPT}`)
16+
console.log(`After Decrypt: ${decrypted}`)

mre-decrypt-key/package-lock.json

+22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mre-decrypt-key/package.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "mre-decrypt-key",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1"
7+
},
8+
"author": "",
9+
"license": "ISC",
10+
"description": "",
11+
"dependencies": {
12+
"crypto-js": "^4.2.0"
13+
}
14+
}

0 commit comments

Comments
 (0)