From 2517cd777f8461e39bf67c0fd64d2a8f587a2bc9 Mon Sep 17 00:00:00 2001 From: Amatsugu Date: Sun, 5 Apr 2026 19:19:37 -0400 Subject: [PATCH] misc passkey prep --- AobaClient/Cargo.toml | 2 +- AobaClient/src/components/passkey.rs | 25 +++++++++++++++++-------- AobaClient/src/views/media.rs | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/AobaClient/Cargo.toml b/AobaClient/Cargo.toml index 27a1769..96d6629 100644 --- a/AobaClient/Cargo.toml +++ b/AobaClient/Cargo.toml @@ -15,7 +15,7 @@ tonic = { version = "*", default-features = false, features = [ ] } prost = "0.13" tonic-web-wasm-client = "0.7" -web-sys = { version = "0.3.91", features = ["Storage", "Window"] } +web-sys = { version = "0.3.91", features = ["Storage", "Window", "Navigator", "CredentialsContainer", "CredentialCreationOptions"] } dioxus-primitives = { git = "https://github.com/DioxusLabs/components", version = "0.0.1", default-features = false } [build-dependencies] diff --git a/AobaClient/src/components/passkey.rs b/AobaClient/src/components/passkey.rs index ecc9a15..380ce5f 100644 --- a/AobaClient/src/components/passkey.rs +++ b/AobaClient/src/components/passkey.rs @@ -1,27 +1,36 @@ use dioxus::prelude::*; +use web_sys::{CredentialCreationOptions, window}; use crate::components::basic::Button; #[component] -pub fn PasskeyRegistrationButton() -> Element -{ +pub fn PasskeyRegistrationButton() -> Element { rsx! { Button{ text: "Register Passkey", - onclick: move |e| { - + onclick: move |_| { + start_passkey_registration(); } } } } -fn start_passkey_registration() {} +fn start_passkey_registration() { + create_credential(); +} -fn create_credential() {} +fn create_credential() { + let credentials = window() + .expect("Failed to get window") + .navigator() + .credentials(); + + let opts = CredentialCreationOptions::new(); + let _result = credentials.create_with_options(&opts); +} #[component] -pub fn PasskeyLoginButton() -> Element -{ +pub fn PasskeyLoginButton() -> Element { rsx! { Button{ text: "Login with Passkey" diff --git a/AobaClient/src/views/media.rs b/AobaClient/src/views/media.rs index 713285c..4e80316 100644 --- a/AobaClient/src/views/media.rs +++ b/AobaClient/src/views/media.rs @@ -29,7 +29,7 @@ pub fn Media(id: String) -> Element { #[component] fn MediaPage(media: MediaModel) -> Element { let url = media.thumb_url; - let id = media.id.expect("Media has no id").value.clone(); + // let id = media.id.expect("Media has no id").value.clone(); let cur_class = use_signal(|| match media.class { 0 => "Standard", 1 => "NSFW",