-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/wallet more verification docs support #357
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
base: main
Are you sure you want to change the base?
Changes from 4 commits
a3bed7d
5feb231
173a474
d50e381
257284e
979940a
9a2e2bc
aec52ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,10 +14,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||
import { getContext, onMount } from "svelte"; | ||||||||||||||||||||||||||||||||||||||||||||||
import { Shadow } from "svelte-loading-spinners"; | ||||||||||||||||||||||||||||||||||||||||||||||
import { v4 as uuidv4 } from "uuid"; | ||||||||||||||||||||||||||||||||||||||||||||||
import DocumentType from "./steps/document-type.svelte"; | ||||||||||||||||||||||||||||||||||||||||||||||
import Passport from "./steps/passport.svelte"; | ||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+17
to
18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Generalize UI and stored labels for non-passport docs Hardcoded “Passport” persists in user metadata and UI, which mislabels non-passport flows. Import documentType, add a label map, and switch labels to be document‑type aware. Also generalize the hero subtitle and alt text. Apply: - import {
- DocFront,
- DocBack,
- Selfie as SelfiePic,
- reason,
- status,
- verifStep,
- verificaitonId,
- } from "./store";
+ import {
+ DocFront,
+ DocBack,
+ Selfie as SelfiePic,
+ reason,
+ status,
+ verifStep,
+ verificaitonId,
+ documentType,
+ } from "./store"; - let hardwareKeyCheckComplete = $state(false);
+ let hardwareKeyCheckComplete = $state(false);
+ const docLabel = {
+ passport: "Passport",
+ id: "National ID",
+ permit: "Residence Permit",
+ dl: "Driver's License",
+ } as const; - "ID submitted": `Passport - ${person.nationality.value}`,
- "Passport Number": document.number.value,
+ "ID submitted": `${docLabel[$documentType ?? "passport"]} - ${person.nationality.value}`,
+ "Document Number": document.number.value, - Get your passport ready. You’ll be directed to present your
- passport and take a quick selfie.
+ Get your document ready. You’ll be directed to present your
+ chosen ID and take a quick selfie. - <img class="mx-auto mt-20" src="images/Passport.svg" alt="passport" />
+ <img class="mx-auto mt-20" src="images/Passport.svg" alt="identity document" /> Also applies to: 358-362 |
||||||||||||||||||||||||||||||||||||||||||||||
import Selfie from "./steps/selfie.svelte"; | ||||||||||||||||||||||||||||||||||||||||||||||
import { | ||||||||||||||||||||||||||||||||||||||||||||||
DocFront, | ||||||||||||||||||||||||||||||||||||||||||||||
DocBack, | ||||||||||||||||||||||||||||||||||||||||||||||
Selfie as SelfiePic, | ||||||||||||||||||||||||||||||||||||||||||||||
reason, | ||||||||||||||||||||||||||||||||||||||||||||||
status, | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -100,7 +102,7 @@ | |||||||||||||||||||||||||||||||||||||||||||||
let document: Document; | ||||||||||||||||||||||||||||||||||||||||||||||
let loading = $state(false); | ||||||||||||||||||||||||||||||||||||||||||||||
let keyManager: KeyManager | null = $state(null); | ||||||||||||||||||||||||||||||||||||||||||||||
let websocketData: any = $state(null); // Store websocket data for duplicate case | ||||||||||||||||||||||||||||||||||||||||||||||
let websocketData: { w3id?: string } | null = $state(null); // Store websocket data for duplicate case | ||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Type narrowing conflicts with stored data.
Choose one of these solutions: Option 1 (if only - websocketData = data; // Store the full websocket data
+ websocketData = data.w3id ? { w3id: data.w3id } : null; Option 2 (if full data is needed): Define and use the complete type. + type WebsocketData = {
+ status: string;
+ reason: string;
+ person: Person;
+ document: Document;
+ w3id?: string;
+ };
+
- let websocketData: { w3id?: string } | null = $state(null);
+ let websocketData: WebsocketData | null = $state(null); 📝 Committable suggestion
Suggested change
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||||||||||||||||
let hardwareKeySupported = $state(false); | ||||||||||||||||||||||||||||||||||||||||||||||
let hardwareKeyCheckComplete = $state(false); | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -135,9 +137,10 @@ | |||||||||||||||||||||||||||||||||||||||||||||
websocketData = data; // Store the full websocket data | ||||||||||||||||||||||||||||||||||||||||||||||
if (data.status === "resubmission_requested") { | ||||||||||||||||||||||||||||||||||||||||||||||
DocFront.set(null); | ||||||||||||||||||||||||||||||||||||||||||||||
DocBack.set(null); | ||||||||||||||||||||||||||||||||||||||||||||||
SelfiePic.set(null); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
verifStep.set(2); | ||||||||||||||||||||||||||||||||||||||||||||||
verifStep.set(3); | ||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -182,8 +185,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||
await initializeKeyManager(); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
if (!keyManager) { | ||||||||||||||||||||||||||||||||||||||||||||||
throw new Error("Key manager not initialized"); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||
const res = await keyManager!.generate("default"); | ||||||||||||||||||||||||||||||||||||||||||||||
const res = await keyManager.generate("default"); | ||||||||||||||||||||||||||||||||||||||||||||||
console.log("Key generation result:", res); | ||||||||||||||||||||||||||||||||||||||||||||||
return res; | ||||||||||||||||||||||||||||||||||||||||||||||
} catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -197,8 +204,12 @@ | |||||||||||||||||||||||||||||||||||||||||||||
await initializeKeyManager(); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
if (!keyManager) { | ||||||||||||||||||||||||||||||||||||||||||||||
throw new Error("Key manager not initialized"); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||
const res = await keyManager!.getPublicKey("default"); | ||||||||||||||||||||||||||||||||||||||||||||||
const res = await keyManager.getPublicKey("default"); | ||||||||||||||||||||||||||||||||||||||||||||||
console.log("Public key retrieved:", res); | ||||||||||||||||||||||||||||||||||||||||||||||
return res; | ||||||||||||||||||||||||||||||||||||||||||||||
} catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -218,9 +229,11 @@ | |||||||||||||||||||||||||||||||||||||||||||||
// Initialize key manager and check if default key pair exists | ||||||||||||||||||||||||||||||||||||||||||||||
await initializeKeyManager(); | ||||||||||||||||||||||||||||||||||||||||||||||
const keyExists = await keyManager!.exists("default"); | ||||||||||||||||||||||||||||||||||||||||||||||
if (!keyExists) { | ||||||||||||||||||||||||||||||||||||||||||||||
await generateApplicationKeyPair(); | ||||||||||||||||||||||||||||||||||||||||||||||
if (keyManager) { | ||||||||||||||||||||||||||||||||||||||||||||||
const keyExists = await keyManager.exists("default"); | ||||||||||||||||||||||||||||||||||||||||||||||
if (!keyExists) { | ||||||||||||||||||||||||||||||||||||||||||||||
await generateApplicationKeyPair(); | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||
handleContinue = async () => { | ||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -342,9 +355,11 @@ | |||||||||||||||||||||||||||||||||||||||||||||
<Drawer bind:isPaneOpen={showVeriffModal}> | ||||||||||||||||||||||||||||||||||||||||||||||
<div class="overflow-y-scroll"> | ||||||||||||||||||||||||||||||||||||||||||||||
{#if $verifStep === 0} | ||||||||||||||||||||||||||||||||||||||||||||||
<Passport></Passport> | ||||||||||||||||||||||||||||||||||||||||||||||
<DocumentType /> | ||||||||||||||||||||||||||||||||||||||||||||||
{:else if $verifStep === 1} | ||||||||||||||||||||||||||||||||||||||||||||||
<Selfie></Selfie> | ||||||||||||||||||||||||||||||||||||||||||||||
<Passport /> | ||||||||||||||||||||||||||||||||||||||||||||||
{:else if $verifStep === 2} | ||||||||||||||||||||||||||||||||||||||||||||||
<Selfie /> | ||||||||||||||||||||||||||||||||||||||||||||||
{:else if loading} | ||||||||||||||||||||||||||||||||||||||||||||||
<div class="my-20"> | ||||||||||||||||||||||||||||||||||||||||||||||
<div | ||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script lang="ts"> | ||
import { ButtonAction } from "$lib/ui"; | ||
import { documentType, verifStep } from "../store"; | ||
|
||
function selectDocumentType(type: "passport" | "id" | "permit" | "dl") { | ||
documentType.set(type); | ||
verifStep.set(1); // Move to document capture step | ||
} | ||
</script> | ||
|
||
<div class="flex flex-col gap-5"> | ||
<div> | ||
<h3>Choose Document Type</h3> | ||
<p>Select the type of identity document you will be presenting</p> | ||
</div> | ||
|
||
<div class="flex flex-col gap-3"> | ||
<ButtonAction | ||
class="w-full" | ||
callback={() => selectDocumentType("passport")} | ||
> | ||
Passport | ||
</ButtonAction> | ||
|
||
<ButtonAction | ||
class="w-full" | ||
callback={() => selectDocumentType("id")} | ||
> | ||
ID Card | ||
</ButtonAction> | ||
|
||
<ButtonAction | ||
class="w-full" | ||
callback={() => selectDocumentType("dl")} | ||
> | ||
Driving License | ||
</ButtonAction> | ||
|
||
<ButtonAction | ||
class="w-full" | ||
callback={() => selectDocumentType("permit")} | ||
> | ||
Residence Permit | ||
</ButtonAction> | ||
</div> | ||
|
||
<div class="text-center text-xs text-white"> | ||
Accepted documents: Driver's License, Residence Permit, Passport, ID Card. | ||
</div> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
Destroying pane on close prevents reopening (pane not re-initialized)
Calling pane.destroy() when isPaneOpen=false removes the instance; later openings won’t recreate it because the init effect doesn’t rerun. Use hide/close (non-destructive) on close, and reserve destroy for unmount.
Apply:
Option B: if hide isn’t available, gate destroy to unmount and re-init pane when reopening.
🌐 Web query:
💡 Result:
Yes. CupertinoPane provides a non‑destructive hide() that removes the pane from view but keeps it in the DOM (you can check isHidden() and call present() to show it again). [1][2]
Sources:
Replace pane.destroy() with pane.hide() on close
CupertinoPane provides hide(), which non-destructively closes the pane and lets you call present() to reopen it.
File: infrastructure/eid-wallet/src/lib/ui/Drawer/Drawer.svelte lines 51–60
📝 Committable suggestion
🤖 Prompt for AI Agents