diff options
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) - } -} |
