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

Use attestation on sign up screen #10037

Merged
merged 5 commits into from
Jan 30, 2025
Merged

Conversation

toluo-stripe
Copy link
Contributor

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

Summary

Use hardware attestation for sign up and lookup on the SignUpScreen. This PR also reintroduces email lookup.

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Simulates an attestation error on lookup
https://github.com/user-attachments/assets/6cc9167c-a121-44e8-875f-e9d6f34adfa4

Simulates attestation error on signup
https://github.com/user-attachments/assets/362983be-9da6-4f1b-8a15-ddfd0e05d3ab

Changelog

Copy link
Contributor

github-actions bot commented Jan 29, 2025

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │           compressed           │          uncompressed          
          ├───────────┬───────────┬────────┼──────────┬──────────┬──────────
 APK      │ old       │ new       │ diff   │ old      │ new      │ diff     
──────────┼───────────┼───────────┼────────┼──────────┼──────────┼──────────
      dex │     4 MiB │     4 MiB │ +1 KiB │  8.7 MiB │  8.7 MiB │ +4.7 KiB 
     arsc │   2.3 MiB │   2.3 MiB │    0 B │  2.3 MiB │  2.3 MiB │      0 B 
 manifest │   5.1 KiB │   5.1 KiB │    0 B │ 25.7 KiB │ 25.7 KiB │      0 B 
      res │ 910.3 KiB │ 910.3 KiB │    0 B │  1.4 MiB │  1.4 MiB │      0 B 
   native │   2.6 MiB │   2.6 MiB │    0 B │    6 MiB │    6 MiB │      0 B 
    asset │   1.6 MiB │   1.6 MiB │  +34 B │  1.6 MiB │  1.6 MiB │    +34 B 
    other │   1.4 MiB │   1.4 MiB │  -14 B │  1.6 MiB │  1.6 MiB │      0 B 
──────────┼───────────┼───────────┼────────┼──────────┼──────────┼──────────
    total │  12.7 MiB │  12.7 MiB │ +1 KiB │ 21.7 MiB │ 21.7 MiB │ +4.7 KiB 

 DEX     │ old   │ new   │ diff              
─────────┼───────┼───────┼───────────────────
   files │     1 │     1 │   0               
 strings │ 41079 │ 41090 │ +11 (+23 -12)     
   types │ 14203 │ 14210 │  +7 (+18 -11)     
 classes │ 11860 │ 11867 │  +7 (+10 -3)      
 methods │ 60333 │ 60359 │ +26 (+1028 -1002) 
  fields │ 40468 │ 40511 │ +43 (+1114 -1071) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  243 │  243 │  0   
 entries │ 6245 │ 6245 │  0
APK
    compressed     │     uncompressed     │                                           
──────────┬────────┼───────────┬──────────┤                                           
 size     │ diff   │ size      │ diff     │ path                                      
──────────┼────────┼───────────┼──────────┼───────────────────────────────────────────
    4 MiB │ +1 KiB │   8.7 MiB │ +4.7 KiB │ ∆ classes.dex                             
  7.8 KiB │  +33 B │   7.7 KiB │    +33 B │ ∆ assets/dexopt/baseline.prof             
 53.6 KiB │  -15 B │ 118.8 KiB │      0 B │ ∆ META-INF/CERT.SF                        
    271 B │   +1 B │     120 B │      0 B │ ∆ META-INF/version-control-info.textproto 
  1,016 B │   +1 B │     884 B │     +1 B │ ∆ assets/dexopt/baseline.profm            
  1.2 KiB │   -1 B │   1.2 KiB │      0 B │ ∆ META-INF/CERT.RSA                       
 50.3 KiB │   +1 B │ 118.8 KiB │      0 B │ ∆ META-INF/MANIFEST.MF                    
──────────┼────────┼───────────┼──────────┼───────────────────────────────────────────
  4.1 MiB │ +1 KiB │     9 MiB │ +4.7 KiB │ (total)
