Skip to content

feat: support Google Play Integrity attestation#13

Merged
Malith-19 merged 1 commit into
thunder-id:mainfrom
Malith-19:feat/play-integrity-attestation
Jul 22, 2026
Merged

feat: support Google Play Integrity attestation#13
Malith-19 merged 1 commit into
thunder-id:mainfrom
Malith-19:feat/play-integrity-attestation

Conversation

@Malith-19

@Malith-19 Malith-19 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Purpose

Native (app-native, Flow Execution API) sign-in and sign-up requests have no way to prove they originate from a genuine, unmodified install of the app — anyone can call /flow/execute directly with a valid applicationId. This adds support for attaching a platform attestation token (e.g. Google Play Integrity) to flow-initiate requests.

Approach

  • Add ThunderIDConfig.attestationTokenProvider: (suspend () -> String)? — an app-supplied hook, since obtaining a platform attestation token is app/platform-specific and shouldn't live in the core SDK.
  • ThunderIDClient.signIn/signUp invoke the provider (when set) and pass the resulting token to FlowExecutionClient.initiate, which attaches it as an Attestation-Token header.
  • Wire the quickstart sample to Google Play Integrity's Standard API via a new PlayIntegrityTokenProvider, configured through THUNDERID_ATTESTATION_ENABLED / THUNDERID_CLOUD_PROJECT_NUMBER in config.properties.
  • Add unit test coverage for the new header plumbing in ThunderIDClientTest and SignInTest.
  • Rebased onto latest main and resolved a conflict in SignIn.kt's action/component matching logic (kept main's existing implementation, just widened enrichActions visibility to internal for the new test).

Related Issues

Related PRs

  • N/A

Checklist

  • Followed the contribution guidelines.
  • Manual test round performed and verified.
  • Documentation provided.
  • Tests provided.
    • Unit Tests
    • Integration Tests
  • Breaking changes.

Security checks

  • Followed secure coding standards in WSO2 Secure Coding Guidelines
  • Confirmed that this PR doesn't commit any keys, passwords, tokens, usernames, or other secrets.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Malith-19, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f66de94-6625-44d1-8b94-3c0bf3d90425

📥 Commits

Reviewing files that changed from the base of the PR and between 2e558c1 and 2a6d9eb.

📒 Files selected for processing (12)
  • samples/quickstart/README.md
  • samples/quickstart/build.gradle.kts
  • samples/quickstart/config.properties.example
  • samples/quickstart/src/main/kotlin/dev/thunderid/quickstart/MainActivity.kt
  • samples/quickstart/src/main/kotlin/dev/thunderid/quickstart/PlayIntegrityTokenProvider.kt
  • src/main/kotlin/dev/thunderid/android/ThunderIDClient.kt
  • src/main/kotlin/dev/thunderid/android/ThunderIDConfig.kt
  • src/main/kotlin/dev/thunderid/android/auth/FlowExecutionClient.kt
  • src/main/kotlin/dev/thunderid/android/http/HttpClient.kt
  • src/main/kotlin/dev/thunderid/compose/components/presentation/auth/SignIn.kt
  • src/test/kotlin/dev/thunderid/android/ThunderIDClientTest.kt
  • src/test/kotlin/dev/thunderid/compose/components/presentation/auth/SignInTest.kt
📝 Walkthrough

Walkthrough

ThunderID Android SDK configuration now supports flow secrets and platform attestation. Flow requests can carry custom headers, the quickstart mints Play Integrity tokens, and Compose action matching accepts additional identifier combinations.

Changes

Android SDK and quickstart updates

Layer / File(s) Summary
Flow attestation and header transport
src/main/kotlin/dev/thunderid/android/..., src/test/kotlin/dev/thunderid/android/...
ThunderIDConfig and ThunderIDClient support flow secrets and attestation providers. Embedded flows obtain tokens, and FlowExecutionClient passes Flow-Secret and Attestation-Token headers through HttpClient.
Quickstart attestation setup
samples/quickstart/...
Quickstart configuration, Gradle wiring, Play Integrity token generation, app initialization, and setup documentation now support attestation and flow secrets.
Expanded Compose action matching
src/main/kotlin/dev/thunderid/compose/..., src/test/kotlin/dev/thunderid/compose/...
Action enrichment and rendering match component IDs and references against action IDs and references, with new matching tests.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ThunderIDClient
  participant PlayIntegrityTokenProvider
  participant FlowExecutionClient
  participant HttpClient
  ThunderIDClient->>PlayIntegrityTokenProvider: requestToken()
  PlayIntegrityTokenProvider-->>ThunderIDClient: integrity token
  ThunderIDClient->>FlowExecutionClient: initiate with token
  FlowExecutionClient->>HttpClient: POST /flow/execute with custom headers
  HttpClient-->>FlowExecutionClient: flow response
