user_codex_auth

Private, self-service Codex account linking for one resolved Star identity.

Only non-secret enrollment metadata is persisted here. The Codex backend owns all provider credentials and login state; Redis records only the opaque account generation needed to bind a later !gpt route to the same person.

Bases: object

The complete non-secret Redis representation of one linked account.

Parameters:
  • version (str)

  • account_id (str)

  • connected_at (str)

version: str
account_id: str
connected_at: str
user_codex_auth.CodexAccountStoreUnavailable

alias of CodexAuthStoreUnavailable

exception user_codex_auth.CodexAuthStoreUnavailable

Bases: RuntimeError

Codex enrollment state could not be read or changed safely.

class user_codex_auth.CodexCommand(action, target_user_id=None)

Bases: object

Parameters:
  • action (Literal['auto', 'login', 'status', 'list', 'cancel', 'logout', 'add', 'remove'])

  • target_user_id (str | None)

action: Literal['auto', 'login', 'status', 'list', 'cancel', 'logout', 'add', 'remove']
target_user_id: str | None
exception user_codex_auth.CodexCommandError

Bases: ValueError

A safe, user-facing !codex grammar error.

Remove exactly one canonical user’s non-secret enrollment record.

Return type:

None

Parameters:
async user_codex_auth.clear_user_codex_account(redis, subject)

Remove exactly one canonical user’s non-secret enrollment record.

Return type:

None

Parameters:
user_codex_auth.codex_account_redis_key(subject)

Return the per-canonical-subject enrollment key.

Return type:

str

Parameters:

subject (str)

Read one link, failing closed on unavailable or malformed state.

Return type:

CodexAccountLink | None

Parameters:
async user_codex_auth.get_user_codex_account(redis, subject)

Read one link, failing closed on unavailable or malformed state.

Return type:

CodexAccountLink | None

Parameters:
async user_codex_auth.handle_codex_command(processor, msg, platform)

Execute private enrollment and owner-controlled quota-sharing commands.

Return type:

bool

Parameters:
user_codex_auth.is_private_codex_channel(msg)

Require an authenticated native DM or exact user-owned webchat channel.

Return type:

bool

Parameters:

msg (Any)

user_codex_auth.parse_codex_command(text)

Parse the exact private enrollment and quota-sharing grammar.

Return type:

CodexCommand

Parameters:

text (str)

Persist exactly the approved non-secret link fields without a TTL.

Return type:

None

Parameters:
async user_codex_auth.set_user_codex_account(redis, subject, link)

Persist exactly the approved non-secret link fields without a TTL.

Return type:

None

Parameters: