Communityコーディング&開発github.com

dpearson2699/デバイス整合性

DeviceCheck(DCDeviceのデバイス単位ビット)とApp Attest(DCAppAttestServiceのキー生成、アテステーション、アサーションフロー)を使用して、デバイスの正当性とアプリの整合性を検証します。不正防止の実装、改ざんされたデバイスの検出、Appleのサーバーによるアプリの真正性の検証、アテステーションされたリクエストによる機密性の高いAPIエンドポイントの保護、またはバックエンドアーキテクチャへのデバイス検証の追加に使用します。

デバイス整合性 とは?

このスキルは、AppleのDeviceCheckとApp Attestフレームワークを活用して、iOS/macOSアプリにおけるデバイスとアプリの整合性を検証するための包括的なソリューションを提供します。開発者は、DCDeviceを使用してプライベートなデバイスごとのビットを設定・照会し、改ざんやジェイルブレイクの兆候を検出できます。また、DCAppAttestServiceを使用して、公開鍵の生成、アテステーション(デバイスとアプリの真正性の証明)、APIリクエストを保護するためのアサーションを作成するエンドツーエンドのワークフローを実装できます。このスキルは、不正防止、機密性の高いバックエンドエンドポイントの保護、そして改ざんされたデバイスからの悪意のあるリクエストの防止を目的としています。Appleのサーバーと統合することで、サーバー側でアテステーション結果を検証するためのガイダンスを提供し、実稼働環境に対応したセキュアなモバイルアプリバックエンドを構築したい開発者にとって理想的です。

対応~Claude Code~Codex CLI~Cursor
Part ofMobile
npx skills add https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/device-integrity

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

デバイス整合性 は何をしますか?

DeviceCheck(DCDeviceのデバイス単位ビット)とApp Attest(DCAppAttestServiceのキー生成、アテステーション、アサーションフロー)を使用して、デバイスの正当性とアプリの整合性を検証します。不正防止の実装、改ざんされたデバイスの検出、Appleのサーバーによるアプリの真正性の検証、アテステーションされたリクエストによる機密性の高いAPIエンドポイントの保護、またはバックエンドアーキテクチャへのデバイス検証の追加に使用します。

概要

AppleのDeviceCheckおよびApp Attestフレームワークは、iOSアプリとmacOSアプリの整合性を検証し、不正な改ざんや再パッケージングを検出するための強力なツールを提供します。このスキルは、これらのフレームワークを活用して、強固な不正防止システムを構築するための実践的な実装戦略を提供します。

主な機能

  • デバイスごとのビット: DCDeviceを使用して、Appleが提供するプライベートなストレージにデバイスごとのビットを設定および照会します。これは、デバイスの状態(例:デバイスが既にサインアップしたかどうか)を追跡するのに役立ちます。
  • アプリアテステーション: DCAppAttestServiceを使用して、アプリインスタンスの真正性を検証します。このプロセスには、公開鍵の生成、アテステーションの取得、リクエストを保護するためのアサーションの作成が含まれます。
  • サーバー側検証: アテステーションとアサーションを検証するためのサーバー側エンドポイントを実装するためのガイダンスを提供し、信頼できるリクエストのみがバックエンドに到達することを保証します。

ワークフロー

  1. キー生成: DCAppAttestServiceを呼び出して、アプリインスタンスごとに一意の公開鍵を生成します。
  2. アテステーション: 生成された公開鍵をAppleのサーバーに送信して、アテステーションオブジェクトを取得します。アテステーションは、デバイスとアプリが改ざんされていないことを証明します。
  3. アサーション: バックエンドAPIに送信する各リクエストに対して、アテステーションされた鍵を使用してアサーションを生成します。アサーションには、リクエスト固有のデータが含まれ、リプレイ攻撃を防止します。
  4. サーバー側検証: サーバー側エンドポイントで、DCAppAttestServiceの検証ロジックを使用してアサーションを検証し、リクエストを処理します。

実装の詳細

DeviceCheckの使用

import DeviceCheck

let device = DCDevice.current
if device.isSupported {
    // デバイスごとのビットを設定または照会
    device.generateToken(completionHandler: { token, error in
        // トークンをサーバーに送信して処理
    })
}

App Attestの使用

import DeviceCheck

