animedex.auth.store

TokenStore Protocol.

The Protocol enumerates the only operations a backend module needs on a credential store: store, look up, delete, and enumerate. By keeping the surface this small we make every backend trivial to test (with InMemoryTokenStore) and trivial to retarget (e.g. an encrypted-file store for headless CI, a remote vault for hosted deployments).

TokenStore

class animedex.auth.store.TokenStore(*args, **kwargs)[source]

Bases: Protocol

The Protocol every token-store backend implements.

All methods are synchronous; the substrate is sync-first per plans/05 §5.

set(backend: str, token: str) None[source]

Store the credential for backend, overwriting any prior value.

Parameters:
  • backend (str) – Backend identifier (e.g. "anilist").

  • token (str) – Credential text.

Returns:

None.

Return type:

None

get(backend: str) str | None[source]

Return the credential for backend, or None if absent.

Parameters:

backend (str) – Backend identifier.

Returns:

Token text or None.

Return type:

str or None

delete(backend: str) None[source]

Remove the credential for backend if present.

Idempotent: deleting a missing entry is not an error.

Parameters:

backend (str) – Backend identifier.

Returns:

None.

Return type:

None

keys() Iterable[str][source]

Enumerate the backend identifiers that currently have a token.

Returns:

Iterable of backend identifiers.

Return type:

Iterable[str]