credentials
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| StoreError pyt3client.credentials The credentials file cannot be read, or no environment matches. |
||
| T3Credentials pyt3client.models.auth What a successful sign-in yields; persist it to reconnect without pairing again. |
||
| T3NativeCredentials pyt3client.models.auth A sign-in for T3 Code's native surface: its WebSocket RPC and REST API. |
||
| _StoreFile pyt3client.credentials |
🛈 DocStrings¶
Saved sign-ins, one per environment alias (written by pyt3 login).
The file is $XDG_CONFIG_HOME/pyt3client/credentials.json (falling back to
~/.config/pyt3client/credentials.json), readable by the owner only. Next to the
MCP sign-ins (environments) it keeps native sign-ins (native, written by
pyt3 login-native) under the same aliases. It holds bearer tokens: anyone who
can read it can act on those environments at the approved access level until the
token expires (30 days) or is revoked in T3 Code under Settings -> Sharing & access.
StoreError
¶
Bases: Exception
The credentials file cannot be read, or no environment matches.
Source code in src/pyt3client/credentials.py
32 33 | |
config_dir
¶
config_dir() -> Path
$XDG_CONFIG_HOME/pyt3client, or ~/.config/pyt3client.
Source code in src/pyt3client/credentials.py
36 37 38 39 | |
default_alias
¶
default_alias(label: str, base_url: str) -> str
An alias from the environment's label, else its host: lower case, no spaces.
Source code in src/pyt3client/credentials.py
46 47 48 49 | |
load
¶
load() -> dict[str, T3Credentials]
All saved MCP sign-ins by alias; empty when nothing is saved yet.
Source code in src/pyt3client/credentials.py
70 71 72 73 74 75 76 77 78 79 80 | |
load_native
¶
load_native() -> dict[str, T3NativeCredentials]
All saved native sign-ins by alias.
Source code in src/pyt3client/credentials.py
83 84 85 86 87 88 89 90 91 92 93 | |
save
¶
save(environments: Mapping[str, T3Credentials]) -> Path
Replace the saved MCP sign-ins (native ones stay); the file has mode 0600.
Source code in src/pyt3client/credentials.py
109 110 111 112 113 114 | |
save_native
¶
save_native(native: Mapping[str, T3NativeCredentials]) -> Path
Replace the saved native sign-ins (MCP ones stay).
Source code in src/pyt3client/credentials.py
117 118 119 120 121 122 | |
select
¶
select(environments: Mapping[str, T3Credentials], alias: str | None) -> tuple[str, T3Credentials]
The environment named alias, or the only saved one when alias is None.
Raises:
| Type | Description |
|---|---|
StoreError
|
Nothing is saved, the alias is unknown, or several are saved and none was chosen. |
Source code in src/pyt3client/credentials.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |