From 54d6afbe21a94c8de53852d4cd550de75473557f Mon Sep 17 00:00:00 2001 From: Vika Date: Fri, 15 Jul 2022 02:14:09 +0300 Subject: WIP: IndieAuth progress - Some kittybox-indieauth crate bugs were fixed - Things should mostly work... - ...if you somehow supply your own backend store - YES I MADE IT MODULAR AGAIN - NO I AM NOT SORRY - YOU WILL THANK ME LATER - DO NOT DENY THE HEAVENLY GIFT OF GENERICS IN RUST - Retrieving profiles doesn't work for now because I am unsure how to implement it best --- kittybox-rs/src/indieauth/backend.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 kittybox-rs/src/indieauth/backend.rs (limited to 'kittybox-rs/src/indieauth/backend.rs') diff --git a/kittybox-rs/src/indieauth/backend.rs b/kittybox-rs/src/indieauth/backend.rs new file mode 100644 index 0000000..f420db9 --- /dev/null +++ b/kittybox-rs/src/indieauth/backend.rs @@ -0,0 +1,21 @@ +use std::collections::HashMap; + +use kittybox_indieauth::{ + AuthorizationRequest, TokenData +}; + +type Result = std::io::Result; + +#[async_trait::async_trait] +pub trait AuthBackend: Clone + Send + Sync + 'static { + async fn create_code(&self, data: AuthorizationRequest) -> Result; + async fn get_code(&self, code: &str) -> Result>; + async fn create_token(&self, data: TokenData) -> Result; + async fn get_token(&self, token: &str) -> Result>; + async fn list_tokens(&self, website: url::Url) -> Result>; + async fn revoke_token(&self, token: &str) -> Result<()>; + async fn create_refresh_token(&self, data: TokenData) -> Result; + async fn get_refresh_token(&self, token: &str) -> Result>; + async fn list_refresh_tokens(&self, website: url::Url) -> Result>; + async fn revoke_refresh_token(&self, token: &str) -> Result<()>; +} -- cgit 1.4.1