claudeunmask 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* v 1.0.9 */
|
|
1
2
|
function getMessageEncoding(message) {
|
|
2
3
|
return new TextEncoder().encode(message);
|
|
3
4
|
}
|
|
@@ -56,20 +57,22 @@
|
|
|
56
57
|
|
|
57
58
|
return getMessageDecoding(new Uint8Array(plaintextBuffer));
|
|
58
59
|
}
|
|
59
|
-
async function decryptData(inData) {
|
|
60
|
-
console.log ("hello from decryptData");
|
|
60
|
+
async function decryptData(inData, decryptionKey) {
|
|
61
61
|
var retVal = [];
|
|
62
62
|
var enc = new TextEncoder();
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
var [password, salt, theIV] = decryptionKey.split("-");
|
|
64
|
+
// const password = "a-strong-password-123";
|
|
65
|
+
console.log ("split:", password, salt, theIV);
|
|
65
66
|
for (const curRec of inData) {
|
|
66
67
|
var tmpRec = {}
|
|
67
68
|
for (const [key, value] of Object.entries(curRec)) {
|
|
69
|
+
console.log ("Key, value", key, value);
|
|
70
|
+
|
|
68
71
|
if (value.includes("m$k_")) {
|
|
69
72
|
const tmpData = curRec.secret_column.replace ("m$k_", "");
|
|
70
73
|
const theData = base64ToBytes(tmpData.split('-')[0]);
|
|
71
|
-
const theIV = base64ToBytes(tmpData.split('-')[1]);
|
|
72
|
-
const salt = base64ToBytes(tmpData.split('-')[2]);
|
|
74
|
+
// const theIV = base64ToBytes(tmpData.split('-')[1]);
|
|
75
|
+
// const salt = base64ToBytes(tmpData.split('-')[2]);
|
|
73
76
|
const encryptionKey = await deriveKeyFromPassword(password, salt);
|
|
74
77
|
|
|
75
78
|
tmpRec[key] = await decryptThisData (theData, encryptionKey, theIV);
|