Post-Build: Registering App Hash
After building your signed app, you must register the app hash with the Alphyn server.
Android: Using post-action-android.sh
Section titled “Android: Using post-action-android.sh”# Make the script executablechmod +x post-action-android.sh
# Run without API key (just shows app hash)./post-action-android.sh /path/to/your-game.apk
# Run with API key (registers to server)./post-action-android.sh /path/to/your-game.apk YOUR_API_KEYOutput Example (Android)
Section titled “Output Example (Android)”The Android app hash is the SHA-256 of the app’s signing certificate (lowercase hex). It is the same for every build signed with the same key, so it changes only when you re-sign with a different one.
=== Android App Integrity Info ===Package: com.yourstudio.yourgameVersionCode: 1VersionName: 1.0.0Signer DN: CN=Your Studio, O=Your Studio, C=TRAppHash: 64f3f5b47a856403dc48bfbaac0fcdb89f414f63dafb9c18e8b6d87f2a43caec (signing-certificate SHA-256)isDebug: false
JSON:{ "platform": "android", "packageName": "com.yourstudio.yourgame", "version": "1.0.0", "appHash": "64f3f5b47a856403dc48bfbaac0fcdb89f414f63dafb9c18e8b6d87f2a43caec", "isDebug": false}
=== Registering to Server ===Registration successful!iOS: Xcode archive post-action
Section titled “iOS: Xcode archive post-action”A Unity iOS build produces an Xcode project, and that project registers each archive the way a native iOS app does: from an Archive post-action in its scheme. The script is Assets/post-action-ios.sh in the Unity plugin package, the same script a native iOS app uses.
- Open the generated Xcode project and choose Product > Scheme > Edit Scheme….
- Select Archive, then Post-actions. Click + and choose New Run Script Action.
- Set Shell to
/bin/bashand Provide build settings from to theUnity-iPhonetarget. Without build settingsARCHIVE_PATHis unset and the script exits without registering. - Paste the contents of
Assets/post-action-ios.sh, then replacealphyn_xxxinAUTH_TOKEN="alphyn_xxx"with the API key of your iOS app registration. - Choose Product > Archive.
Unity’s Replace build mode clears the whole build folder, so a post-action added by hand does not survive a Replace build. Check that it is still in the scheme before you archive.
Step-by-step guide with screenshots: Register via Xcode post-action.
Output (iOS)
Section titled “Output (iOS)”The post-action writes post_action.log and integrity.txt into the .xcarchive. integrity.txt lists the registered fields and ends with the register request and the HTTP status it got back. Inside the app it adds an encrypted AlphynBinaryManifest.json and re-signs the bundle; it leaves the game’s own files, StreamingAssets included, as Unity built them. The fields the SDK checks on the device:
| Field | Value |
|---|---|
computeMainExecutableHashExcludingSignature (cmeh) | SHA-256 over the main executable’s __TEXT,__text hash, the Alphyn framework’s __TEXT,__text hash, the bundle identifier and the version. The build number is not part of it. |
currentCDHashHex (cdh) | HMAC-SHA256 of the bundle identifier, base64 |
computeBundleFingerprintExcludingSignatures (cbf) | SHA-256 of embedded.mobileprovision |
development_team | the TeamIdentifier the app’s code signature carries, which is the team App Attest attests |
Important Notes
Section titled “Important Notes”- Run the Android script AFTER signing your APK (release builds)
- You need to re-register whenever you update your signing certificate
- Android: The script requires Android SDK (aapt2 and apksigner)
- iOS: The post-action runs inside Xcode on macOS, at archive time