Commit d8b24ef
add three-QR signup ceremony to the Android app (ADR 0023 phone-side)
The dashboard demo at /demo/registration was driving the phone-side
endpoints through a simulator. This commit adds the actual Kotlin
client so the same flow runs against the live backend from a real
phone (sideloaded APK).
What lands:
net/RegistrationApi.kt — Retrofit binding for the three
phone-side endpoints (POST
/v1/registrations/{pair-device,
submit-commitment, complete}) plus
request/response DTOs. Same OkHttp +
Json stack as ZeroAuthApi; pulled out
into ApiFactory.createRegistrationApi
so callers that only need the new
surface skip the W3 init cost.
util/RegQrPayload.kt — Parser for the QR deeplinks:
zeroauth://reg?step=<pair|enroll|verify>
&session=<uuid>&code=ZA-XXXX-XXXX
[&challenge=<32-hex>]. Returns
Result.failure with stable string
codes (reg_qr_parse_failed,
reg_qr_missing_field,
reg_qr_bad_code_shape,
reg_qr_bad_challenge_shape) so the UI
routes errors without a try/catch.
util/DeviceFingerprint.kt — Builds the >= 16-char opaque
fingerprint string the server hashes.
Composition: android:<appId>:
<ANDROID_ID>:<install_uuid>; result
SHA-256-hex'd. Per-install UUID lives
in SharedPreferences so the same
install always produces the same
fingerprint (lets the same row in the
devices table re-enroll on
code-regenerate).
ui/reg/RegistrationViewModel.kt — State machine:
Idle → Pairing → AwaitingEnrollScan
→ Committing → AwaitingVerifyScan →
Verifying → Completed | Failed.
onQrText(text) parses, branches by
step, and POSTs. BiometricSecretSource
and ProofGenerator are injection seams
so Phase 1 Sprint 4 can swap the
StubProofGenerator for the real
WebViewMobileProver.
ui/reg/RegistrationHelpers.kt — Default injections:
PerInstallStableSecret persists a
32-byte secret in SharedPreferences so
step 2 and step 3 derive the same
commitment (without that, the verify
step's publicSignals[0] check fails).
DeriveDidAndCommitment computes
Poseidon.hash2(secret, zeroSalt) and
derives the DID suffix. StubProofGenerator
returns a structurally valid Groth16
envelope — the server's verifier will
reject it (intentionally) until the
real prover lands.
ui/reg/RegistrationScreen.kt — Compose UI. Paste-deeplink only for
V1 (the camera scan path mirrors
ui/scan/ScanScreen.kt's ML Kit +
CameraX pipeline and gets wired in
Phase 1 Sprint 4). Step badge,
progress indicators, terminal
Completed / Failed cards.
ui/SplashScreen.kt — Second CTA "Create a new account
(3-QR signup)" routes to the new flow.
Original "Sign in" CTA unchanged.
nav/Nav.kt — New Screen.Registration entry +
composable route.
Tests:
test/util/RegQrPayloadTest.kt — 11 Robolectric tests covering the
happy path for each step + every
stable error code (wrong scheme, wrong
host, unknown step, missing
session/code, malformed code/challenge,
verify-without-challenge).
Verify (CI):
.github/workflows/android.yml runs ./gradlew assembleDebug + test
on every push that touches android/**. The local toolchain in this
environment doesn't have gradle/android SDK installed (the wrapper
jar is gitignored per README), so the validation falls to CI.
How to install on a phone:
cd android
gradle wrapper --gradle-version 8.7
./gradlew :app:installDebug # adb-attached device1 parent 57c2d4a commit d8b24ef
11 files changed
Lines changed: 1076 additions & 21 deletions
File tree
- android
- app/src
- main/java/dev/zeroauth/android
- net
- ui
- reg
- util
- test/java/dev/zeroauth/android/util
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
14 | 27 | | |
15 | 28 | | |
16 | 29 | | |
17 | 30 | | |
| 31 | + | |
18 | 32 | | |
19 | | - | |
| 33 | + | |
| 34 | + | |
20 | 35 | | |
21 | 36 | | |
22 | 37 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
56 | 59 | | |
57 | 60 | | |
58 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
59 | 75 | | |
60 | 76 | | |
61 | 77 | | |
| |||
Lines changed: 14 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
128 | 141 | | |
129 | 142 | | |
130 | 143 | | |
| |||
144 | 157 | | |
145 | 158 | | |
146 | 159 | | |
147 | | - | |
148 | 160 | | |
149 | 161 | | |
150 | 162 | | |
| |||
Lines changed: 122 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
Lines changed: 46 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
114 | 104 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
119 | 147 | | |
120 | 148 | | |
121 | 149 | | |
| |||
0 commit comments