summaryrefslogtreecommitdiff
path: root/src/indieauth.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/indieauth.rs')
-rw-r--r--src/indieauth.rs21
1 files changed, 21 insertions, 0 deletions
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 {}