claudeunmask 1.0.27 → 1.0.28
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 +16 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* v 1.0.
|
|
1
|
+
/* v 1.0.28 */
|
|
2
2
|
function getMessageEncoding(message) {
|
|
3
3
|
return new TextEncoder().encode(message);
|
|
4
4
|
}
|
|
@@ -107,11 +107,21 @@ console.log ("unmask: daily key", dailyKey);
|
|
|
107
107
|
var enc = new TextEncoder();
|
|
108
108
|
var [tmpPassword, salt, theIV] = decryptionKey.split("-");
|
|
109
109
|
console.log ("from MCP", decryptionKey, tmpPassword, salt, theIV);
|
|
110
|
-
|
|
111
|
-
try
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
110
|
+
var haveError = 0;
|
|
111
|
+
for (var ii= 0; ii<=2; ii++) { // try to decrypt the daily key and the add = until it works or we've added 2
|
|
112
|
+
console.log ("testing daily key: ", dailyKey);
|
|
113
|
+
const dailyKeyBinary = await deriveKeyFromPassword(dailyKey, base64ToBytes(salt));
|
|
114
|
+
try {
|
|
115
|
+
tmpPassword = await decryptThisData (base64ToBytes(tmpPassword), dailyKeyBinary, base64ToBytes(theIV));
|
|
116
|
+
// if we get here then we have a good daily key
|
|
117
|
+
haveError = 0;
|
|
118
|
+
break;
|
|
119
|
+
} catch (error) {
|
|
120
|
+
haveError = 1;
|
|
121
|
+
dailyKey = dailyKey + '=';
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (haveError) {
|
|
115
125
|
throw Error ("Failed to decrypt the key");
|
|
116
126
|
}
|
|
117
127
|
console.log ("secret:", tmpPassword);
|