Obfuscated Builds
Wails includes support for obfuscating your application using garble.
To produce an obfuscated build, you can use the -obfuscate
flag with the wails build
command:
wails build -obfuscate
To customise the obfuscation settings, you can use the -garbleargs
flag:
wails build -obfuscate -garbleargs "-literals -tiny -seed=myrandomseed"
These settings may be persisted in your project config.
How it works
In a standard build, all bound methods are available in the frontend under the window.go
variable. When these methods are called, the corresponding backend method is called using
the fully qualified function name. When using an obfuscated build, methods are bound using
an ID instead of a name. The bindings generated in the wailsjs
directory use these IDs to
call the backend functions.
To ensure that your application will work in obfuscated mode, you must use the generated
bindings under the wailsjs
directory in your application.
Example
Importing the "Greet" method from the bindings like this:
import { Greet } from '../../wailsjs/go/main/App';
// snip
Greet('World');
will ensure that the method will work correctly in obfuscated mode, as the bindings will be regenerated with IDs and the call mechanism updated.