App attestation
App attestation proves to your backend that a request comes from an unmodified build of your app running on a genuine device that meets your policy. It is included in every TrustPin plan, the Free plan too, at no extra charge, because you run the verifier yourself.
This page is for security leads and everyone starting with attestation. It explains what attestation proves, who runs what and what TrustPin sees, and ends with the six stages from an empty project to enforced attestation, each with a check.
It is not runtime protection (RASP): it doesn’t detect hooking, debugging, tampering, root or jailbreak. See What attestation is not.
Who runs what
TrustPin operates no attestation service. Everything in the request path runs in your infrastructure. TrustPin’s only runtime role is serving the signed policy (attest.jws.b64) from its CDN.
The gateway is optional: your API can verify the token itself, with the same JWKS. Apple App Attest and Android Key Attestation evidence is checked inside the verifier, with no outside call.
| Component | Runs at | Role |
|---|---|---|
| TrustPin console and CLI | TrustPin, your workstation | Set up, edit, sign and publish the attestation policy; generate the deployment bundle |
| TrustPin CDN | TrustPin | Serves the signed policy to your verifier |
| Attestation verifier | Your infrastructure (container image) | Verifies Apple App Attest, Android Key Attestation and Play Integrity evidence against the policy; issues short-lived tokens |
| SDK attestation module | Your app | Produces evidence, obtains and renews tokens, adds the TrustPin-Attestation header to requests |
| Your API or gateway | Your infrastructure | Verifies tokens against the verifier’s JWKS and decides what unattested requests may do |
TrustPin stores identifiers only: Team IDs, bundle IDs, package names, signing-certificate digests, the Google Cloud project number. It never holds your verifier’s signing keys, challenge secrets or Google credentials; those are environment variables of your verifier.
What TrustPin sees
TrustPin sees no attestation traffic. From your verifiers’ policy fetches it records:
- request counts, split into full fetches and “not modified” answers;
- verifier versions and the operating system and architecture they run on;
- the CDN location that served the fetch;
- counts of distinct verifier server IP addresses.
None of this is device or end-user data. You see it on the project’s Analytics page (“Attestation verifiers”), the Usage pages (“Attestation policy fetches”) and the Status tab of the project’s Attestation page (“Verifier fleet”).
The flow
Platform evidence is expensive (an Apple or Google round trip, subject to quotas), so it is produced once per device key. Tokens are then renewed cheaply by signing a fresh challenge with that key.
The device key is the App Attest key on Apple platforms (Secure Enclave) and an Android Keystore key on Android. A key is attested exactly once; when its key certificate expires or is rejected, the SDK generates a new key and attests again. The Key certificate lifetime in the policy (default 30 days) therefore controls how often a device attests again.
For an operation your API must not accept on a reused token alone, SDK 7.1.x can add an assertion bound to that operation. See Assertions for sensitive operations.
Token binding
A token can be bound to your user’s session, so a token copied out of one session is useless in another. Only a SHA-256 of the value leaves the device, and your API compares it with the session the request authenticates with.
The app chooses one of two modes: header binding, where each request’s token is bound to a header such as Authorization, or fixed binding, to a value you set. With Require token binding on, tokens exist only once the app has a binding.
Modes
| Mode | Verifier behaviour | Use |
|---|---|---|
| Monitor | Issues a token even when policy checks fail, recording tp.result fail and tp.reasons. An app the policy doesn’t list gets 403 app_not_allowed in both modes | Roll-out: your API logs tp.result and allows every request |
| Enforce | Issues tokens only when the policy passes. Tokens issued before a switch to enforce keep fail until they expire; see Rolling out | Production: your API rejects requests without a valid token |
Cryptographic failures (forged evidence, invalid signatures) never yield a token in either mode.
Platforms
Attestation ships in SDK 7.1.x: Swift 7.1.0 (TrustPinAttestKit), and Kotlin, Flutter and React Native 7.1.1. Flutter covers iOS, macOS and Android; React Native covers iOS and Android. Both wrap the native modules, so the evidence and minimums below apply to them too. Every 7.1.x SDK needs verifier 1.0.0 or later.
| Platform | Evidence | Minimum OS |
|---|---|---|
| iOS, iPadOS | App Attest | 15 |
| Mac Catalyst | App Attest | 15 |
| macOS | App Attest | 13 |
| tvOS | App Attest | 15 |
| watchOS | App Attest | 9 |
| visionOS | App Attest | 2 |
| Android with Google Play services | Key Attestation, Play Integrity, or both, as the policy requires | API 25 |
| Android without Google Play | Key Attestation | API 25 |
| Simulators and emulators | Debug token (development only) | Not applicable |
Where a device cannot produce the evidence the policy requires, or the operating system reports App Attest as unsupported (some Macs and older hardware), the SDK reports it and sends requests without the header. Your API decides how to treat them.
Setting it up
Six stages, in this order. Each page ends by pointing to the next one. Don’t start a stage until the check of the previous one passes: a mistake then shows up where it was made, not three stages later. Run stages 1 to 5 against a staging verifier first, then add production as described in Staging and production before stage 6.
| Stage | What you do | Page | Check before moving on |
|---|---|---|---|
| 1 | Register your apps with Apple and Google, write a monitor-mode policy, and Sign and publish it | Setting up apps and the policy | The Policy tab shows the status Active and “published version 1” |
| 2 | Deploy the verifier from the console’s deployment bundle | Deploying the verifier | attest-verifier check passes, and curl https://<verifier host>/v1/challenge returns JSON whose policyVersion is the published version |
| 3 | Register the verifier’s domain in the TrustPin project and pin it, because the SDKs pin their calls to the verifier | Registering the verifier’s domain | On the Status tab, Verifier checks, Check now reports the verifier as pinned |
| 4 | Add the attestation module to your app, configure it, set it up and bind tokens | iOS and macOS, Android, Flutter or React Native | The SDK’s attestation state reaches ready. On a simulator or emulator this needs a debug token |
| 5 | Verify the TrustPin-Attestation header in your API, or at your gateway | Verifying tokens in your API or Checking tokens at the gateway | Your API logs a verified token with tp.result pass, the expected tp.app, and a bind that matches the session |
| 6 | Measure in monitor mode, then enforce | Rolling out: monitor to enforce | Requests without the header and fail results are explained; the policy is in Enforce and your API refuses unattested requests on the endpoints you chose |
The most likely failure at each stage: at 2, exit code 3 means the policy isn’t published; at 4, verifierUnavailable means the verifier’s domain isn’t registered, and app_not_allowed means the app’s IDs or signing certificate don’t match the policy; at 5, a binding mismatch means your API hashes a different header value than the app bound.
Projects signed with FIDO can’t use app attestation in this release.
Next steps
- Stage 1: Setting up apps and the policy
- For security reviews: What attestation is not
- When a stage’s check fails: Troubleshooting attestation