m2/org/openalice-auth

openalice-auth

> JWT authentication + SSO cookie service. The single front door for every OpenAlice product.

Features
38
Status
·unknown
Last activity
12d ago
Branch
mvp

auth/agent

2 features
  • auth.agent_config.get
    src/routes.rs:1578
    Read the user's unified agent config — shared identity (avatar + VRM), voice settings (TTS+STT provider/voice/language/emotion/pace), and per-product enable+system-prompt for live/social/persona/world. Returns a built-in default when no row exists yet.
    api:GET /auth/agent-config
    since 0.1.0
  • auth.agent_config.put
    src/routes.rs:1605
    Upsert the user's agent config. Validates tts/stt providers against the known-good allowlist and per-product JSON shape. Partial updates supported — fields the request omits keep their current values.
    api:PUT /auth/agent-config
    since 0.1.0

auth/broadcast

2 features
  • auth.broadcast_config.get
    src/routes.rs:1737
    Read the user's current studio broadcast config (preset_id + per-stream overrides). Defaults to {preset_id="qa-host", overrides={}} when no row has been saved yet — first-time streamers don't have to click anything before going live.
    api:GET /auth/broadcast-config
    since 0.1.0
  • auth.broadcast_config.put
    src/routes.rs:1765
    Upsert the user's studio broadcast config. Validates preset_id against the @openalicelabs/presets allowlist; rejects unknown ids with 400. Returns the persisted row so the client can mirror updated_at.
    api:PUT /auth/broadcast-config
    since 0.1.0

auth/chat

1 feature
  • auth.chat_sources.create
    src/routes.rs:2787
    Persist a chat-read source (YouTube / Twitch / Kick) — the config blob is encrypted at rest by the same crypto pipeline as stream_destinations. Returns the masked public shape.
    api:POST /auth/chat-sources
    since 0.1.0

auth/crypto

1 feature
  • auth.password.hash
    src/auth.rs:361
    Hash a password with Argon2id using a per-call random salt.
    since 0.1.0

auth/devices

4 features
  • auth.devices.list
    src/devices.rs:180
    List the user's paired devices — Hub /account/devices renders this.
    api:GET /auth/devices
    since 0.6.0
  • auth.devices.pair_claim
    src/devices.rs:107
    Exchange a pairing code for a 90-day device-scoped JWT (audience = live + persona). Unauthenticated by design — the code itself is the credential.
    api:POST /auth/devices/pair/claim
    since 0.6.0
  • auth.devices.pair_start
    src/devices.rs:74
    Generate a short-lived pairing code (8 chars, 10 min TTL) the user types into openalice-stream-host. Code is single-use; claiming it issues a 90-day device-scoped JWT.
    api:POST /auth/devices/pair/start
    since 0.6.0
  • auth.devices.revoke
    src/devices.rs:210
    Revoke a paired device — sets revoked_at, the issued JWT's jti goes into the revocation set so subsequent calls from that token are rejected.
    api:DELETE /auth/devices/{id}
    since 0.6.0

auth/email

2 features
  • auth.email.verify
    src/routes.rs:936
    Consume an email-verification token (looked up by SHA-256 hash). Marks the user verified and the token used. Idempotent — already-verified users get 200 with the same payload.
    api:POST /auth/verify
    since 0.1.0
  • auth.email.verify_send
    src/routes.rs:814
    Issue a new email-verification token for the authenticated user, hash it, persist with 24h expiry, and "send" the verification link via the email stub.
    api:POST /auth/verify-email/send
    since 0.1.0

auth/mfa

3 features
  • auth.mfa.disable
    src/routes.rs:1492
    Disable MFA after re-confirming the user's password (defense against a session-stealing attacker silently turning MFA off). Clears mfa_secret + mfa_enabled.
    api:POST /auth/mfa/disable
    since 0.1.0
  • auth.mfa.setup
    src/routes.rs:1367
    Begin MFA enrollment — generates a fresh TOTP secret, stores it on the user (NOT yet enabled), and returns the secret + otpauth URL so the client can render a QR. Re-running before /auth/mfa/verify rotates the secret. Idempotent against an already-enabled user — returns 409 so the client tells the user to disable first.
    api:POST /auth/mfa/setup
    since 0.1.0
  • auth.mfa.verify
    src/routes.rs:1424
    Confirm enrollment by submitting a code derived from the secret stored at /auth/mfa/setup. On success, mfa_enabled flips to true and subsequent /auth/login flows require a second factor.
    api:POST /auth/mfa/verify
    since 0.1.0

auth/oauth

1 feature
  • auth.oauth.youtube_start
    src/routes.rs:1902
    Begin a YouTube (Google) OAuth flow — generates a state nonce, persists it server-side, returns the Google authorize URL the client should redirect to. The callback will create a `chat_sources` row with the user's refresh + access tokens.
    api:POST /auth/connectors/youtube/start
    since 0.1.0

auth/password

2 features
  • auth.password.forgot
    src/routes.rs:1061
    Issue a password-reset token for the given email and send the reset link via the email stub. Always returns 204 — never reveals whether the email is registered (timing attacks aside, this stops trivial account-enumeration).
    api:POST /auth/password/forgot
    since 0.1.0
  • auth.password.reset
    src/routes.rs:1115
    Consume a password-reset token (looked up by SHA-256 hash) and rewrite the user's password. Marks the token used and revokes ALL outstanding refresh tokens for the user (forces re-login on every device).
    api:POST /auth/password/reset
    since 0.1.0

