Skip to content

feat(integrity): add Play Integrity API integration#75

Merged
lanthoor merged 1 commit into
mainfrom
feat/play-integrity
May 24, 2026
Merged

feat(integrity): add Play Integrity API integration#75
lanthoor merged 1 commit into
mainfrom
feat/play-integrity

Conversation

@lanthoor
Copy link
Copy Markdown
Owner

Summary

  • Hybrid Play Integrity check: backend-verified classic path first, falls back to on-device standard request when offline
  • Blocks app on Red verdict (rooted device / sideloaded APK) with a friendly error screen showing the reason
  • Green/Yellow/Unknown verdicts proceed normally
  • All checks skipped in debug builds for frictionless local/AVD testing
  • Secrets injected via CI env vars, with local.properties fallback for dev

New Files

File Purpose
domain/model/IntegrityVerdict.kt Sealed class: Green / Yellow / Red / Unknown
domain/repository/PlayIntegrityRepository.kt Repository interface
data/repository/PlayIntegrityRepositoryImpl.kt Hybrid path implementation with debug bypass
data/remote/BackendIntegrityApi.kt Retrofit service for backend
data/remote/dto/IntegrityDto.kt Request/response DTOs
di/NetworkModule.kt Hilt module for OkHttp + Retrofit
di/IntegrityModule.kt Hilt module binding repository
ui/viewmodels/IntegrityViewModel.kt HiltViewModel, runs check on init, catches errors
ui/screens/IntegrityBlockScreen.kt Block screen with error details + retry + action guidance

Modified Files

File Change
gradle/libs.versions.toml Added play-integrity, retrofit, okhttp deps
app/build.gradle.kts Dependencies + env/local.properties-based BuildConfig
app/proguard-rules.pro Keep rules for Play Integrity + Retrofit
app/src/main/res/values/strings.xml Block screen strings
MainActivity.kt IntegrityViewModel wired in, gates UI before initialization
.github/workflows/release.yml Inject secrets for release builds

Hybrid approach: tries backend-verified classic path first, falls
back to on-device standard request when offline. Blocks app on Red
verdict (rooted device / sideloaded APK). Green/yellow/unknown
verdicts proceed normally.

Secrets priority: CI env vars -> local.properties -> safe defaults.
All checks skipped in debug builds for frictionless local/AVD testing.

Requires: GCP Cloud Function backend for token decryption.
@lanthoor lanthoor enabled auto-merge (squash) May 24, 2026 06:44
@lanthoor lanthoor merged commit 926082f into main May 24, 2026
15 checks passed
@lanthoor lanthoor deleted the feat/play-integrity branch May 24, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant