Skip to content

Commit e778d73

Browse files
authored
fix: recovery fallback (#885)
* fix: recovery fallback * feat: clear text traffic * feat: mandate sync after login * feat: aab & apk build scripts * fix: scan page styling * feat: normalize styling * chore: remove the evault delete flow * chore: fix lint
1 parent fbce5c6 commit e778d73

File tree

19 files changed

+829
-118
lines changed

19 files changed

+829
-118
lines changed

infrastructure/eid-wallet/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
"check-lint": "npx @biomejs/biome lint ./src",
1616
"tauri": "tauri",
1717
"storybook": "svelte-kit sync && storybook dev -p 6006",
18-
"build-storybook": "storybook build"
18+
"build-storybook": "storybook build",
19+
"build:apk": "npm run tauri android build -- --apk --target aarch64 --target armv7",
20+
"build:aab": "npm run tauri android build -- --aab --target aarch64 --target armv7"
1921
},
2022
"license": "MIT",
2123
"dependencies": {

infrastructure/eid-wallet/src-tauri/gen/android/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ android {
1818
compileSdk = 36
1919
namespace = "foundation.metastate.eid_wallet"
2020
defaultConfig {
21-
manifestPlaceholders["usesCleartextTraffic"] = "false"
21+
manifestPlaceholders["usesCleartextTraffic"] = "true"
2222
applicationId = "foundation.metastate.eid_wallet"
2323
minSdk = 24
2424
targetSdk = 36

infrastructure/eid-wallet/src/lib/ui/BottomSheet/BottomSheet.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import type { HTMLAttributes } from "svelte/elements";
66
interface BottomSheetProps extends HTMLAttributes<HTMLDivElement> {
77
isOpen?: boolean;
88
dismissible?: boolean;
9+
fullScreen?: boolean;
910
children?: Snippet;
1011
onOpenChange?: (value: boolean) => void;
1112
}
1213
1314
let {
1415
isOpen = $bindable(false),
1516
dismissible = true,
17+
fullScreen = false,
1618
children = undefined,
1719
onOpenChange,
1820
...restProps
@@ -45,10 +47,14 @@ $effect(() => {
4547
role="dialog"
4648
aria-modal="true"
4749
class={cn(
48-
"fixed inset-x-0 bottom-0 z-50 bg-white rounded-t-3xl shadow-xl flex flex-col gap-4 max-h-[88svh] overflow-y-auto",
50+
fullScreen
51+
? "fixed inset-0 z-50 bg-white shadow-xl flex flex-col gap-4 overflow-hidden"
52+
: "fixed inset-x-0 bottom-0 z-50 bg-white rounded-t-3xl shadow-xl flex flex-col gap-4 max-h-[88svh] overflow-y-auto",
4953
restProps.class,
5054
)}
51-
style={`padding: 1.5rem 1.5rem max(1.5rem, env(safe-area-inset-bottom)); ${restProps.style ?? ""}`}
55+
style={`${fullScreen
56+
? "padding: max(1rem, env(safe-area-inset-top)) 1.5rem max(1.5rem, env(safe-area-inset-bottom));"
57+
: "padding: 1.5rem 1.5rem max(1.5rem, env(safe-area-inset-bottom));"} ${restProps.style ?? ""}`}
5258
>
5359
{@render children?.()}
5460
</div>

infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/AuthDrawer.svelte

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ $: if (internalOpen !== lastReportedOpen) {
3232
<BottomSheet
3333
isOpen={internalOpen}
3434
dismissible={false}
35+
fullScreen={true}
3536
class="gap-5"
3637
>
37-
<div class="flex min-h-[70svh] w-full flex-col">
38-
<div class="flex flex-1 flex-col items-start overflow-y-auto pt-2">
38+
<div class="flex h-full w-full flex-col">
39+
<div class="min-h-0 flex flex-1 flex-col items-start overflow-y-auto pt-2">
3940
<div
4041
class="flex justify-center mb-4 relative items-center overflow-hidden bg-gray rounded-xl p-4 h-[72px] w-[72px]"
4142
>
@@ -54,8 +55,8 @@ $: if (internalOpen !== lastReportedOpen) {
5455
/>
5556
</div>
5657

57-
<h4 class="text-xl font-bold">Code scanned!</h4>
58-
<p class="text-black-700 text-sm mt-1">
58+
<h4 class="text-lg font-bold">Code scanned!</h4>
59+
<p class="mt-1 text-sm leading-relaxed text-black-700">
5960
Please review the connection details below.
6061
</p>
6162

@@ -65,7 +66,7 @@ $: if (internalOpen !== lastReportedOpen) {
6566
<table class="w-full border-collapse">
6667
<tbody class="divide-y divide-gray-200">
6768
<tr>
68-
<td class="py-4 px-4">
69+
<td class="align-top py-4 px-4">
6970
<div
7071
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
7172
>
@@ -80,7 +81,7 @@ $: if (internalOpen !== lastReportedOpen) {
8081
</tr>
8182

8283
<tr>
83-
<td class="py-4 px-4">
84+
<td class="align-top py-4 px-4">
8485
<div
8586
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
8687
>
@@ -128,7 +129,7 @@ $: if (internalOpen !== lastReportedOpen) {
128129
{/if}
129130
</div>
130131

131-
<div class="mt-auto flex w-full flex-col gap-3 pb-2 pt-6">
132+
<div class="shrink-0 flex w-full flex-col gap-3 pb-2 pt-6">
132133
<div
133134
class="flex flex-col justify-center gap-3 items-center w-full"
134135
>

infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/LoggedInDrawer.svelte

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ $: if (internalOpen !== lastReportedOpen) {
2727
<BottomSheet
2828
isOpen={internalOpen}
2929
dismissible={false}
30+
fullScreen={true}
3031
role="dialog"
3132
aria-modal="true"
3233
aria-labelledby="loggedin-title"
3334
class="loggedin-drawer gap-5"
3435
>
35-
<div class="flex min-h-[70svh] w-full flex-col">
36-
<div class="flex flex-1 flex-col items-start overflow-y-auto pt-2">
36+
<div class="flex h-full w-full flex-col">
37+
<div class="min-h-0 flex flex-1 flex-col items-start overflow-y-auto pt-2">
3738
<div
3839
class="flex justify-center mb-4 relative items-center overflow-hidden bg-gray rounded-xl p-4 h-[72px] w-[72px]"
3940
>
@@ -52,10 +53,10 @@ $: if (internalOpen !== lastReportedOpen) {
5253
/>
5354
</div>
5455

55-
<h4 id="loggedin-title" class="text-xl font-bold">
56+
<h4 id="loggedin-title" class="text-lg font-bold">
5657
You're logged in!
5758
</h4>
58-
<p class="text-black-700 text-sm">
59+
<p class="text-sm leading-relaxed text-black-700">
5960
You're now connected to {platform ?? "the platform"}
6061
</p>
6162
<div class="flex flex-col items-start py-6 w-full">
@@ -70,7 +71,7 @@ $: if (internalOpen !== lastReportedOpen) {
7071
</div>
7172
</div>
7273

73-
<div class="mt-auto flex w-full flex-col gap-3 pb-2 pt-6">
74+
<div class="shrink-0 flex w-full flex-col gap-3 pb-2 pt-6">
7475
<Button.Action
7576
variant="soft"
7677
class="w-full"

infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/RevealDrawer.svelte

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ $: if (internalOpen !== lastReportedOpen) {
3232
<BottomSheet
3333
isOpen={internalOpen}
3434
dismissible={false}
35+
fullScreen={true}
3536
class="gap-5"
3637
>
37-
<div class="flex min-h-[70svh] w-full flex-col">
38-
<div class="flex flex-1 flex-col items-start overflow-y-auto pt-2">
38+
<div class="flex h-full w-full flex-col">
39+
<div class="min-h-0 flex flex-1 flex-col items-start overflow-y-auto pt-2">
3940
<div
4041
class="flex justify-center mb-4 relative items-center overflow-hidden {revealSuccess
4142
? 'bg-green-100'
@@ -63,10 +64,10 @@ $: if (internalOpen !== lastReportedOpen) {
6364
</div>
6465

6566
{#if revealSuccess && revealedVoteData}
66-
<h4 class="text-xl font-bold text-green-800">
67+
<h4 class="text-lg font-bold text-green-800">
6768
Vote Decrypted
6869
</h4>
69-
<p class="text-black-700 mt-1">
70+
<p class="mt-1 text-sm leading-relaxed text-black-700">
7071
Your selection has been successfully retrieved.
7172
</p>
7273

@@ -93,8 +94,8 @@ $: if (internalOpen !== lastReportedOpen) {
9394
</div>
9495
</div>
9596
{:else}
96-
<h4 class="text-xl font-bold">Reveal Your Blind Vote</h4>
97-
<p class="text-black-700 mt-1">
97+
<h4 class="text-lg font-bold">Reveal Your Blind Vote</h4>
98+
<p class="mt-1 text-sm leading-relaxed text-black-700">
9899
Please review the request details below.
99100
</p>
100101

@@ -105,7 +106,7 @@ $: if (internalOpen !== lastReportedOpen) {
105106
<table class="w-full border-collapse">
106107
<tbody class="divide-y divide-gray-200">
107108
<tr>
108-
<td class="py-4 px-4">
109+
<td class="align-top py-4 px-4">
109110
<div
110111
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
111112
>
@@ -145,7 +146,7 @@ $: if (internalOpen !== lastReportedOpen) {
145146
{/if}
146147
</div>
147148

148-
<div class="mt-auto flex w-full flex-col gap-3 pb-2 pt-6">
149+
<div class="shrink-0 flex w-full flex-col gap-3 pb-2 pt-6">
149150
{#if revealSuccess}
150151
<Button.Action
151152
variant="solid"

infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/SigningDrawer.svelte

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@ $: hasPollDetails =
4242
<BottomSheet
4343
isOpen={internalOpen}
4444
dismissible={false}
45+
fullScreen={true}
4546
role="dialog"
4647
aria-modal="true"
4748
aria-labelledby="signing-title"
4849
class="gap-5"
4950
>
50-
<div class="flex min-h-[70svh] w-full flex-col">
51-
<div class="flex flex-1 flex-col items-start overflow-y-auto pt-2">
51+
<div class="flex h-full w-full flex-col">
52+
<div class="min-h-0 flex flex-1 flex-col items-start overflow-y-auto pt-2">
5253
<div
5354
class="flex justify-center mb-4 relative items-center overflow-hidden {showSigningSuccess
5455
? 'bg-green-100'
@@ -77,7 +78,7 @@ $: hasPollDetails =
7778

7879
<h4
7980
id="signing-title"
80-
class="text-xl font-bold {showSigningSuccess
81+
class="text-lg font-bold {showSigningSuccess
8182
? 'text-green-800'
8283
: ''}"
8384
>
@@ -96,7 +97,7 @@ $: hasPollDetails =
9697
{/if}
9798
</h4>
9899

99-
<p class="text-black-700 text-sm mt-1">
100+
<p class="mt-1 text-sm leading-relaxed text-black-700">
100101
{#if showSigningSuccess}
101102
Your request was processed successfully.
102103
{:else}
@@ -111,7 +112,7 @@ $: hasPollDetails =
111112
<tbody class="divide-y divide-gray-200">
112113
{#if signingData?.pollId}
113114
<tr>
114-
<td class="py-3 px-4">
115+
<td class="align-top py-3 px-4">
115116
<div
116117
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
117118
>
@@ -128,7 +129,7 @@ $: hasPollDetails =
128129

129130
{#if isBlindVotingRequest && hasPollDetails}
130131
<tr>
131-
<td class="py-3 px-4">
132+
<td class="align-top py-3 px-4">
132133
<div
133134
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
134135
>
@@ -145,7 +146,7 @@ $: hasPollDetails =
145146

146147
{#if signingData?.message && !signingData?.pollId}
147148
<tr>
148-
<td class="py-3 px-4">
149+
<td class="align-top py-3 px-4">
149150
<div
150151
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
151152
>
@@ -159,7 +160,7 @@ $: hasPollDetails =
159160
</td>
160161
</tr>
161162
<tr>
162-
<td class="py-3 px-4">
163+
<td class="align-top py-3 px-4">
163164
<div
164165
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
165166
>
@@ -222,7 +223,7 @@ $: hasPollDetails =
222223
{/if}
223224
</div>
224225

225-
<div class="mt-auto flex w-full flex-col gap-3 pb-2 pt-6">
226+
<div class="shrink-0 flex w-full flex-col gap-3 pb-2 pt-6">
226227
{#if showSigningSuccess}
227228
<Button.Action
228229
variant="solid"

infrastructure/eid-wallet/src/routes/(app)/scan-qr/components/SocialBindingDrawer.svelte

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
3333
<BottomSheet
3434
isOpen={internalOpen}
3535
dismissible={false}
36+
fullScreen={true}
3637
role="dialog"
3738
aria-modal="true"
3839
aria-labelledby="social-binding-title"
3940
class="gap-5"
4041
>
41-
<div class="flex min-h-[70svh] w-full flex-col">
42-
<div class="flex flex-1 flex-col items-start overflow-y-auto pt-2">
42+
<div class="flex h-full w-full flex-col">
43+
<div class="min-h-0 flex flex-1 flex-col items-start overflow-y-auto pt-2">
4344
<div
4445
class="flex justify-center mb-4 relative items-center overflow-hidden {success
4546
? 'bg-green-100'
@@ -68,12 +69,12 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
6869

6970
<h4
7071
id="social-binding-title"
71-
class="text-xl font-bold {success ? 'text-green-800' : ''}"
72+
class="text-lg font-bold {success ? 'text-green-800' : ''}"
7273
>
7374
{success ? "Binding Signed!" : "Social Identity Binding"}
7475
</h4>
7576

76-
<p class="text-black-700 text-sm mt-1">
77+
<p class="mt-1 text-sm leading-relaxed text-black-700">
7778
{#if success}
7879
You've signed the social identity binding for <strong>{displayName}</strong>.
7980
They will counter-sign to complete the mutual binding.
@@ -89,7 +90,7 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
8990
<table class="w-full border-collapse">
9091
<tbody class="divide-y divide-gray-200">
9192
<tr>
92-
<td class="py-3 px-4">
93+
<td class="align-top py-3 px-4">
9394
<div
9495
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
9596
>
@@ -104,7 +105,7 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
104105
</tr>
105106
{#if requesterEname}
106107
<tr>
107-
<td class="py-3 px-4">
108+
<td class="align-top py-3 px-4">
108109
<div
109110
class="text-xs font-semibold text-black-500 uppercase tracking-wider block"
110111
>
@@ -132,7 +133,7 @@ $: displayName = requesterName ?? requesterEname ?? "Unknown";
132133
{/if}
133134
</div>
134135

135-
<div class="mt-auto flex w-full flex-col gap-3 pb-2 pt-6">
136+
<div class="shrink-0 flex w-full flex-col gap-3 pb-2 pt-6">
136137
{#if success}
137138
<Button.Action
138139
variant="solid"

infrastructure/eid-wallet/src/routes/(auth)/e-passport/+page.svelte

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,14 @@ const handleFinish = async () => {
1616
const recovery = get(pendingRecovery);
1717
if (recovery) {
1818
localStorage.setItem(RECOVERY_SKIP_PROFILE_SETUP_KEY, "true");
19+
// Recovery can happen on a fresh device, so make sure a key exists
20+
// and is synced immediately before entering the app.
21+
await globalState.walletSdkAdapter.ensureKey("default", "onboarding");
1922
globalState.vaultController.vault = {
2023
uri: recovery.uri,
2124
ename: recovery.ename,
2225
};
26+
await globalState.vaultController.syncPublicKey(recovery.ename);
2327
pendingRecovery.set(null);
2428
}
2529
await goto("/main");

0 commit comments

Comments
 (0)