diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2024-10-01 23:57:22 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2024-10-01 23:57:22 -0400 |
| commit | f878f0b5eaa44e8ee8d67cbfd706926ff2119113 (patch) | |
| tree | fd9534ebc884da59b4031e2bcf2eb2d9dac35a87 /src/repo/token.rs | |
| parent | d171a258ad2119e39cb715f8800031fff16967dc (diff) | |
Organize IDs into top-level namespaces.
(This is part of a larger reorganization.)
Diffstat (limited to 'src/repo/token.rs')
| -rw-r--r-- | src/repo/token.rs | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/src/repo/token.rs b/src/repo/token.rs index 1663f5e..79e5c54 100644 --- a/src/repo/token.rs +++ b/src/repo/token.rs @@ -1,10 +1,11 @@ -use std::fmt; - use sqlx::{sqlite::Sqlite, SqliteConnection, Transaction}; use uuid::Uuid; -use super::login::{self, Login}; -use crate::{clock::DateTime, id::Id as BaseId, login::extract::IdentitySecret}; +use super::login::Login; +use crate::{ + clock::DateTime, + login::{self, extract::IdentitySecret, token::Id}, +}; pub trait Provider { fn tokens(&mut self) -> Tokens; @@ -148,27 +149,3 @@ impl<'c> Tokens<'c> { Ok(login) } } - -// Stable identifier for a token. Prefixed with `T`. -#[derive(Clone, Debug, Eq, Hash, PartialEq, sqlx::Type, serde::Deserialize, serde::Serialize)] -#[sqlx(transparent)] -#[serde(transparent)] -pub struct Id(BaseId); - -impl From<BaseId> for Id { - fn from(id: BaseId) -> Self { - Self(id) - } -} - -impl Id { - pub fn generate() -> Self { - BaseId::generate("T") - } -} - -impl fmt::Display for Id { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - self.0.fmt(f) - } -} |
