diff options
author | Vika <vika@fireburn.ru> | 2022-07-15 02:14:09 +0300 |
---|---|---|
committer | Vika <vika@fireburn.ru> | 2022-07-15 02:14:09 +0300 |
commit | 54d6afbe21a94c8de53852d4cd550de75473557f (patch) | |
tree | 7c202718455feda7fc34c3002d4ea56a9cbf6bd4 /kittybox-rs/src/indieauth/backend.rs | |
parent | 36535deba96b19cf0af3fe56763f982fc6ae3fc0 (diff) | |
download | kittybox-54d6afbe21a94c8de53852d4cd550de75473557f.tar.zst |
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
Diffstat (limited to 'kittybox-rs/src/indieauth/backend.rs')
-rw-r--r-- | kittybox-rs/src/indieauth/backend.rs | 21 |
1 files changed, 21 insertions, 0 deletions
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<T> = std::io::Result<T>; + +#[async_trait::async_trait] +pub trait AuthBackend: Clone + Send + Sync + 'static { + async fn create_code(&self, data: AuthorizationRequest) -> Result<String>; + async fn get_code(&self, code: &str) -> Result<Option<AuthorizationRequest>>; + async fn create_token(&self, data: TokenData) -> Result<String>; + async fn get_token(&self, token: &str) -> Result<Option<TokenData>>; + async fn list_tokens(&self, website: url::Url) -> Result<HashMap<String, TokenData>>; + async fn revoke_token(&self, token: &str) -> Result<()>; + async fn create_refresh_token(&self, data: TokenData) -> Result<String>; + async fn get_refresh_token(&self, token: &str) -> Result<Option<TokenData>>; + async fn list_refresh_tokens(&self, website: url::Url) -> Result<HashMap<String, TokenData>>; + async fn revoke_refresh_token(&self, token: &str) -> Result<()>; +} |