Android セットアップ & バックエンド検証
このプラグインのインストール手順とマークダウンガイドをコピーする
Androidで使用されるネイティブシステム
「Androidネイティブシステム使用」セクションAndroidでは、このプラグインは Google Play Integrity Standard API:
prepareIntegrityToken期間中prepare()requestStandardIntegrityToken目的createAttestation()そしてcreateAssertion()
要件
要件- Google Playエコシステムを通じて配布されるAndroidアプリ
- デバイス上のGoogle Playサービスが利用可能
- Play Integrity APIがアプリに有効
- Google Cloudプロジェクト番号が設定
Google設定
有効化- context Play Integrity API Google Cloud プロジェクト内で使用してください。
- Play Consoleを開き、プレイ インテグリティへのアクセスをアプリケーションに設定してください。
- 提供
cloudProjectNumberプラグインに
Capacitor config
セクション「Capacitor config」plugins: { AppAttest: { cloudProjectNumber: '123456789012', },}オプションのメソッドで、 cloudProjectNumber パラメータを指定することもできます。
クライアント フロー
クライアントフロー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)
バックエンドは1回限りの- アプリは
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のセットアップとバックエンド検証Capacitorを使用している場合 Capacitorを使用してセキュリティとコンプライアンスを計画する場合 Capacitorを使用してセキュリティとコンプライアンスを計画する場合 Using @capgo/capacitor-app-attest for the native capability in Using @capgo/capacitor-app-attest, 暗号化 暗号化の実装詳細のための 法的合致 法的合致の実装詳細のための Capgo セキュリティ スキャナ Capgo セキュリティ スキャナの製品ワークフロー Capgo セキュリティ Capgo セキュリティの製品ワークフロー