An asset encryption/decryption & delivery system for OpenFL.
BytePack is a library/toolchain that can help protect your project assets with AES-256 encryption. New keys are generated automatically on each successful build and passed to the compiler, meaning you barely have to do any work to keep your assets secure!
BytePack is built with ease of use in mind, and tries to resemble the default OpenFL asset system. All that is required is to use BytePack.getAsset() to load recognizable data types.
import openfl.display.Sprite;
import zeroip.BytePack;
class Main extends Sprite
{
public function new()
{
super();
var image = BytePack.getAsset("image.png", BytePack.TYPE_BITMAP);
addChild(image);
}
}| Platform | Support |
|---|---|
| Windows | ✅ Fully Supported |
| Linux | ✅ Fully Supported |
| Mac | ☑️ Supported (Untested) |
| HTML5 | ❌ Not Supported |
- Download and install Visual Studio Community; ensure you have the
Desktop development with C++package enabled in the installer - Download and install Haxe; ensure both the Haxe and Neko components are selected during installation
- Install OpenSSL binaries (the Win64 OpenSSL full package is recommended, not light); afterwards you will need to add the
binfolder to your system path
- Download and install Haxe using the preferred method for your distro
- Ensure openssl is installed by entering
opensslfrom your terminal; search for instructions if it's not present
- Download the required libraries using
haxelib install requirements.hxmlfrom this repo - Enter
haxelib run openfl setupto complete OpenFL installation - Next, enter
haxelib dev bytepack .to point Haxe to this directory
A simple test app is available to ensure everything is working as intended post-installation.
- From this repo, enter
cd testApp, thenopenfl test linux -Dencryptoropenfl test windows -Dencryptto compile & launch - After building, the application should start; it will display a bitmap, play a sound, and trace some text in the terminal window
To get started on your own project, enter haxelib run bytepack template [name]. This will create a directory with all the required project files already setup.
Any additional files placed inside assets can be encrypted at compile time by adding the encrypt flag during compilation. Please note additional asset folders, or changing the asset folder name/location are not currently supported. Nested folders inside assets work as intended.