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

[FC] Prepares integrity on first sync call #9818

Conversation

carlosmuvi-stripe
Copy link
Collaborator

@carlosmuvi-stripe carlosmuvi-stripe commented Dec 21, 2024

Summary

Call Integrity#prepare on Activity A (FinancialConnectionsSheetActivity) and reuse the same Integrity instance in Activity B (FinancialConnectionsNativeActivity) when generating tokens.

Motivation

https://docs.google.com/document/d/1joKz5UZHLVazmecfMHbq6gB6n4wj5u8To6AtqYgq_tc/edit?tab=t.0#heading=h.cz1xkpga7giy

Testing

  • Manually verified
  • Added error tracking for failed integrity checks

@carlosmuvi-stripe carlosmuvi-stripe marked this pull request as ready for review December 21, 2024 09:56
@carlosmuvi-stripe carlosmuvi-stripe requested review from a team as code owners December 21, 2024 09:56
Copy link
Contributor

github-actions bot commented Dec 21, 2024

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 │ 301.8 KiB │ 301.8 KiB │   0 B │ 455.5 KiB │ 455.5 KiB │  0 B 
   native │   6.2 MiB │   6.2 MiB │   0 B │  15.8 MiB │  15.8 MiB │  0 B 
    asset │   7.1 KiB │   7.1 KiB │   0 B │   6.9 KiB │   6.9 KiB │  0 B 
    other │  90.2 KiB │  90.3 KiB │ +13 B │ 170.3 KiB │ 170.3 KiB │  0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼──────
    total │   9.6 MiB │   9.6 MiB │ +13 B │  21.5 MiB │  21.5 MiB │  0 B 

 DEX     │ old   │ new   │ diff      
─────────┼───────┼───────┼───────────
   files │     1 │     1 │ 0         
 strings │ 19971 │ 19971 │ 0 (+0 -0) 
   types │  6191 │  6191 │ 0 (+0 -0) 
 classes │  4982 │  4982 │ 0 (+0 -0) 
 methods │ 29772 │ 29772 │ 0 (+0 -0) 
  fields │ 17542 │ 17542 │ 0 (+0 -0) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  164 │  164 │  0   
 entries │ 3622 │ 3622 │  0
APK
    compressed    │   uncompressed   │                                           
──────────┬───────┼───────────┬──────┤                                           
 size     │ diff  │ size      │ diff │ path                                      
──────────┼───────┼───────────┼──────┼───────────────────────────────────────────
 28.5 KiB │ +16 B │  62.9 KiB │  0 B │ ∆ META-INF/CERT.SF                        
    269 B │  -3 B │     120 B │  0 B │ ∆ META-INF/version-control-info.textproto 
  1.2 KiB │  -1 B │   1.2 KiB │  0 B │ ∆ META-INF/CERT.RSA                       
 25.3 KiB │  +1 B │  62.8 KiB │  0 B │ ∆ META-INF/MANIFEST.MF                    
──────────┼───────┼───────────┼──────┼───────────────────────────────────────────
 55.2 KiB │ +13 B │ 127.1 KiB │  0 B │ (total)

@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch 2 times, most recently from 706894d to 04b27ef Compare December 23, 2024 11:52
@carlosmuvi-stripe carlosmuvi-stripe changed the title Prepares integrity on first sync call F Dec 23, 2024
@carlosmuvi-stripe carlosmuvi-stripe changed the title F [FC] Adds ActivityRetainedScope and broader singleton component Dec 23, 2024
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch 2 times, most recently from 69c825d to 1f9ede2 Compare December 23, 2024 12:12
@carlosmuvi-stripe carlosmuvi-stripe changed the base branch from master to carlosmuvi/12-21-adds-activity-retained-scope December 23, 2024 12:12
@carlosmuvi-stripe carlosmuvi-stripe changed the title [FC] Adds ActivityRetainedScope and broader singleton component [FC] Prepares integrity on first sync call Dec 23, 2024
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from 1f9ede2 to f49fde3 Compare December 23, 2024 12:17
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from 5c4c9af to cc8fb23 Compare December 23, 2024 14:22
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch 2 times, most recently from 1840272 to ef32d6f Compare December 23, 2024 14:28
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from cc8fb23 to fa975d8 Compare December 24, 2024 13:08
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from ef32d6f to 8b718ff Compare December 24, 2024 13:08
@carlosmuvi-stripe carlosmuvi-stripe requested a review from a team as a code owner December 25, 2024 10:57
@carlosmuvi-stripe carlosmuvi-stripe requested review from samer-stripe and removed request for a team December 25, 2024 10:57
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from fa975d8 to 81df1b9 Compare December 25, 2024 11:00
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from 9be7b86 to 67af8e1 Compare December 25, 2024 11:00
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from 81df1b9 to f9c9ea6 Compare January 2, 2025 18:09
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from 67af8e1 to eaa23cd Compare January 2, 2025 18:09
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from f9c9ea6 to c2335d0 Compare January 9, 2025 00:23
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from eaa23cd to b376dfb Compare January 9, 2025 00:23
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from c2335d0 to 18a1ac0 Compare January 9, 2025 01:39
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from b376dfb to 196fb04 Compare January 9, 2025 04:59
tillh-stripe
tillh-stripe previously approved these changes Jan 10, 2025
@@ -111,6 +114,7 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor(
private fun fetchManifest() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Should we rename this now that multiple things are happening in it?

@@ -120,6 +124,20 @@ internal class FinancialConnectionsSheetViewModel @Inject constructor(
}
}

private suspend fun prepareStandardRequestManager(): Boolean {
val result = runCatching { integrityRequestManager.prepare() }
result.exceptionOrNull()?.let {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: You can use result.onFailure { … }.

@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-adds-activity-retained-scope branch from 18a1ac0 to 6405e3c Compare January 10, 2025 17:12
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from 196fb04 to 0692e55 Compare January 10, 2025 17:12
@carlosmuvi-stripe carlosmuvi-stripe changed the base branch from carlosmuvi/12-21-adds-activity-retained-scope to graphite-base/9818 January 10, 2025 17:33
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from 0692e55 to e3b89e3 Compare January 10, 2025 17:34
@carlosmuvi-stripe carlosmuvi-stripe changed the base branch from graphite-base/9818 to master January 10, 2025 17:34
@carlosmuvi-stripe carlosmuvi-stripe dismissed tillh-stripe’s stale review January 10, 2025 17:34

The base branch was changed.

@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from e3b89e3 to 7ed2677 Compare January 10, 2025 17:34
@carlosmuvi-stripe carlosmuvi-stripe force-pushed the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch from 7ed2677 to 4bfb6b4 Compare January 10, 2025 18:24
@carlosmuvi-stripe carlosmuvi-stripe merged commit 1a9b1e7 into master Jan 10, 2025
15 checks passed
@carlosmuvi-stripe
Copy link
Collaborator Author

Merge activity

  • Jan 10, 3:38 PM EST: A user merged this pull request with Graphite.

@carlosmuvi-stripe carlosmuvi-stripe deleted the carlosmuvi/12-21-prepares_integrity_on_first_sync_call branch January 10, 2025 20:38
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.

2 participants