diff options
author | Tyler Davis <tyler@gluecode.com> | 2024-02-15 04:07:09 +0000 |
---|---|---|
committer | Tyler Davis <tyler@gluecode.com> | 2024-02-15 04:07:09 +0000 |
commit | eccdce82a33d8bd4036fef07cd143c62adb9591d (patch) | |
tree | 9e13280b6444fd2e26327a51c4130c4dc65ad14f | |
parent | e8b747d34075003c6d34d340349774c902e73eee (diff) | |
download | fortknox-eccdce82a33d8bd4036fef07cd143c62adb9591d.tar.gz fortknox-eccdce82a33d8bd4036fef07cd143c62adb9591d.zip |
-rw-r--r-- | src/main.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index cdac768..f25d532 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,17 @@ -#![allow(dead_code)] +#![allow(dead_code, unused_imports)] + +use axum::{ + http::StatusCode, + response::{IntoResponse, Response}, + Json, +}; +use serde::Serialize; // Only one kind of token stored: value -> token (+signature) // Unless empty=true, immediately reject empty values. // Namespace defaults to "Default" for quick start. // Always sign tokens with central key. Store signature, update when keys change. - // "Rotate key" function should also re-sign tokens? - #[derive(Debug)] struct TokenStore { token: String, // Base64-encoded token value @@ -14,14 +19,14 @@ struct TokenStore { signature: String, // Cryptographic signature } -#[derive(Debug)] +#[derive(Debug, Serialize)] struct APISubmit { namespace: String, // Namespace of token. If nil, expect prefix-based or default value: String, // Plaintext value empty: bool, // Allow a "maybe empty" style of custom token for empty responses } -#[derive(Debug)] +#[derive(Debug, Serialize)] struct APIResponse { namespace: String, // Namespace of token. If nil, expect prefix-based or default token: String, // Base64-encoded token value |