Loading

Possibly related PRs

Suggested reviewers: brionmario, udeshathukorala

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly names the main change: Google Play Integrity attestation support.
Description check ✅ Passed The description matches the template sections and covers purpose, approach, issues, checklist, and security checks.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@samples/quickstart/README.md`:
- Around line 11-49: Specify the properties language on the fenced configuration
block in the quickstart README by changing its opening fence to use properties
syntax highlighting, while leaving the configuration contents unchanged.

In `@samples/quickstart/src/main/kotlin/dev/thunderid/quickstart/MainActivity.kt`:
- Around line 41-53: Remove the trailing comma from the final argument at
MainActivity.kt lines 41-53 after allowInsecureConnections = BuildConfig.DEBUG.
Also remove the trailing commas at PlayIntegrityTokenProvider.kt lines 46-52
after .build() and ThunderIDClientTest.kt lines 105-110 after
attestationTokenProvider = { "test-token" }; no other call-site formatting
changes are needed.
- Around line 37-50: Update the PlayIntegrityTokenProvider construction in
MainActivity to pass applicationContext instead of the Activity this reference,
while leaving the ThunderIDConfig wiring and token-provider callback unchanged.

In `@src/main/kotlin/dev/thunderid/android/auth/FlowExecutionClient.kt`:
- Around line 59-61: Wrap the `attestationTokenHeaders` function declaration and
expression across multiple lines so each line remains within the 120-character
limit, preserving its current nullable-token header mapping behavior.

In
`@src/main/kotlin/dev/thunderid/compose/components/presentation/auth/SignIn.kt`:
- Around line 143-147: Extract the repeated FlowAction-to-FlowComponent
predicate into a private FlowAction.matches helper in SignIn.kt. Update
src/main/kotlin/dev/thunderid/compose/components/presentation/auth/SignIn.kt
lines 143-147 in enrichActions and lines 332-336 in ActionComponentView to call
this helper, preserving the existing matching order and behavior at both sites.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4414eb7d-7448-4288-8b41-9bbd4fac329b

📥 Commits

Reviewing files that changed from the base of the PR and between b069ba4 and 2e558c1.

📒 Files selected for processing (12)
  • samples/quickstart/README.md
  • samples/quickstart/build.gradle.kts
  • samples/quickstart/config.properties.example
  • samples/quickstart/src/main/kotlin/dev/thunderid/quickstart/MainActivity.kt
  • samples/quickstart/src/main/kotlin/dev/thunderid/quickstart/PlayIntegrityTokenProvider.kt
  • src/main/kotlin/dev/thunderid/android/ThunderIDClient.kt
  • src/main/kotlin/dev/thunderid/android/ThunderIDConfig.kt
  • src/main/kotlin/dev/thunderid/android/auth/FlowExecutionClient.kt
  • src/main/kotlin/dev/thunderid/android/http/HttpClient.kt
  • src/main/kotlin/dev/thunderid/compose/components/presentation/auth/SignIn.kt
  • src/test/kotlin/dev/thunderid/android/ThunderIDClientTest.kt
  • src/test/kotlin/dev/thunderid/compose/components/presentation/auth/SignInTest.kt

Comment thread samples/quickstart/README.md
Comment thread src/main/kotlin/dev/thunderid/android/auth/FlowExecutionClient.kt Outdated
Comment thread src/main/kotlin/dev/thunderid/compose/components/presentation/auth/SignIn.kt Outdated
@Malith-19
Malith-19 force-pushed the feat/play-integrity-attestation branch from 2e558c1 to 724c62f Compare July 20, 2026 03:51
Native sign-in/sign-up flows had no way to prove they originate from
a genuine, unmodified app install. Add an attestationTokenProvider
hook on ThunderIDConfig; when set, its token is attached to
flow-initiate requests via an Attestation-Token header. The
quickstart sample wires this to the Play Integrity Standard API.
@Malith-19
Malith-19 merged commit 268ef26 into thunder-id:main Jul 22, 2026
6 checks passed
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.

Support Android and IOS SDK and samples to support attestation feature.

2 participants