diff options
| author | soryu <soryu@soryu.co> | 2026-02-06 02:08:37 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-06 02:08:37 +0000 |
| commit | 25e1275af1b742cc7866fba91152d9a4734a6f94 (patch) | |
| tree | e92c7e168f4e73c302fb63217ea20bf8cfa2ba7e /makima/src/server/auth.rs | |
| parent | 8f725a7c64fbeb85ebeb59b54d2f774e9a0a59d6 (diff) | |
| download | soryu-25e1275af1b742cc7866fba91152d9a4734a6f94.tar.gz soryu-25e1275af1b742cc7866fba91152d9a4734a6f94.zip | |
Fix: Directives API
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); |
