summary refs log tree commit diff
path: root/src/secrets.rs
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2024-08-25 03:04:22 +0300
committerVika <vika@fireburn.ru>2024-08-25 03:04:22 +0300
commit847648330cc0e7af59fa6923f45222726d404250 (patch)
tree0c2e9c3d80e5de187889d43233011aae26a8b8b0 /src/secrets.rs
parent96f1c3580e8dab10ad862c9e08baaf09b96e0174 (diff)
Prototype for signing in with IndieAuth
The code is really janky and unpolished, the error handling is
TERRIBLE, and I think I can't publish it like this. This'll need a
refactor, but it'll come tomorrow.
Diffstat (limited to 'src/secrets.rs')
-rw-r--r--src/secrets.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/secrets.rs b/src/secrets.rs
new file mode 100644
index 0000000..c8c9bd7
--- /dev/null
+++ b/src/secrets.rs
@@ -0,0 +1,17 @@
+pub const ACCESS_TOKEN: &str = "access_token";
+pub const REFRESH_TOKEN: &str = "refresh_token";
+
+pub const ME: &str = "me";
+pub const TOKEN_KIND: &str = "token_kind";
+pub const EXPIRES_IN: &str = "expires_in";
+pub const MICROPUB: &str = "micropub";
+
+pub fn get_schema() -> libsecret::Schema {
+    let mut attrs = std::collections::HashMap::new();
+    attrs.insert(ME, libsecret::SchemaAttributeType::String);
+    attrs.insert(TOKEN_KIND, libsecret::SchemaAttributeType::String);
+    attrs.insert(MICROPUB, libsecret::SchemaAttributeType::String);
+    attrs.insert(EXPIRES_IN, libsecret::SchemaAttributeType::Integer);
+
+    libsecret::Schema::new("org.indieweb.indieauth.BearerCredential", libsecret::SchemaFlags::NONE, attrs)
+}