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/indieauth/src | |
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/indieauth/src')
-rw-r--r-- | kittybox-rs/indieauth/src/lib.rs | 4 | ||||
-rw-r--r-- | kittybox-rs/indieauth/src/pkce.rs | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/kittybox-rs/indieauth/src/lib.rs b/kittybox-rs/indieauth/src/lib.rs index 9408eb6..eca1102 100644 --- a/kittybox-rs/indieauth/src/lib.rs +++ b/kittybox-rs/indieauth/src/lib.rs @@ -145,7 +145,7 @@ pub enum GrantResponse { profile: Option<Profile>, access_token: String, #[serde(skip_serializing_if = "Option::is_none")] - expires_in: Option<usize>, + expires_in: Option<u64>, #[serde(skip_serializing_if = "Option::is_none")] refresh_token: Option<String> }, @@ -257,6 +257,8 @@ pub struct TokenRevocationRequest { pub token: String } +// TODO rework in accordance with https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 +// turns out I got some values wrong #[derive(Debug, Clone, Copy, Serialize, Deserialize)] #[serde(rename_all = "snake_case")] #[serde(tag = "error")] diff --git a/kittybox-rs/indieauth/src/pkce.rs b/kittybox-rs/indieauth/src/pkce.rs index 1d3c58f..6dabcc3 100644 --- a/kittybox-rs/indieauth/src/pkce.rs +++ b/kittybox-rs/indieauth/src/pkce.rs @@ -40,7 +40,7 @@ pub struct PKCEChallenge { } impl PKCEChallenge { - fn new(code_verifier: PKCEVerifier, method: PKCEMethod) -> Self { + pub fn new(code_verifier: PKCEVerifier, method: PKCEMethod) -> Self { Self { code_challenge: match method { PKCEMethod::S256 => { @@ -53,7 +53,9 @@ impl PKCEChallenge { method } } - fn verify(&self, code_verifier: PKCEVerifier) -> bool { + + #[must_use] + pub fn verify(&self, code_verifier: PKCEVerifier) -> bool { Self::new(code_verifier, self.method) == *self } } |