From 8df0ef0368dd3f6fdd2fccb5da458a1fe99f25e0 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Sat, 27 Jan 2024 21:45:33 -0800 Subject: Initial version of chkoauth2 --- src/indieauth.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/indieauth.rs (limited to 'src/indieauth.rs') diff --git a/src/indieauth.rs b/src/indieauth.rs new file mode 100644 index 0000000..0f04b84 --- /dev/null +++ b/src/indieauth.rs @@ -0,0 +1,21 @@ +//! Extras for working with IndieAuth endpoints. + +use oauth2::ExtraTokenFields; +use serde::{Deserialize, Serialize}; + +/// An IndieAuth access token and introspection reponse has an additional +/// `me` field. +/// +/// See https://indieauth.spec.indieweb.org/#access-token-verification +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct IndieAuthToken { + me: String, +} + +impl IndieAuthToken { + pub fn me(&self) -> &str { + &self.me + } +} + +impl ExtraTokenFields for IndieAuthToken {} -- cgit v1.2.3