Skip to main content
If your app is only for paying customers or a private group, the installer can ask for an access key and encrypt your files with it. This page shows how to set it up, what your users see, and the limits of this protection.

Turn it on

bach.toml
get_key_url is optional. It adds a Get a key button to the key page.

Make keys and build

Keys are never written into bach.toml. Make one:
keys.txt holds a random key. Send it to your customer. Keep the file private and out of Git. Instead of a file, you can put one key into the BACH_ACCESS_KEY environment variable. To give every customer their own key, make many at once:
Every key in the file opens the same setup file (up to 1000 keys). Keep track of which key you gave to whom. You can use your own keys: 8 to 128 characters, letters, digits and - _ . ~ + / = :. Random keys from bach key are much harder to guess.

What users see

After requirements and before the license, a page asks for the key. They can type or paste it. A wrong key shows That key doesn’t fit and nothing on the computer changes. Silent installs take the key with --key-file <file> or the BACH_ACCESS_KEY environment variable, never as a plain argument, because other programs can read arguments:
Without a key the exit code is 2; with a wrong key, 1.

Private updates

With [updates], the key is kept on the user’s computer, protected so only that Windows account can read it, and sent with update requests:
bach.toml
Your server receives Authorization: Bearer <key> and can answer 401 or 403 to refuse. The key only goes to the host of feed. See Where to host updates.

Taking a key back

Remove the line from keys.txt and build again. Copies of the old setup file still open with the old key, but your server can refuse its update requests.

What this protects, and what it doesn’t

It protects the setup file and the download: without a key, nobody can unpack your files. It doesn’t protect an installed app. After installing, the files are ordinary files on the user’s computer, and file names and sizes are visible even without a key. If you need licensing, check the license inside your app. Access keys can’t be combined with downloaded components (while files are encrypted), portable ZIPs or MSI packages. For every setting, see [access].