@live-game/sdk 0.3.0 → 0.4.0
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/dist/utils.js +4 -2
- package/package.json +1 -1
package/dist/utils.js
CHANGED
|
@@ -12,7 +12,8 @@ export function obfuscate(word) {
|
|
|
12
12
|
if (typeof Buffer !== "undefined") {
|
|
13
13
|
return Buffer.from(xor, "utf-8").toString("base64");
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
const bytes = new TextEncoder().encode(xor);
|
|
16
|
+
return btoa(String.fromCharCode(...bytes));
|
|
16
17
|
}
|
|
17
18
|
export function deobfuscate(obfuscated) {
|
|
18
19
|
try {
|
|
@@ -21,7 +22,8 @@ export function deobfuscate(obfuscated) {
|
|
|
21
22
|
xor = Buffer.from(obfuscated, "base64").toString("utf-8");
|
|
22
23
|
}
|
|
23
24
|
else {
|
|
24
|
-
|
|
25
|
+
const bytes = Uint8Array.from(atob(obfuscated), (char) => char.charCodeAt(0));
|
|
26
|
+
xor = new TextDecoder().decode(bytes);
|
|
25
27
|
}
|
|
26
28
|
return xor
|
|
27
29
|
.split("")
|