Android-Setup & Backend-Verifizierung
Kopiere einen Setup-Prompt mit den Installationsschritten und dem vollständigen Markdown-Guide für dieses Plugin.
Genutztes Android-Native-System
Abschnitt mit dem Titel „Verwendetes Android-Nativesystem“Auf Android verwendet dieses Plugin Google Play Integrity Standard API:
prepareIntegrityTokenwährendprepare()requestStandardIntegrityTokenfürcreateAttestation()undcreateAssertion()
Anforderungen
Abschnitt „Voraussetzungen“- Android-App, die über das Google-Play-Ökosystem verteilt wird
- Google Play-Dienste auf dem Gerät verfügbar
- Play Integrity API für Ihre App aktiviert
- Google-Cloud-Projektnummer konfiguriert
Google-Setup
Abschnitt mit dem Titel „Google-Einrichtung“- Aktivieren Play Integrity API in Ihrem Google-Cloud-Projekt.
- Öffnen Sie die Play Console und konfigurieren Sie den Play-Integrity-Zugriff für Ihre App.
- Bieten Sie
cloudProjectNumberan das Plugin.
Capacitor Konfiguration
Abschnitt mit dem Titel „Capacitor-Konfiguration“plugins: { AppAttest: { cloudProjectNumber: '123456789012', },}Du kannst auch cloudProjectNumber pro Aufruf in den Method-Optionen übergeben.
Client-Flow
Abschnitt mit dem Titel „Client-Flow“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 ist ein Play-Integrity-Token und muss serverseitig dekodiert werden.
Backend-Workflow (Android)
Abschnitt mit dem Titel „Backend-Workflow (Android)“Registrierung (createAttestation)
Abschnitt mit dem Titel „Registrierung (createAttestation)“- Backend erstellt einmalig
challenge. - App ruft auf
createAttestation({ keyId, challenge }). - Backend ruft Google auf
decodeIntegrityTokenAPI. - Das Backend prüft mindestens:
requestDetails.requestHash === base64url(SHA256(challenge))appIntegrity.packageNameentspricht deiner Android-Anwendungs-IDappIntegrity.certificateSha256Digestenthält den Digest deines Release-Signierungszertifikats- Integritätsurteile entsprechen deiner Sicherheitsrichtlinie
Schutz anfordern (createAssertion)
Abschnitt mit dem Titel „Schutz anfordern (createAssertion)“- Backend erstellt einmalig
payload. - App ruft auf
createAssertion({ keyId, payload }). - Backend dekodiert Token und prüft
requestHash === base64url(SHA256(payload)). - Replay-Schutz (Single-Use + TTL) und Integrity-Verdict-Policy erzwingen.
Android-Schema
Abschnitt mit dem Titel „Android-Schema“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 policyMinimaler Backend-Payload-Contract
Abschnitt mit dem Titel „Minimaler Backend-Payload-Contract“Registrierung:
{ "platform": "android", "format": "google-play-integrity-standard", "keyId": "string", "challenge": "string", "token": "string"}Assertion:
{ "platform": "android", "format": "google-play-integrity-standard", "keyId": "string", "payload": "string", "token": "string"}Weiter geht's mit Android Setup & Backend Verification
Abschnitt mit dem Titel „Weiter geht's mit Android Setup & Backend Verification“Wenn du es nutzt Android Setup & Backend Verification um Sicherheit und Compliance zu planen, verbinden Sie es mit @capgo/capacitor-app-attest verwenden für die native Funktion in „@capgo/capacitor-app-attest verwenden“, Verschlüsselung für die Implementierungsdetails in Encryption, Compliance für das Implementierungsdetail in Compliance, Capgo Security-Scanner für den Produkt-Workflow im Capgo Security Scanner, und Capgo Sicherheit für den Produkt-Workflow in Capgo Security.