diff --git a/package.json b/package.json index 0f2363d..51361e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "picoforge", - "version": "0.1.5", + "version": "0.2.0", "description": "", "type": "module", "scripts": { diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index e3bbbe1..2d08b9e 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "picoforge" -version = "0.1.5" +version = "0.2.0" description = "An open source commissioning tool for Pico FIDO security keys. Developed with Rust, Tauri, and Svelte." authors = ["Suyog Tandel"] license = "AGPL-3.0" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a9c7972..2c39575 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "picoforge", - "version": "0.1.5", + "version": "0.2.0", "identifier": "in.suyogtandel.picoforge", "build": { "beforeDevCommand": "deno task dev", @@ -13,7 +13,7 @@ "macOSPrivateApi": true, "windows": [ { - "title": "pico-forge", + "title": "picoforge", "width": 1280, "height": 720, "minWidth": 500, diff --git a/src/lib/views/passkeysView.svelte b/src/lib/views/passkeysView.svelte index 3992864..e33e8da 100644 --- a/src/lib/views/passkeysView.svelte +++ b/src/lib/views/passkeysView.svelte @@ -5,6 +5,7 @@ import * as Card from "$lib/components/ui/card"; import * as Alert from "$lib/components/ui/alert"; import * as Dialog from "$lib/components/ui/dialog"; + import * as AlertDialog from "$lib/components/ui/alert-dialog"; import * as Drawer from "$lib/components/ui/drawer"; import { Badge } from "$lib/components/ui/badge"; import { Separator } from "$lib/components/ui/separator"; @@ -20,6 +21,10 @@ let detailsOpen = $state(false); let selectedCredential: StoredCredential | null = $state(null); + let deleteDialogOpen = $state(false); + let credentialToDelete: StoredCredential | null = $state(null); + let deleteConfirmationInput = $state(""); + $effect(() => { if (device.connected && !device.unlocked) { showPinDialog = true; @@ -34,6 +39,7 @@ return; } + loading = true; const res = await device.getCredentials(pin); if (!res.success) { @@ -43,30 +49,42 @@ loading = false; } - async function handleDelete(id: string, rpId: string) { - if (!confirm(`Are you sure you want to delete the passkey for "${rpId}"?`)) return; - loading = true; + function initiateDelete(cred: StoredCredential) { + credentialToDelete = cred; + deleteConfirmationInput = ""; + deleteDialogOpen = true; + } - const res = await device.deleteCredential(pin, id); + async function executeDelete() { + if (!credentialToDelete) return; + + loading = true; + const { credentialId } = credentialToDelete; + + const res = await device.deleteCredential(pin, credentialId); if (res.success) { await device.getCredentials(pin); - if (selectedCredential?.credentialId === id) { + if (selectedCredential?.credentialId === credentialId) { detailsOpen = false; selectedCredential = null; } + + deleteDialogOpen = false; + credentialToDelete = null; } else { + deleteDialogOpen = false; error = typeof res.msg === "string" ? res.msg : "Failed to delete credential"; } + loading = false; } function handleLock() { - device.lock(); // Clears global state + device.lock(); pin = ""; error = ""; - // The effect will see device.unlocked is false and open the dialog } function openDetails(cred: StoredCredential) { @@ -75,6 +93,7 @@ } +