import os import streamlit as st from typing import Optional def current_uid() -> Optional[str]: """Return the signed-in user's id/email from session, if any.""" return st.session_state.get("uid") def get_current_uid() -> str: """Get current user ID with validation. Raises error if not logged in.""" uid = current_uid() if not uid: st.error("Please log in to continue.") st.stop() return uid