Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play Integrity Playground #9926

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft

Play Integrity Playground #9926

wants to merge 10 commits into from

Conversation

toluo-stripe
Copy link
Contributor

@toluo-stripe toluo-stripe commented Jan 16, 2025

Summary

Open NativeLink

  • If: config.useAttestationEndpointsForLink, prepare integrityManager
    • If: integrityManager preparation fails, move to WebLink
    • else: make requests with (v1/consumers/mobile) (not part of this PR)
  • else
    • use NativeLink without attestation (v1/consumers/*) (only relevant in test mode)

This PR has a consumer service that can be shared. We would need to swap out the calls to linkAccountManager during sign up

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

simulating play attestation preparation failure

Screen.Recording.2025-01-16.at.7.05.08.PM.mov

Changelog

Copy link
Contributor

github-actions bot commented Jan 16, 2025

Diffuse output:

OLD: identity-example-release-base.apk (signature: V1, V2)
NEW: identity-example-release-pr.apk (signature: V1, V2)

          │          compressed          │         uncompressed         
          ├───────────┬───────────┬──────┼───────────┬───────────┬──────
 APK      │ old       │ new       │ diff │ old       │ new       │ diff 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
      dex │     2 MiB │     2 MiB │  0 B │   4.1 MiB │   4.1 MiB │  0 B 
     arsc │     1 MiB │     1 MiB │  0 B │     1 MiB │     1 MiB │  0 B 
 manifest │   2.3 KiB │   2.3 KiB │  0 B │     8 KiB │     8 KiB │  0 B 
      res │ 302.6 KiB │ 302.6 KiB │  0 B │ 456.7 KiB │ 456.7 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │  0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   7.2 KiB │   7.2 KiB │  0 B │   6.9 KiB │   6.9 KiB │  0 B 
    other │  90.4 KiB │  90.4 KiB │ +6 B │ 170.7 KiB │ 170.7 KiB │  0 B 
──────────┼───────────┼───────────┼──────┼───────────┼───────────┼──────
    total │   9.6 MiB │   9.6 MiB │ +6 B │  21.5 MiB │  21.5 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 19982 │ 19982 │ 0 (+0 -0) 
   types │  6194 │  6194 │ 0 (+0 -0) 
 classes │  4985 │  4985 │ 0 (+0 -0) 
 methods │ 29820 │ 29820 │ 0 (+0 -0) 
  fields │ 17539 │ 17539 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3624 │ 3624 │  0
APK
   compressed    │   uncompressed   │                                           
──────────┬──────┼───────────┬──────┤                                           
 size     │ diff │ size      │ diff │ path                                      
──────────┼──────┼───────────┼──────┼───────────────────────────────────────────
 28.5 KiB │ +5 B │  63.1 KiB │  0 B │ ∆ META-INF/CERT.SF                        
    269 B │ -3 B │     120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
  1.2 KiB │ +2 B │   1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA                       
 25.4 KiB │ +2 B │    63 KiB │  0 B │ ∆ META-INF/MANIFEST.MF                    
──────────┼──────┼───────────┼──────┼───────────────────────────────────────────
 55.3 KiB │ +6 B │ 127.4 KiB │  0 B │ (total)

Comment on lines +173 to +175
cloudProjectNumber = 577365562050, // stripe-payments-sdk-prod
logError = { message, error ->
Logger.getInstance(com.stripe.attestation.BuildConfig.DEBUG).error(message, error)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not a secret key

@toluo-stripe toluo-stripe changed the title Tolu/link/settings Play Integrity Playground Jan 16, 2025
Comment on lines +27 to +32
val usedNativeContract = intent?.getBooleanExtra(EXTRA_USED_NATIVE_CONTRACT, false) ?: false
return if (usedNativeContract) {
nativeLinkActivityContract.parseResult(resultCode, intent)
} else {
webLinkActivityContract.parseResult(resultCode, intent)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm considering reverting to a createLinkActivityResult to avoid this logic. I would add it to a LinkIntentParser.
Another way to do this is to check if

val redirectUri = intent?.data
if (redirectUri != null) {
// use web
} else {
// use native
}

This is probably the easiest solution and allows me to keep the parsing logic in its own contract.

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