-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiag.js
More file actions
20 lines (18 loc) · 879 Bytes
/
Copy pathdiag.js
File metadata and controls
20 lines (18 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const axios = require('axios');
require('dotenv').config();
const { decrypt } = require('./src/lib/crypto_diag'); // I'll create a simple decrypt for this
// Simple decrypt for the diagnostic script
const crypto = require('crypto');
function simpleDecrypt(text) {
const [ivHex, encryptedHex] = text.split(':');
const iv = Buffer.from(ivHex, 'hex');
const encryptedText = Buffer.from(encryptedHex, 'hex');
const decipher = crypto.createDecipheriv('aes-256-cbc', Buffer.from("8a07cf0a4e89f1b4e927e4c6ea2eafbd", 'hex'), iv);
let decrypted = decipher.update(encryptedText);
decrypted = Buffer.concat([decrypted, decipher.final()]);
return decrypted.toString();
}
async function diag() {
const apiKeyEnc = "460d36746860d5ed0d8745582f3c306d:b8d8123282f1b4e927e4c6ea2eafbd..."; // I'll get these from the DB
// Actually I'll just use the creds if I can find them.
}