Expand description
Auth storage — read/write ~/.rab/agent/auth.json.
Pi-compatible credential store with file locking and OAuth auto-refresh.
Format (pi-compatible):
{ "opencode-go": { "type": "api_key", "key": "sk-..." } }Structs§
- Auth
Storage - Auth storage loaded from ~/.rab/auth.json.
Enums§
- Auth
Credential - Credential for a provider (mirrors pi’s auth.json schema).
Functions§
- list_
logged_ in - List all providers that have credentials stored.
- login
- Login a provider by storing its API key in auth.json.
- login_
oauth - Login a provider by storing its OAuth credentials in auth.json.
- logout
- Logout a provider by removing its credential from auth.json.
If
providerisNone, clears all credentials. Returns true if something was actually removed. - modify_
credential - Atomically modify a single provider’s credential (pi-compatible
CredentialStore.modify()).freceives the current credential (None if missing), returns the new credential, or None to delete the entry. - read_
credential - Read a credential from auth.json. Returns None if the provider has no stored credential.
- refresh_
oauth_ token - Refresh an expired OAuth token using the registered OAuth provider.
Returns the new access token string, or None if refresh fails.
Matching pi’s
AuthStorage.refreshOAuthTokenWithLock()pattern.