DocsDeveloper guideWorked example
Package and sign
A buyer installs an add-on from one zip: its folder, a manifest of every file's hash, and a signature over that manifest.
1 min read
- With the add-on folder in a source tree that has
vendor/, runphp tools/build-addon.php <slug> --out=<file>.zip(tools/build-addon.php:4-11). - The builder walks your folder, refuses any file type not allowed, refuses files held out of every package, and writes
optira-package.json: key, dir, name, version, core_min, allows and the sha256 of every file (app/Support/Addons/AddonPackageBuilder.php:25-100). - Sign it:
php tools/sign-package.php --key=<private.pem> --zip=<file>.zip. This addsoptira-package.sig(tools/build-addon.php:7,app/Support/Addons/AddonPackageBuilder.php:103-120).
Why every file is covered
The signature covers the manifest, and the manifest covers every file by hash. A file added, removed or changed after signing is refused at upload (app/Support/Addons/AddonPackage.php:34-38, :328-350, :420).
Whose key
An install accepts only packages signed with the key its resources/keys/optira-addons.pub matches. Without that key, every upload is refused (config/addons.php:623-628, app/Support/Addons/AddonPackage.php:137-150). Turning the check off is for BridgeERP's own development, never for a buyer (config/addons.php:625-626).