Android セットアップ & バックエンド検証
このプラグインのインストール手順とフルマークダウンガイドを含むセットアッププロンプトをコピーします。
Androidで使用されるネイティブシステム
「Androidで使用されるネイティブシステム」というセクションAndroidでは、このプラグインは Google Play Integrity Standard API:
prepareIntegrityToken期間中prepare()requestStandardIntegrityToken目的createAttestation()そしてcreateAssertion()
要件
要件- AndroidアプリはGoogle Playエコシステムを通じて配布されます。
- デバイス上で利用可能なGoogle Playサービス
- Play Integrity API がアプリに有効化されています。
- Google Cloud プロジェクト番号が設定されています。
Google設定
設定- 有効化 Play Integrity API Google Cloud プロジェクト内で使用してください。
- Play Consoleを開き、Play Integrity アクセスをアプリに設定してください。
- 提供
cloudProjectNumberプラグインに
Capacitor config
セクション「Capacitor config」plugins: { AppAttest: { cloudProjectNumber: '123456789012', },}オプションのメソッドで、__CAPGO_KEEP_0__ を 1 回あたり呼び出すこともできます。 cloudProjectNumber クライアントフロー
in your Google Cloud project.
クライアントフローimport { AppAttest } from '@capgo/capacitor-app-attest';
const { keyId } = await AppAttest.prepare({ cloudProjectNumber: '123456789012',});
const attestation = await AppAttest.createAttestation({ keyId, challenge: 'backend-registration-challenge',});
const assertion = await AppAttest.createAssertion({ keyId, payload: 'backend-request-payload',});token Play Integrity トークンであり、サーバー側でデコードする必要があります。
バックエンドワークフロー(Android)
バックエンドワークフロー(Android)登録(createAttestation)createAttestation)
バックエンドは一時- アプリは
challenge. - バックエンドはGoogle
createAttestation({ keyId, challenge }). - __CAPGO_KEEP_0__。
decodeIntegrityTokenAPI. - コピー
requestDetails.requestHash === base64url(SHA256(challenge))appIntegrity.packageNameAndroidアプリIDと等しくなります。appIntegrity.certificateSha256Digestリリース署名証明書のハッシュ値を含みます。- セキュリティポリシーと一致する完整性判定が得られます。
保護要求(createAssertion)createAssertion)
保護要求(createAssertion)- バックエンドが一時的な
payload. - アプリが
createAssertion({ keyId, payload }). - バックエンドがトークンをデコードし、
requestHash === base64url(SHA256(payload)). - 再生防止(シングルユース+TTL)と完整性判定ポリシーを強制します。
Androidスキーマ
AndroidスキーマsequenceDiagram participant App as Android App participant Plugin as AppAttest plugin participant PlaySDK as Play Integrity SDK participant BE as Backend participant Google as decodeIntegrityToken API
App->>Plugin: prepare(cloudProjectNumber) Plugin->>PlaySDK: prepareIntegrityToken() PlaySDK-->>Plugin: provider handle (keyId)
BE->>App: one-time challenge App->>Plugin: createAttestation(keyId, challenge) Plugin->>PlaySDK: requestStandardIntegrityToken(requestHash) PlaySDK-->>Plugin: integrity token Plugin-->>App: token + platform + format + keyId App->>BE: token + challenge + keyId BE->>Google: decodeIntegrityToken(token) Google-->>BE: decoded payload BE->>BE: verify requestHash + app identity + verdicts
BE->>App: one-time payload App->>Plugin: createAssertion(keyId, payload) Plugin->>PlaySDK: requestStandardIntegrityToken(requestHash) PlaySDK-->>Plugin: integrity token App->>BE: token + payload + keyId BE->>Google: decodeIntegrityToken(token) Google-->>BE: decoded payload BE->>BE: verify requestHash + replay policy最小のバックエンドペイロード契約
セクション「最小のバックエンドペイロード契約」登録:
{ "platform": "android", "format": "google-play-integrity-standard", "keyId": "string", "challenge": "string", "token": "string"}アサーション:
{ "platform": "android", "format": "google-play-integrity-standard", "keyId": "string", "payload": "string", "token": "string"}Androidセットアップ&バックエンド検証から続けて
セクション「Androidセットアップ&バックエンド検証から続けて」あなたが使用している場合 Androidセットアップ&バックエンド検証 セキュリティとコンプライアンスを計画するために使用している場合、 @capgo/capacitor-app-attest を接続する for the native capability in Using @capgo/capacitor-app-attest, 暗号化 暗号化の実装詳細のために 法的合致 法的合致の実装詳細のために Capgo Security Scanner for the product workflow in Capgo Security Scanner, and Capgo Security for the product workflow in Capgo Security.