auth/presence

1 feature
  • auth.presence.online
    src/routes.rs:609
    List users with last_seen ≤ 2 minutes ago who haven't set their status to invisible. Powers the Hub "who's online" widget and any cross-product presence indicator.
    api:GET /auth/users/online
    since 0.1.0

auth/realtime

4 features
  • auth.realtime.broadcast
    src/routes.rs:2686
    Service-to-service entry point — POST a notification (optionally targeted at a specific user) and the auth WS hub fans it out to every connected client. Authenticated by a shared secret in the `X-Internal-Secret` header (env `INTERNAL_BROADCAST_SECRET`). Producers: social-api on DM, persona on session events, billing on plan changes.
    api:POST /internal/broadcast
    since 0.1.0
  • auth.realtime.chat_event
    src/routes.rs:3036
    Service-to-service entry — POST a normalized chat message from any platform connector (openalice-chat-bridge for YouTube/Twitch/Kick/TikTok) and the broadcast owner's connected agent receives it as a `chat_message` event over /auth/ws. Bypasses the notification cooldown (chat is a stream). Authenticated by X-Internal-Secret.
    api:POST /internal/chat
    since 0.1.0
  • auth.realtime.chat_feed
    src/routes.rs:3064
    Service-to-service entry — POST a mechanical chat aggregation tick (n-gram topics + mood + highlight quotes over a fixed window) from the chat-bridge feed-aggregator. The broadcast owner's connected agent receives it as a `chat_feed` event over /auth/ws — a cheap "what is the room doing?" heartbeat that costs zero LLM tokens to produce. Authenticated by X-Internal-Secret.
    api:POST /internal/chat-feed
    since 0.5.0
  • auth.realtime.ws
    src/routes.rs:1341
    WebSocket fan-out — clients open with ?token=ACCESS_JWT and receive cross-product real-time events (presence_changed today, notifications + DM events later). Server-push only; messages from the client are currently ignored.
    api:GET /auth/ws
    since 0.1.0

auth/sessions

2 features
  • auth.sessions.list
    src/routes.rs:1227
    List the authenticated user's active refresh-token sessions (one per browser/device login). Each row carries user_agent, created_at, last_used_at, and a `current` flag marking the device this request came from.
    api:GET /auth/sessions
    since 0.1.0
  • auth.sessions.revoke
    src/routes.rs:1265
    Revoke a specific refresh-token session by id. Marks the row revoked and blacklists its current jti so the next /auth/refresh from that device fails. Existing access tokens on that device survive until natural expiry (≤1h).
    api:DELETE /auth/sessions/:id
    since 0.1.0

auth/streams

6 features
  • auth.streams.create
    src/routes.rs:2341
    Persist a per-platform stream destination — label, platform, optional RTMP URL override, encrypted stream key. Returns the masked public shape.
    api:POST /auth/streams
    since 0.1.0
  • auth.streams.delete
    src/routes.rs:2487
    Permanently delete a stream destination.
    api:DELETE /auth/streams/:id
    since 0.1.0
  • auth.streams.internal_lookup
    src/routes.rs:2563
    Service-to-service endpoint for the broadcaster — given a user_id (path) and optional destination ids (query), returns enabled destinations with PLAINTEXT stream keys. Authenticated via X-Internal-Secret. The broadcaster is the only caller.
    api:GET /internal/users/:id/streams
    since 0.1.0
  • auth.streams.list
    src/routes.rs:2421
    List the user's stream destinations with masked stream keys ("live_••••wxyz" preview).
    api:GET /auth/streams
    since 0.1.0
  • auth.streams.reveal
    src/routes.rs:2511
    Reveal the plaintext stream key after re-confirming the user's password. Stream keys aren't returned by the list endpoint by design — this is the dedicated unmask path.
    api:POST /auth/streams/:id/reveal
    since 0.1.0
  • auth.streams.update
    src/routes.rs:2448
    Update a destination's label or enabled flag. Stream-key rotation is a delete + create operation by design.
    api:PUT /auth/streams/:id
    since 0.1.0

auth/tokens

1 feature
  • auth.token.refresh
    src/routes.rs:419
    Exchange a refresh token for a fresh access+refresh JWT pair (rotation).
    api:POST /auth/refresh
    since 0.1.0

auth/users

6 features
  • auth.account.delete
    src/routes.rs:775
    Permanently delete the authenticated user's account and revoke all tokens.
    api:DELETE /auth/account
    since 0.1.0
  • auth.profile.update
    src/routes.rs:648
    Update authenticated user's profile fields (display name, avatar, bio).
    api:PUT /auth/profile
    since 0.1.0
  • auth.user.login
    src/routes.rs:229
    Verify email+password and issue access+refresh JWT pair.
    api:POST /auth/login
    since 0.1.0
  • auth.user.login_mfa
    src/routes.rs:341
    Exchange a pre-MFA token + TOTP code for a full session. Issued only when /auth/login responds with mfa_required=true. Pre-MFA token is audience-restricted so it can't be used against any downstream service if leaked.
    api:POST /auth/login/mfa
    since 0.1.0
  • auth.user.me
    src/routes.rs:570
    Return current authenticated user's profile (id, email, username, status). Side effect — bumps users.last_seen so the user surfaces in the online-users feed.
    api:GET /auth/me
    since 0.1.0
  • auth.user.register
    src/routes.rs:124
    Register a new user with email + username + password (Argon2id), returns access+refresh JWT pair.
    api:POST /auth/register
    since 0.1.0