From 7e8e688e2e58f9c944b941e768ab7b034a348a1f Mon Sep 17 00:00:00 2001 From: Vika Date: Thu, 1 Aug 2024 19:48:37 +0300 Subject: treewide: create a common method for state initialization Now the database objects can be uniformly created from a URI. They can also optionally do sanity checks and one-time initialization. --- src/indieauth/backend.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/indieauth/backend.rs') diff --git a/src/indieauth/backend.rs b/src/indieauth/backend.rs index 534bcfb..5814dc2 100644 --- a/src/indieauth/backend.rs +++ b/src/indieauth/backend.rs @@ -11,6 +11,8 @@ pub use fs::FileBackend; #[async_trait::async_trait] pub trait AuthBackend: Clone + Send + Sync + 'static { + /// Initialize self from URL, possibly performing initialization. + async fn new(url: &'_ url::Url) -> Result; // Authorization code management. /// Create a one-time OAuth2 authorization code for the passed /// authorization request, and save it for later retrieval. -- cgit 1.4.1