Files
paskia/paskia/db/paths.py
T
LeoVasanko 84985501f5 MultiSite: one instance serves authentication across many domains (#4)
- Serve multiple domains (RP IDs) from one instance: host-based dispatch,
  per-domain credentials and sessions, domains managed at runtime in the
  admin UI — previously one RP per instance
- Cross-domain sign-in via Related Origin Requests: per-domain related-origins
  list with a served .well-known/webauthn document
- Explicit per-domain origin lists with shell-glob wildcards (**. for apex +
  any subdomain depth, *. for one level), editable in the admin UI with
  validation and self-lockout guards
- Per-domain auth hosts: the account/admin UI can live on a different host
  per domain, no longer confined to subdomains of a single RP
- CLI: 'paskia init <rp-id [rp-name]' initializes or adds a domain to an
  existing database; 'paskia migrate' converts legacy databases

BREAKING CHANGES (v2.0):
- Database schema: config is now per-domain and credentials/sessions carry
  an rp_id — existing databases must be converted with 'paskia migrate'
- Origins are now explicit: main implicitly allowed every subdomain of the
  RP; configure '**.' origins to reproduce that behavior
- CLI: the flat '--rp-id/--rp-name/--origin/--auth/--save' flags are
  replaced by the 'init' and 'migrate' subcommandsReviewed-on: #4
2026-09-07 22:14:42 +00:00

34 lines
1.0 KiB
Python

"""Filesystem paths for paskia persistence.
The combined database is a single kanta JSONL file at the fixed
CWD-relative path ``paskia.kantadb``. Auxiliary user files (avatars) live
under ``paskia.data/``. The deployment is selected by the current working
directory; there is deliberately no environment override.
"""
from pathlib import Path
DB_FILENAME = "paskia.kantadb"
DATA_DIRNAME = "paskia.data"
def db_file_path() -> Path:
"""Return the combined database file path."""
return Path(DB_FILENAME)
def data_root_path(create_root: bool = False) -> Path:
"""Return the root directory for auxiliary files (avatars etc.)."""
root = Path(DATA_DIRNAME)
if create_root:
root.mkdir(parents=True, exist_ok=True)
return root
def users_root_path(create_root: bool = False) -> Path:
"""Return the filesystem root for persisted user files."""
root = data_root_path(create_root=create_root) / "users"
if create_root:
root.mkdir(parents=True, exist_ok=True)
return root