zabgrab.adapters.secrets¶
API token storage in the operating system’s keyring.
Module Attributes
Tokens are stored one per keyring entry, named |
|
How many consecutive missing entries |
Classes
Stores tokens in the system keyring, keyed by server URL. |
- zabgrab.adapters.secrets.PREFIX = 'token'¶
Tokens are stored one per keyring entry, named
token1,token2, … with no gaps (keyring backends can’t be listed, so zabgrab reads entries in order until it finds a missing one). Each entry holds{"url": ..., "token": ...}as JSON.
- zabgrab.adapters.secrets.RESET_SCAN = 256¶
How many consecutive missing entries
KeyringSecrets.delete_all()checks past the last entry it finds, to catch anything left beyond a gap.
- class zabgrab.adapters.secrets.KeyringSecrets[source]¶
Bases:
objectStores tokens in the system keyring, keyed by server URL.
A missing or broken keyring backend is treated as “no tokens stored” when reading, and as an error when changing anything.
- set_token(url, token)[source]¶
Store a token for a server URL, replacing any stored before.
- Raises:
ZabgrabError – If the keyring can’t be written.
- Parameters:
- Return type:
None
- delete_token(url)[source]¶
Delete the token stored for a server URL.
- Returns:
bool – Whether a token was stored.
- Raises:
ZabgrabError – If the keyring can’t be changed.
- Parameters:
url (str)
- Return type:
- delete_all()[source]¶
Delete every zabgrab entry, including unreadable ones and any past a gap.
- Returns:
int – How many tokens were stored.
- Raises:
ZabgrabError – If the keyring can’t be changed.
- Return type: