Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now using web workers to code obfuscation
- Loading branch information
sanex3339
committed
Jan 27, 2020
1 parent
e92db6e
commit 1aa86af
Showing
6 changed files
with
78 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
self.window = self; | ||
|
||
const JavaScriptObfuscator = require('javascript-obfuscator'); | ||
|
||
onmessage = function(event) { | ||
const {code, options} = event.data; | ||
|
||
let result; | ||
|
||
try { | ||
const obfuscationResult = JavaScriptObfuscator.obfuscate(code, options); | ||
|
||
result = { | ||
code: obfuscationResult.getObfuscatedCode(), | ||
sourceMap: obfuscationResult.getSourceMap(), | ||
} | ||
} catch (error) { | ||
result = { | ||
code: error.toString(), | ||
sourceMap: '', | ||
} | ||
} | ||
|
||
postMessage(JSON.stringify(result)); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters