diff options
author | Vika <vika@fireburn.ru> | 2022-09-19 19:01:06 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-09-19 19:01:06 +0300 |
commit | 53c868691a09b84d71f724d23a09d1fb89368792 (patch) | |
tree | e5593882f3c9d4141a2cb796d48dc98b84411d20 /kittybox-rs/src/indieauth/backend.rs | |
parent | de105ec7a56752c152e3020fa53a0e13206f4cb4 (diff) | |
download | kittybox-53c868691a09b84d71f724d23a09d1fb89368792.tar.zst |
Make webauthn and openssl optional
Diffstat (limited to 'kittybox-rs/src/indieauth/backend.rs')
-rw-r--r-- | kittybox-rs/src/indieauth/backend.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/kittybox-rs/src/indieauth/backend.rs b/kittybox-rs/src/indieauth/backend.rs index 8b0c10a..534bcfb 100644 --- a/kittybox-rs/src/indieauth/backend.rs +++ b/kittybox-rs/src/indieauth/backend.rs @@ -9,7 +9,6 @@ type Result<T> = std::io::Result<T>; pub mod fs; pub use fs::FileBackend; - #[async_trait::async_trait] pub trait AuthBackend: Clone + Send + Sync + 'static { // Authorization code management. @@ -44,7 +43,10 @@ pub trait AuthBackend: Clone + Send + Sync + 'static { /// Enroll a password credential for a user. Only one password /// credential must exist for a given user. async fn enroll_password(&self, website: &url::Url, password: String) -> Result<()>; + /// List currently enrolled credential types for a given user. + async fn list_user_credential_types(&self, website: &url::Url) -> Result<Vec<EnrolledCredential>>; // WebAuthn credential management. + #[cfg(feature = "webauthn")] /// Enroll a WebAuthn authenticator public key for this user. /// Multiple public keys may be saved for one user, corresponding /// to different authenticators used by them. @@ -53,8 +55,10 @@ pub trait AuthBackend: Clone + Send + Sync + 'static { /// updated version after using /// [webauthn::prelude::Passkey::update_credential()]. async fn enroll_webauthn(&self, website: &url::Url, credential: webauthn::prelude::Passkey) -> Result<()>; + #[cfg(feature = "webauthn")] /// List currently enrolled WebAuthn authenticators for a given user. async fn list_webauthn_pubkeys(&self, website: &url::Url) -> Result<Vec<webauthn::prelude::Passkey>>; + #[cfg(feature = "webauthn")] /// Persist registration challenge state for a little while so it /// can be used later. /// @@ -65,6 +69,7 @@ pub trait AuthBackend: Clone + Send + Sync + 'static { website: &url::Url, state: webauthn::prelude::PasskeyRegistration ) -> Result<String>; + #[cfg(feature = "webauthn")] /// Retrieve a persisted registration challenge. /// /// The challenge should be deleted after retrieval. @@ -73,6 +78,7 @@ pub trait AuthBackend: Clone + Send + Sync + 'static { website: &url::Url, challenge_id: &str ) -> Result<webauthn::prelude::PasskeyRegistration>; + #[cfg(feature = "webauthn")] /// Persist authentication challenge state for a little while so /// it can be used later. /// @@ -86,6 +92,7 @@ pub trait AuthBackend: Clone + Send + Sync + 'static { website: &url::Url, state: webauthn::prelude::PasskeyAuthentication ) -> Result<String>; + #[cfg(feature = "webauthn")] /// Retrieve a persisted authentication challenge. /// /// The challenge should be deleted after retrieval. @@ -94,6 +101,5 @@ pub trait AuthBackend: Clone + Send + Sync + 'static { website: &url::Url, challenge_id: &str ) -> Result<webauthn::prelude::PasskeyAuthentication>; - /// List currently enrolled credential types for a given user. - async fn list_user_credential_types(&self, website: &url::Url) -> Result<Vec<EnrolledCredential>>; + } |