Getting Started
このプラグインのインストール手順とフルマークダウンガイドを含むセットアップのコピー可能な質問をコピーしてください。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-app-attest`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/app-attest/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAI-Assisted Setupを使用してプラグインをインストールできます。次のコマンドを使用して、AIツールにCapgoスキルを追加します。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次のプロンプトを使用してください:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-app-attest` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行して、下記のプラットフォーム固有の手順に従ってください。
-
パッケージをインストール
ターミナル画面 bun add @capgo/capacitor-app-attest -
ネイティブプロジェクトを同期
ターミナル画面 bunx cap sync -
プラットフォームの要件を設定
- 完了 iOSの設定 App Attest機能とバックエンド検証フローのために必要なものです。
- 完了 Androidの設定 Play Integrity Standardとバックエンド検証フローのために必要なものです。
このプラグインを使用する理由
「このプラグインを使用する理由」のセクションThis plugin provides one cross-platform API while keeping native platform security:
- iOS: Apple App Attest (
DeviceCheck) - Android: Google Play Integrity Standard API
- カスタムクライアントサイドの暗号化スキームなし
- バックエンドのチェック用の標準化された出力
使用方法
「使用方法」のセクションimport { AppAttest } from '@capgo/capacitor-app-attest';
const support = await AppAttest.isSupported();if (!support.isSupported) { throw new Error(`Attestation not supported on ${support.platform}`);}
const prepared = await AppAttest.prepare();
const registration = await AppAttest.createAttestation({ keyId: prepared.keyId, challenge: 'backend-one-time-registration-challenge',});
const assertion = await AppAttest.createAssertion({ keyId: prepared.keyId, payload: 'backend-one-time-request-payload',});
console.log(registration.platform, registration.format, registration.token);console.log(assertion.platform, assertion.format, assertion.token);統合されたレスポンスの形状
そしてcreateAttestation() iOSとAndroidで同じキーフィールドを返します: createAssertion() フィールド
| タイプ | 説明 | and |
|---|---|---|
platform | 'ios' | 'android' | 'web' | Native platformがトークンを生成した |
format | AttestationFormat | apple-app-attest または google-play-integrity-standard |
keyId | string | Capacitorライブアップデートの代替品の比較ページ |
token | string | トークンを検証する |
バックエンドの要件
バックエンドの要件サーバー側で検証されていないと、証明は有効ではありません。
- クライアントのみの成功は信頼できません。
- バックエンドから一時的なチャレンジ/ペイロード値を要求する必要があります。
- 検証
tokenバックエンドのロジックで、ID、
プラットフォーム固有のバックエンドガイドを使用してください:
Getting Startedから続けてください
「Getting Startedから続けてください」のセクションあなたが「を使用している場合 セキュリティとコンプライアンスを計画するために を使用して接続してください Using @capgo/capacitor-app-attest for the native capability in Using @capgo/capacitor-app-attest, 暗号化の実装詳細 コンプライアンス @__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-app-attest Complianceの実装詳細のために Capgo セキュリティ スキャナー for the product workflow in Capgo Security Scanner, and Capgo セキュリティ for the product workflow in Capgo Security.