about summary refs log tree commit diff
path: root/kittybox-rs/src/indieauth/backend
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2022-09-19 19:01:06 +0300
committerVika <vika@fireburn.ru>2022-09-19 19:01:06 +0300
commit53c868691a09b84d71f724d23a09d1fb89368792 (patch)
treee5593882f3c9d4141a2cb796d48dc98b84411d20 /kittybox-rs/src/indieauth/backend
parentde105ec7a56752c152e3020fa53a0e13206f4cb4 (diff)
downloadkittybox-53c868691a09b84d71f724d23a09d1fb89368792.tar.zst
Make webauthn and openssl optional
Diffstat (limited to 'kittybox-rs/src/indieauth/backend')
-rw-r--r--kittybox-rs/src/indieauth/backend/fs.rs10
1 files changed, 9 insertions, 1 deletions
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<Vec<Passkey>> {
         // 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);
         }