let service = DCAppAttestService.shared
if service.isSupported {
    // キー生成
    service.generateKey { keyId, error in
        guard let keyId = keyId else { return }
        
        // アテステーションの取得
        service.attestKey(keyId, clientDataHash: hash) { attestation, error in
            // アテステーションをサーバーに送信
        }
        
        // アサーションの生成
        service.generateAssertion(keyId, clientDataHash: hash) { assertion, error in
            // アサーションをリクエストに添付
        }
    }
}

サポートされるプラットフォーム

  • iOS 11.0+
  • macOS 10.13+
  • tvOS 11.0+
  • watchOS 4.0+

ベストプラクティス

  • 常にデバイスがDCDeviceおよびDCAppAttestServiceをサポートしているかどうかを確認してから、プライベートAPIを呼び出してください。
  • サーバー側では、Appleの公開鍵を使用してアテステーションとアサーションの真正性を検証します。
  • アサーションにリクエスト固有のチャレンジ(例:nonce、タイムスタンプ)を含めて、リプレイ攻撃を防止します。
  • バックエンドでアテステーションの結果を安全にキャッシュして、ネットワークラウンドトリップを最小限に抑えます。

詳細情報

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

dpearson2699/accessorysetupkit

Discover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions.

dpearson2699/activitykit

Implement, review, or improve Live Activities and Dynamic Island experiences in iOS apps using ActivityKit. Use when building real-time updating widgets for the Lock Screen and Dynamic Island — delivery tracking, sports scores, ride-sharing status, workout timers, media playback, or any time-sensitive information that updates in real time. Also use when working with ActivityKit, ActivityAttributes, Activity lifecycle (request/update/end), Dynamic Island layouts (compact/minimal/expanded), push-to-update Live Activities, or Lock Screen live widgets.

dpearson2699/adattributionkit

Measure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks, updating conversion values, implementing re-engagement attribution, configuring publisher or advertiser apps, or replacing SKAdNetwork with AdAttributionKit for ad measurement.

dpearson2699/alarmkit

Implement AlarmKit alarms and countdown timers for iOS and iPadOS with Lock Screen, Dynamic Island, and Apple Watch system UI. Covers AlarmManager scheduling, AlarmAttributes and AlarmPresentation, AlarmButton stop and snooze actions, authorization, state observation, and Live Activity integration. Use when building wake-up alarms, countdown timers, or alarm-style alerts that need Apple's system alarm experience.

dpearson2699/app-clips

Build iOS App Clips with invocation URLs, App Clip Codes, NFC, QR codes, Safari banners, Maps, Messages, target setup, App Store Connect experiences, size/capability constraints, NSUserActivity routing, SKOverlay promotion, App Group/keychain handoff, ephemeral notifications, location confirmation, and full-app migration. Use when creating App Clips or wiring App Clip invocation, experience configuration, or full-app handoff.

dpearson2699/app-intents

Implement App Intents for Siri, Shortcuts, Spotlight, widgets, Control Center, and Apple Intelligence on iOS. Covers AppIntent actions, AppEntity and EntityQuery models, AppShortcutsProvider phrases, IndexedEntity Spotlight indexing, WidgetConfigurationIntent, SnippetIntent, and assistant schemas. Use when exposing app actions or entities to system surfaces.

dpearson2699/apple-on-device-ai

Integrate on-device AI using Foundation Models framework, Core ML, and open-source LLM runtimes on Apple Silicon. Covers Foundation Models (LanguageModelSession, @Generable, @Guide, SystemLanguageModel, structured output, tool calling), Core ML (coremltools, model conversion, quantization, palettization, pruning, Neural Engine, MLTensor), MLX Swift (transformer inference, unified memory), and llama.cpp (GGUF, cross-platform LLM). Use when building tool-calling AI features, working with guided generation schemas, converting models, or running on-device inference.

dpearson2699/appmigrationkit

Transfer app data to or from other platforms using AppMigrationKit. Use when implementing system-orchestrated one-time migration between iOS and Android or another platform, building an AppMigrationExtension, packaging transportable resources with ResourcesArchiver, importing resources on the destination device, reporting import progress, handling migration errors and app group cleanup, checking MigrationStatus, or testing migration code with AppMigrationTester.

dpearson2699/app-store-review

Prepare for App Store review and prevent rejections. Covers App Store review guidelines, app rejection reasons, PrivacyInfo.xcprivacy privacy manifest requirements, required API reason codes, in-app purchase IAP and StoreKit rules, App Store Guidelines compliance, ATT App Tracking Transparency, EU DMA Digital Markets Act, HIG compliance checklist, app submission preparation, review preparation, metadata requirements, entitlements, widgets, and Live Activities review rules. Use when preparing for App Store submission, fixing rejection reasons, auditing privacy manifests, implementing ATT consent flow, configuring StoreKit IAP, or checking HIG compliance.

