feat(ui): implement passkeys handling and fetching with gpui

This commit is contained in:
Suyog Tandel
2026-02-04 23:25:14 +05:30
parent 8f6eccd2ff
commit 1ffb15ea1a
6 changed files with 645 additions and 272 deletions
+1
View File
@@ -20,3 +20,4 @@ result
# misc
docs-gpui-components
src-svelte
gpui-component
Generated
+34 -35
View File
@@ -92,9 +92,9 @@ checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1"
[[package]]
name = "arc-swap"
version = "1.8.0"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51d03449bb8ca2cc2ef70869af31463d1ae5ccc8fa3e334b307203fbf815207e"
checksum = "9ded5f9a03ac8f24d1b8a25101ee812cd32cdc8c50a4c50237de2c4915850e73"
dependencies = [
"rustversion",
]
@@ -729,9 +729,9 @@ checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"
[[package]]
name = "bytemuck"
version = "1.24.0"
version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4"
checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"
dependencies = [
"bytemuck_derive",
]
@@ -761,9 +761,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]]
name = "bytes"
version = "1.11.0"
version = "1.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"
[[package]]
name = "calloop"
@@ -820,9 +820,9 @@ dependencies = [
[[package]]
name = "cc"
version = "1.2.54"
version = "1.2.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583"
checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"
dependencies = [
"find-msvc-tools",
"jobserver",
@@ -1837,15 +1837,15 @@ dependencies = [
[[package]]
name = "find-msvc-tools"
version = "0.1.8"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db"
checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"
[[package]]
name = "flate2"
version = "1.1.8"
version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369"
checksum = "843fba2746e448b37e26a819579957415c8cef339bf08564fe8b7ddbd959573c"
dependencies = [
"crc32fast",
"miniz_oxide",
@@ -2820,13 +2820,12 @@ dependencies = [
[[package]]
name = "hyper-util"
version = "0.1.19"
version = "0.1.20"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f"
checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0"
dependencies = [
"bytes",
"futures-channel",
"futures-core",
"futures-util",
"http",
"http-body",
@@ -4866,9 +4865,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.12.2"
version = "1.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
dependencies = [
"aho-corasick",
"memchr",
@@ -4878,9 +4877,9 @@ dependencies = [
[[package]]
name = "regex-automata"
version = "0.4.13"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
dependencies = [
"aho-corasick",
"memchr",
@@ -4889,9 +4888,9 @@ dependencies = [
[[package]]
name = "regex-syntax"
version = "0.8.8"
version = "0.8.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"
[[package]]
name = "resvg"
@@ -5213,9 +5212,9 @@ dependencies = [
[[package]]
name = "schemars"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2"
checksum = "a2b42f36aa1cd011945615b92222f6bf73c599a102a300334cd7f8dbeec726cc"
dependencies = [
"dyn-clone",
"indexmap",
@@ -5227,9 +5226,9 @@ dependencies = [
[[package]]
name = "schemars_derive"
version = "1.2.0"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4908ad288c5035a8eb12cfdf0d49270def0a268ee162b75eeee0f85d155a7c45"
checksum = "7d115b50f4aaeea07e79c1912f645c7513d81715d0420f8bc77a18c6260b307f"
dependencies = [
"proc-macro2",
"quote",
@@ -5539,9 +5538,9 @@ dependencies = [
[[package]]
name = "slab"
version = "0.4.11"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589"
checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
[[package]]
name = "slotmap"
@@ -6398,9 +6397,9 @@ dependencies = [
[[package]]
name = "tree-sitter-language"
version = "0.1.6"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ae62f7eae5eb549c71b76658648b72cc6111f2d87d24a1e31fa907f4943e3ce"
checksum = "009994f150cc0cd50ff54917d5bc8bffe8cad10ca10d81c34da2ec421ae61782"
[[package]]
name = "triomphe"
@@ -7922,18 +7921,18 @@ checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
[[package]]
name = "zerocopy"
version = "0.8.35"
version = "0.8.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fdea86ddd5568519879b8187e1cf04e24fce28f7fe046ceecbce472ff19a2572"
checksum = "57cf3aa6855b23711ee9852dfc97dfaa51c45feaba5b645d0c777414d494a961"
dependencies = [
"zerocopy-derive",
]
[[package]]
name = "zerocopy-derive"
version = "0.8.35"
version = "0.8.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c15e1b46eff7c6c91195752e0eeed8ef040e391cdece7c25376957d5f15df22"
checksum = "8a616990af1a287837c4fe6596ad77ef57948f787e46ce28e166facc0cc1cb75"
dependencies = [
"proc-macro2",
"quote",
@@ -8016,9 +8015,9 @@ dependencies = [
[[package]]
name = "zmij"
version = "1.0.17"
version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "02aae0f83f69aafc94776e879363e9771d7ecbffe2c7fbb6c14c5e00dfe88439"
checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"
[[package]]
name = "zune-core"
Generated
+9 -9
View File
@@ -6,11 +6,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1770102568,
"narHash": "sha256-VYwA9FmakKJ3zLfAd7bdj9xIB9PzfISLoYh6eZl+EuQ=",
"lastModified": 1770188896,
"narHash": "sha256-ZBpEh6aTvdoZvIM8sojnr43FPyegq/sjUkNWtF4kDO8=",
"owner": "nix-community",
"repo": "fenix",
"rev": "592daa37b5a3175c61541329b64d6c1972303bc1",
"rev": "6dbe5750c68a55e7cb3f8b62883c4dbfeecf14d5",
"type": "github"
},
"original": {
@@ -38,11 +38,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1770019141,
"narHash": "sha256-VKS4ZLNx4PNrABoB0L8KUpc1fE7CLpQXQs985tGfaCU=",
"lastModified": 1770115704,
"narHash": "sha256-KHFT9UWOF2yRPlAnSXQJh6uVcgNcWlFqqiAZ7OVlHNc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "cb369ef2efd432b3cdf8622b0ffc0a97a02f3137",
"rev": "e6eae2ee2110f3d31110d5c222cd395303343b08",
"type": "github"
},
"original": {
@@ -93,11 +93,11 @@
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1770026591,
"narHash": "sha256-VZlloygYDmozJwbZZkCSNpiPhNdOW/AA0b6LmNBZ3xU=",
"lastModified": 1770092556,
"narHash": "sha256-DcUKN1nzz7LhyZGJMhSBhY5zrl8/GjJJ9SNqqTd77OQ=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "74eca73f3b0a41b80228b8e499c7547cc8b2effa",
"rev": "a84d92ff213e30fb00d7b812e07c4f67e99dcd29",
"type": "github"
},
"original": {
+10 -5
View File
@@ -1,4 +1,6 @@
{ pkgs ? import <nixpkgs> { } }:
{
pkgs ? import <nixpkgs> { },
}:
let
libraries = with pkgs; [
@@ -31,10 +33,12 @@ let
# Development tools
rustc
clippy
rustfmt
rust-analyzer
rustPlatform.rustLibSrc
mold
cargo
deno
nodejs_22
# GPUI
libxkbcommon
@@ -48,9 +52,10 @@ in
pkgs.mkShell {
buildInputs = packages;
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath libraries}:$LD_LIBRARY_PATH
# export GTK_PATH=${pkgs.libcanberra-gtk3}/lib/gtk-3.0:${pkgs.packagekit}/lib/gtk-3.0:$GTK_PATH
export XDG_DATA_DIRS=$GSETTINGS_SCHEMAS_PATH:$XDG_DATA_DIRS
export RUSTFLAGS="-C link-arg=-fuse-ld=mold"
@@ -59,6 +64,6 @@ pkgs.mkShell {
# export WEBKIT_DISABLE_COMPOSITING_MODE=1
echo "Nix development environment loaded!"
echo "Available tools: rustc, cargo, deno, node, tauri"
echo "Available tools: rustc, cargo"
'';
}
+43 -4
View File
@@ -6,13 +6,14 @@ use crate::ui::{
colors,
views::{
about::AboutView, config::ConfigView, home::HomeView, logs::LogsView,
passkeys::PasskeysView, security::SecurityView,
passkeys::PasskeysEvent, passkeys::PasskeysView, security::SecurityView,
},
};
use gpui::prelude::*;
use gpui::*;
use gpui_component::{
ActiveTheme, Icon, IconName, TitleBar,
ActiveTheme, Icon, IconName, TitleBar, WindowExt,
button::{Button, ButtonVariants},
h_flex,
scroll::ScrollableElement,
@@ -27,6 +28,7 @@ pub struct ApplicationRoot {
sidebar_width: Pixels,
refresh_button: Entity<PFIconButton>,
config_view: Option<Entity<ConfigView>>,
passkeys_view: Option<Entity<PasskeysView>>,
}
impl ApplicationRoot {
@@ -50,6 +52,7 @@ impl ApplicationRoot {
sidebar_width: px(255.),
refresh_button,
config_view: None,
passkeys_view: None,
};
this.refresh_device_status(cx);
this
@@ -81,7 +84,14 @@ impl ApplicationRoot {
if let Some(config_view) = &self.config_view {
config_view.update(cx, |view, cx| {
view.update_device_status(Some(status), cx);
view.update_device_status(Some(status.clone()), cx);
});
}
if let Some(passkeys_view) = &self.passkeys_view {
let fido = self.state.fido_info.clone();
passkeys_view.update(cx, |view, cx| {
view.update_device_status(Some(status.clone()), fido, cx);
});
}
}
@@ -164,7 +174,36 @@ impl Render for ApplicationRoot {
HomeView::build(&self.state, cx.theme()).into_any_element()
}
ActiveView::Passkeys => {
PasskeysView::build(cx.theme()).into_any_element()
let view = self.passkeys_view.get_or_insert_with(|| {
let view = cx.new(|cx| {
PasskeysView::new(
window,
cx,
self.state.device_status.clone(),
self.state.fido_info.clone(),
)
});
cx.subscribe_in(
&view,
window,
|_, _, event: &PasskeysEvent, window, cx| {
match event {
PasskeysEvent::Notification(msg) => {
window.push_notification(
msg.to_string(),
cx,
);
}
PasskeysEvent::CloseDialog => {
window.close_dialog(cx);
}
}
},
)
.detach();
view
});
view.clone().into_any_element()
}
ActiveView::Configuration => {
let view = self.config_view.get_or_insert_with(|| {
+548 -219
View File
File diff suppressed because it is too large Load Diff