device-integrity

Verify iOS app requests using DeviceCheck tokens and App Attest assertions.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill device-integrity-dfly7
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: device-integrity
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/device-integrity
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill device-integrity-dfly7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Verify that requests to your backend originate from a genuine Apple device running your unmodified app, preventing fraud and automated abuse that rely on spoofed or tampered clients. This Skill helps teams avoid trusting client-side assertions and implements server-side validation of DeviceCheck tokens and App Attest attestations/assertions to reduce account takeover, fraudulent transactions, and replay attacks.

Core Features & Use Cases

  • DCDevice tokens: generate and send device tokens to a server to read or set two per-device bits for simple flags like promotional claims or fraud markers.
  • App Attest key lifecycle: generate Secure Enclave-backed keys, persist keyId, perform attestation with Apple's servers, and store the public key and receipt server-side.
  • Assertion verification: generate per-request assertions that sign clientDataHash, verify CBOR-encoded assertions on the server, validate signatures against stored public keys, and enforce counter-based replay protection.
  • Server responsibilities: challenge endpoints, attestation verification (certificate chain vs Apple's App Attest root CA), CBOR parsing, clientDataHash matching, counter tracking, and retry/backoff strategies for transient DCError failures.
  • Use Case: protect high-risk endpoints (payments, account changes) by requiring an attested assertion with server-side verification and falling back to DeviceCheck tokens for unsupported devices.

Quick Start

Use the device-integrity skill to validate an App Attest attestation and verify an assertion for a sensitive API request.

Frequently Asked Questions about device-integrity

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify App Attest assertions on a server to prevent iOS app fraud?▼

To verify App Attest assertions on a server, validate CBOR-encoded assertions against stored Secure Enclave public keys, match clientDataHash values, and enforce counter-based replay protection for high-risk endpoints like payments.

What is the difference between DeviceCheck tokens and App Attest for device verification?▼

DeviceCheck tokens allow setting per-device fraud markers, while App Attest provides Secure Enclave-backed key generation and per-request assertion verification to prove app authenticity and unmodified client state.

How do I validate an App Attest certificate chain against Apple's root CA?▼

Validating an App Attest certificate chain requires decoding the attestation object, verifying the certificate chain against Apple's App Attest root CA, and confirming the clientDataHash matches the expected challenge.

Can I use DeviceCheck tokens as a fallback for unsupported devices during app attestation?▼

Yes, you can implement a fallback to DCDevice tokens for unsupported devices, applying exponential backoff strategies for transient DCError failures while reserving App Attest assertions for high-risk endpoints.

Why does my server need counter-based replay protection for App Attest assertions?▼

Counter-based replay protection is required for App Attest assertions to prevent attackers from reusing intercepted valid assertions, ensuring each per-request signature for account changes or purchases is unique.