dpearson2699/audioaccessorykit

Support audio accessory features like automatic switching using AudioAccessoryKit. Use when implementing automatic audio routing for paired accessories, registering audio accessory configuration from the container app, updating placement or connected audio source identifiers from an app extension, or handling AccessoryControlDevice capabilities and errors.

dpearson2699/authentication

Implement iOS authentication flows with AuthenticationServices and LocalAuthentication. Use when building Sign in with Apple, passkey/WebAuthn registration or sign-in with ASAuthorizationPlatformPublicKeyCredentialProvider, ASAuthorizationController credential state and revocation handling, ASWebAuthenticationSession OAuth or third-party login, Password AutoFill, identity-token server validation, or local biometric re-authentication with LAContext.

dpearson2699/avkit

Create media playback experiences using AVKit. Use when adding video players with AVPlayerViewController, enabling Picture-in-Picture, routing media with AirPlay, using SwiftUI VideoPlayer views, configuring transport controls, displaying subtitles and closed captions, or integrating AVFoundation playback with system UI.

dpearson2699/background-processing

Schedule and execute background work on iOS using BGTaskScheduler. Use when registering BGAppRefreshTask for short background fetches, BGProcessingTask for long-running maintenance, BGContinuedProcessingTask (iOS 26+) for foreground-started work that continues in background, background URLSession downloads, or background push notifications. Covers Info.plist configuration, expiration handling, task completion, and debugging with simulated launches.

dpearson2699/browserenginekit

Build alternative browser engines using BrowserEngineKit. Use when developing a non-WebKit browser engine for iOS/iPadOS in supported regions, managing web content/rendering/networking extension processes, configuring GPU and networking process capabilities, checking alternative-engine device eligibility, or reviewing BrowserEngineKit entitlements and Info.plist setup.

dpearson2699/callkit

Implement VoIP calling with CallKit and PushKit. Use when building incoming/outgoing call flows, registering for VoIP push notifications, configuring CXProvider and CXCallController, handling call actions, coordinating audio sessions, or creating Call Directory extensions for caller ID and call blocking.

dpearson2699/carplay

Build CarPlay-enabled apps using the CarPlay framework. Use when creating navigation, audio, communication, EV charging, parking, or food ordering apps for the car display, working with CPTemplateApplicationScene, CPInterfaceController template hierarchies, CPListTemplate, CPMapTemplate, CPNowPlayingTemplate, configuring CarPlay entitlements, or integrating with CarPlay Simulator for testing.

dpearson2699/cloudkit

Implement, review, or improve CloudKit and iCloud sync in iOS/macOS apps. Use when working with CKContainer, CKRecord, CKQuery, CKSubscription, CKSyncEngine, CKShare, NSUbiquitousKeyValueStore, or iCloud Drive file coordination; when syncing SwiftData models via ModelConfiguration with cloudKitDatabase; when handling CKError codes for conflict resolution, network failures, or quota limits; or when checking iCloud account status before performing sync operations.

dpearson2699/contacts-framework

Read, create, update, and pick contacts using the Contacts and ContactsUI frameworks. Use when fetching contact data, saving new contacts, wrapping CNContactPickerViewController in SwiftUI, handling contact permissions, or working with CNContactStore fetch and save requests.

dpearson2699/core-bluetooth

Build direct Bluetooth Low Energy workflows with Core Bluetooth. Use when implementing BLE central or peripheral GATT communication, scanning or connecting with CBCentralManager, discovering services and characteristics, reading/writing/subscribing with CBPeripheral, publishing local services with CBPeripheralManager, handling Bluetooth authorization, background BLE modes, state restoration, write flow control, or CBUUID-based workflows. For privacy-preserving accessory setup/picker flows, use accessorysetupkit first and return here for post-setup GATT communication.

dpearson2699/coreml

Integrate Core ML models in iOS apps for on-device machine learning inference. Covers model loading (.mlmodel, .mlpackage, .mlmodelc), predictions with auto-generated classes and MLFeatureProvider, compute unit configuration (CPU, GPU, Neural Engine), MLTensor, VNCoreMLRequest, MLComputePlan, multi-model pipelines, and deployment strategies. Use when loading Core ML models, making predictions, configuring compute units, or profiling model performance.

関連スキル