From 53c868691a09b84d71f724d23a09d1fb89368792 Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 19 Sep 2022 19:01:06 +0300 Subject: Make webauthn and openssl optional --- kittybox-rs/src/indieauth/backend/fs.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'kittybox-rs/src/indieauth/backend/fs.rs') diff --git a/kittybox-rs/src/indieauth/backend/fs.rs b/kittybox-rs/src/indieauth/backend/fs.rs index fbfa0f7..57bc3bd 100644 --- a/kittybox-rs/src/indieauth/backend/fs.rs +++ b/kittybox-rs/src/indieauth/backend/fs.rs @@ -7,6 +7,7 @@ use kittybox_indieauth::{ }; use serde::de::DeserializeOwned; use tokio::{task::spawn_blocking, io::AsyncReadExt}; +#[cfg(feature = "webauthn")] use webauthn::prelude::{Passkey, PasskeyRegistration, PasskeyAuthentication}; const CODE_LENGTH: usize = 16; @@ -343,15 +344,18 @@ impl AuthBackend for FileBackend { } // WebAuthn credential management. + #[cfg(feature = "webauthn")] async fn enroll_webauthn(&self, website: &url::Url, credential: Passkey) -> Result<()> { todo!() } + #[cfg(feature = "webauthn")] async fn list_webauthn_pubkeys(&self, website: &url::Url) -> Result> { // TODO stub! Ok(vec![]) } + #[cfg(feature = "webauthn")] async fn persist_registration_challenge( &self, website: &url::Url, @@ -360,6 +364,7 @@ impl AuthBackend for FileBackend { todo!() } + #[cfg(feature = "webauthn")] async fn retrieve_registration_challenge( &self, website: &url::Url, @@ -368,6 +373,7 @@ impl AuthBackend for FileBackend { todo!() } + #[cfg(feature = "webauthn")] async fn persist_authentication_challenge( &self, website: &url::Url, @@ -376,6 +382,7 @@ impl AuthBackend for FileBackend { todo!() } + #[cfg(feature = "webauthn")] async fn retrieve_authentication_challenge( &self, website: &url::Url, @@ -392,12 +399,13 @@ impl AuthBackend for FileBackend { .join("password")) .await { - Ok(metadata) => creds.push(EnrolledCredential::Password), + Ok(_) => creds.push(EnrolledCredential::Password), Err(err) => if err.kind() != std::io::ErrorKind::NotFound { return Err(err) } } + #[cfg(feature = "webauthn")] if !self.list_webauthn_pubkeys(website).await?.is_empty() { creds.push(EnrolledCredential::WebAuthn); } -- cgit 1.4.1