summaryrefslogtreecommitdiff
path: root/src/indieauth.rs
diff options
context:
space:
mode:
authorJesse Morgan <jesse@jesterpm.net>2024-01-27 21:45:33 -0800
committerJesse Morgan <jesse@jesterpm.net>2024-01-27 21:45:33 -0800
commit8df0ef0368dd3f6fdd2fccb5da458a1fe99f25e0 (patch)
tree55c873f7742411eb099f874b84d01327471bda62 /src/indieauth.rs
Initial version of chkoauth2v0.1.0
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 {}