diff options
Diffstat (limited to 'makima/src/server/auth.rs')
| -rw-r--r-- | makima/src/server/auth.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/makima/src/server/auth.rs b/makima/src/server/auth.rs index b694df6..90b7bda 100644 --- a/makima/src/server/auth.rs +++ b/makima/src/server/auth.rs @@ -837,6 +837,11 @@ pub async fn log_api_key_event( // Internal Helper Functions // ============================================================================= +/// Public wrapper for resolve_owner_id, used by SSE endpoints that authenticate via query params. +pub async fn resolve_owner_id_public(pool: &PgPool, user_id: Uuid, email: Option<&str>) -> Result<Uuid, AuthError> { + resolve_owner_id(pool, user_id, email).await +} + /// Resolve owner_id from user_id by looking up the users table. /// If the user doesn't exist, auto-creates them on first login. /// Uses ON CONFLICT to handle race conditions when multiple requests arrive simultaneously. @@ -894,6 +899,11 @@ async fn resolve_owner_id(pool: &PgPool, user_id: Uuid, email: Option<&str>) -> } } +/// Public wrapper for validate_api_key, used by SSE endpoints that authenticate via query params. +pub async fn validate_api_key_public(pool: &PgPool, key: &str) -> Result<(Uuid, Uuid), AuthError> { + validate_api_key(pool, key).await +} + /// Validate an API key and return (user_id, owner_id). async fn validate_api_key(pool: &PgPool, key: &str) -> Result<(Uuid, Uuid), AuthError> { let key_hash = hash_api_key(key); |