DEX
STRINGS:

   old   │ new   │ diff          
  ───────┼───────┼───────────────
   41079 │ 41090 │ +11 (+23 -12) 
  
  + LA6/Z;
  + LF6/r;
  + LF6/s;
  + LINK_NATIVE_FAILED_TO_ATTEST_SIGNUP_REQUEST
  + LQ7/l;
  + Lf8/R1;
  + Lr6/A;
  + Lr6/B;
  + Lr6/C;
  + Lx6/s;
  + Lx6/t;
  + [LA6/X;
  + [LZ8/I;
  + [LZ8/M;
  + [LZ8/b0;
  + [LZ8/i;
  + [LZ8/t0;
  + [Lf8/C1;
  + [Lf8/G1;
  + link.native.signup.failed_to_attest_request
  + moveToWeb
  + moveToWeb()V
  + ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"9b4f81c","r8-mode":"full","version":"8.7.14"}
  
  - LG6/n;
  - LM5/E;
  - LR5/n;
  - [LA6/W;
  - [LZ8/K;
  - [LZ8/N;
  - [LZ8/d0;
  - [LZ8/l;
  - [LZ8/u0;
  - [Lf8/F1;
  - [Lf8/z1;
  - ~~R8{"backend":"dex","compilation-mode":"release","has-checksums":false,"min-api":21,"pg-map-id":"8b0e9df","r8-mode":"full","version":"8.7.14"}
  

TYPES:

   old   │ new   │ diff         
  ───────┼───────┼──────────────
   14203 │ 14210 │ +7 (+18 -11) 
  
  + LA6/Z;
  + LF6/r;
  + LF6/s;
  + LQ7/l;
  + Lf8/R1;
  + Lr6/A;
  + Lr6/B;
  + Lr6/C;
  + Lx6/s;
  + Lx6/t;
  + [LA6/X;
  + [LZ8/I;
  + [LZ8/M;
  + [LZ8/b0;
  + [LZ8/i;
  + [LZ8/t0;
  + [Lf8/C1;
  + [Lf8/G1;
  
  - LG6/n;
  - LM5/E;
  - LR5/n;
  - [LA6/W;
  - [LZ8/K;
  - [LZ8/N;
  - [LZ8/d0;
  - [LZ8/l;
  - [LZ8/u0;
  - [Lf8/F1;
  - [Lf8/z1;
  

METHODS:

   old   │ new   │ diff              
  ───────┼───────┼───────────────────
   60333 │ 60359 │ +26 (+1028 -1002) 
  
  + A5.h0 <init>(C, boolean, G0, d)
  + A6.A <init>(m, c, c, a, a, a, a, c, int)
  + A6.A <init>(A, e, e, c, a, c, a, s, int)
  + A6.A <init>(n0, Object, Object, Object, Object, Object, Object, Object, int, int)
  + A6.B <init>(c, c, a, a, c, a, c, a)
  + A6.C <init>(A, e, e, String, String, c, e, a, a, int)
  + A6.C <init>(A, String, String, c, e, e, q, a, a, int)
  + A6.C <init>(A, a, a, c, c, c, c, a, a, int)
  + A6.D <init>(c, b, int)
  + A6.J <init>(q, s, a, c, D1, c, A, a)
  + A6.K <init>(f, D1, q, s, a, c, c, A, a)
  + A6.L <init>(c, c, a)
  + A6.O <init>(a, c)
  + A6.O j(Object, Object, Object, Object) → Object
  + A6.P <init>(Object, long, int, int)
  + A6.Q <init>(boolean, p, boolean, int, int)
  + A6.Q <init>(boolean, boolean, p, int, int)
  + A6.S <init>(p, String, X, a, Integer, Integer, int, int)
  + A6.T <init>(Integer, int, int)
  + A6.T d(Object, Object) → Object
  + A6.U <init>(X, Integer, String, Integer)
  + A6.U <init>(Object, Object, Object, Object, int)
  + A6.U c(Object, Object, Object) → Object
  + A6.V <init>(h, b, a, p, P0, W)
  + A6.V <init>(p, a, X, Integer, String, Integer)
  + A6.V d(Object, Object) → Object
  + A6.W a(p, String, X, a, Integer, Integer, p, int, int)
  + A6.W b(Integer, p, int)
  + A6.W c(l3) → b
  + A6.X <clinit>()
  + A6.X <init>(boolean, String, int)
  + A6.X valueOf(String) → X
  + A6.X values() → X[]
  + A6.Y <init>(a, int, int)
  + A6.Y d(Object, Object) → Object
  + A6.Z <init>(c, boolean)
  + A6.Z <init>(boolean, String, int)
  + A6.Z c(Object, Object, Object) → Object
  + C0.c D(m, S, a, a, a, o, p, int)
  + C0.c E(l, p, int)
  + C0.c u(u, Z0, f0, Z0, boolean, c, boolean, boolean, k, p, p, int)
  + C6.C <init>(Z0, f0, Z0, c, boolean, boolean, k, W, o, W)
  + C6.n <init>(S, M, t, q, c, d)
  + C6.r <init>(Integer, Z0, f0, Z0, c, boolean, boolean, boolean, k, boolean, a, p, o, o, o, int, int, int)
  + C6.u <init>(a, boolean, boolean, Z0, c, boolean, o, f0, o, Z0, o, k)
  + C6.v <init>(boolean, c, boolean, f0, o, Z0, o, k, boolean, a, boolean, Z0, o)
  + C6.x <init>(String, u, Z0, f0, Z0, c, boolean, boolean, boolean, k, a, p, int, int, int)
  + C6.z <init>(u, Z0, f0, Z0, boolean, c, boolean, boolean, k, p, int)
  + C6.z <init>(boolean, a, boolean, boolean, T0, T0, f0, a, M, C0, int)
  + C6.z <init>(boolean, boolean, c, boolean, k, u, Z0, f0, Z0, o, int)
  + D7.m <init>(boolean, J, p, int, int)
  + E6.a <init>(a, List, X, c, S1, c)
  + E6.a a(a, X, S1, c, int) → a
  + E6.d <init>(t, b, q, c, d, i, c)
  + E6.d i(d, X)
  + E7.d <init>(o, S, boolean, Throwable, p, int)
  + F6.d <init>(s, d)
  + F6.e <init>(s, d)
  + F6.f <init>(a, a, a, a)
  + F6.f <init>(Object, Object, c, Object, int)
  + F6.f <init>(Object, Object, Object, Object, int)
  + F6.f <init>(b, a, a, c)
  + F6.f e(Object) → Object
  + F6.h <init>(s, d)
  + F6.i <init>(s, c)
  + F6.j <init>(s, d)
  + F6.j d(Object, Object) → Object
  + F6.j n(Object, d) → d
  + F6.j p(Object) → Object
  + F6.k <init>(l, d)
  + F6.k p(Object) → Object
  + F6.l <init>(int, Obje
...✂

@toluo-stripe toluo-stripe marked this pull request as ready for review January 30, 2025 00:25
@toluo-stripe toluo-stripe requested review from a team as code owners January 30, 2025 00:25

when (lookupResult) {
is LinkAuthResult.AttestationFailed -> {
errorReporter.report(
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should consider sending these analytics in LinkAuth so that if we were to introduce new callers, our analytics would cover all places that attestation is done (instead of needing every caller to handle analytics themselves)

not blocking

viewModel.emailController.onRawValueChange("[email protected]")
advanceTimeBy(SignUpViewModel.LOOKUP_DEBOUNCE + 1.milliseconds)

assertThat(viewModel.state.value.signUpState).isEqualTo(SignUpState.InputtingRemainingFields)
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to assert anything about an error being displayed in this case? I'd expect that if lookup fails, there's some indication of that to the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't show an error in this case. I'll push an update

composeTestRule.waitForIdle()

dispatcher.scheduler.advanceTimeBy(1001)
onErrorSection().assertExists() // .assert(hasAnyChild(hasText("Something went wrong")))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
onErrorSection().assertExists() // .assert(hasAnyChild(hasText("Something went wrong")))
onErrorSection().assertExists()

@toluo-stripe toluo-stripe merged commit d919faf into master Jan 30, 2025
16 checks passed
@toluo-stripe toluo-stripe deleted the tolu/link/signup_vm_auth branch January 30, 2025 23:08
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