Skip to main content

px_auth/domain/
key_store.rs

1use async_trait::async_trait;
2use px_errors::AppError;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
6pub struct ApiKeyRecord {
7    pub id: String,
8    pub argon2_hash: String,
9    pub note: Option<String>,
10}
11
12#[async_trait]
13pub trait KeyStore: Send + Sync {
14    async fn find_by_id(&self, id: &str) -> Result<Option<ApiKeyRecord>, AppError>;
15    async fn list_ids(&self) -> Result<Vec<String>, AppError>;
16}