Skip to content

Overhaul tracker keys: allow permanent keys #979

@josecelano

Description

@josecelano

Parent issue: #773

We can allow single keys to be permanent.

/// An authentication key which has an expiration time.
/// After that time is will automatically become invalid.
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)]
pub struct ExpiringKey {
    /// Random 32-char string. For example: `YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ`
    pub key: Key,
    /// Timestamp, the key will be no longer valid after this timestamp
    pub valid_until: DurationSinceUnixEpoch,
}

There are some possible implementations:

Proposal 1: Set valid_until to 0

ExpiringKeys with the UnixEpoch value in the valid_until field don't expire.

Proposal 2: Make valid_until optional

pub struct ExpiringKey {
    pub key: Key,
    pub valid_until: Option<DurationSinceUnixEpoch>,
}

NOTICE: I would rename the struct to TrackerKey because it can be permanent. Alternatively, we could rename Key to Token and ExpiringKey to Key.

cc @da2ce7

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions