Android Setup & Backend-Verifizierung
Einen Setup-Vorschlag mit den Installationsanweisungen und der vollständigen Markdown-Anleitung für diesen Plugin kopieren.
Android-native System verwendet
Abschnitt mit dem Titel “Android-native System verwendet”Bei Android verwendet dieses Plugin Google Play Integrity Standard API:
prepareIntegrityTokenwährendprepare()requestStandardIntegrityTokenfürcreateAttestation()undcreateAssertion()
Anforderungen
Abschnitt mit dem Titel “Anforderungen”- Android-App, die über das Google Play-Ökosystem verteilt wird
- Google Play-Dienste sind auf dem Gerät verfügbar
- Play Integrity API ist für Ihre App aktiviert
- Google Cloud-Projekt-ID ist konfiguriert
Google-Einrichtung
Abschnitt mit dem Titel “Google-Einrichtung”- Aktivieren Play Integrity API in Ihrem Google Cloud-Projekt.
- Öffnen Sie das Play Console und konfigurieren Sie den Zugriff auf Play Integrity für Ihre App.
- Bereitstellen
cloudProjectNumberdem Plugin.
Capacitor Konfiguration
Abschnitt mit dem Titel “Capacitor Konfiguration”plugins: { AppAttest: { cloudProjectNumber: '123456789012', },}Sie können auch cloudProjectNumber pro Aufruf in den Methode-Optionen.
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 entschlüsselt werden.
Hintergrundablauf (Android)
Abschnitt mit dem Titel ‘Hintergrundablauf (Android)’Registrierung (createAttestation)
Abschnitt mit dem Titel ‘Registrierung (createAttestation)’- Hintergrund erstellt einen einmaligen
challenge. - Die App ruft
createAttestation({ keyId, challenge }). - Hintergrund ruft Google
decodeIntegrityTokenAPI. - Hintergrund überprüft mindestens:
requestDetails.requestHash === base64url(SHA256(challenge))appIntegrity.packageNameentspricht Ihrer Android-Anwendungs-IDappIntegrity.certificateSha256Digestenthält Ihren Release-Signierungszertifikats-Digest- Integritätsurteile entsprechen Ihrer Sicherheitspolitik
Anfrage schützen (createAssertion)
Abschnitt mit dem Titel “Anfrage schützen (createAssertion)”- Hintergrund erstellt einen einmaligen
payload. - App ruft
createAssertion({ keyId, payload }). - Hintergrund entschlüsselt Token und überprüft
requestHash === base64url(SHA256(payload)). - Einschränken Sie die Wiederholungsprävention (eine-time + TTL) und die Integritätsurteilsrichtlinie.
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 policyMinimal Backend-Payload-Vertrag
Abschnitt: Minimal Backend-Payload-VertragRegistrierung:
{ "platform": "android", "format": "google-play-integrity-standard", "keyId": "string", "challenge": "string", "token": "string"}Behauptung:
{ "platform": "android", "format": "google-play-integrity-standard", "keyId": "string", "payload": "string", "token": "string"}Weitermachen von Android Setup & Backend-Verifizierung
Abschnitt: Weitermachen von Android Setup & Backend-VerifizierungWenn Sie Sicherheit und Compliance planen, verbinden Sie es mit Android Setup & Backend-Verifizierung um es mit Verwenden Sie @capgo/capacitor-app-attest für die native Fähigkeit in @capgo/capacitor-app-attest Verschlüsselung für die Implementierungsdetails in Verschlüsselung Kongruenz für die Implementierungsdetails in Kongruenz Capgo Sicherheits-Scanner für den Produktworkflow in Capgo Sicherheits-Scanner, und Capgo Sicherheit für den Produktworkflow in Capgo Sicherheit.