aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: cdac76893ce3c4ee93f9a159d01a2fb51012c111 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#![allow(dead_code)]

// 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
    value: String,     // Plaintext value
    signature: String, // Cryptographic signature
}

#[derive(Debug)]
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)]
struct APIResponse {
    namespace: String, // Namespace of token. If nil, expect prefix-based or default
    token: String,     // Base64-encoded token value
    signature: String, // Cryptographic signature
}

fn main() {
    println!("Hello, world!");
}