mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-19 14:54:33 +01:00
Compare commits
No commits in common. "main" and "focus-project-v0.9.1" have entirely different histories.
main
...
focus-proj
34
.github/workflows/app-errors-tests.yml
vendored
34
.github/workflows/app-errors-tests.yml
vendored
@ -1,34 +0,0 @@
|
|||||||
name: app_errors tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
# The workflow's own file counts as app_errors: editing only this file would
|
|
||||||
# otherwise trigger nothing, so a fix to the job itself could never prove
|
|
||||||
# itself.
|
|
||||||
paths: ['app_errors/**', '.github/workflows/app-errors-tests.yml']
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['app_errors/**', '.github/workflows/app-errors-tests.yml']
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: app_errors
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.x"
|
|
||||||
cache: pip
|
|
||||||
cache-dependency-path: app_errors/requirements.txt
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pip install -r requirements.txt && pip install --no-deps -e .
|
|
||||||
|
|
||||||
- name: Run tests with coverage
|
|
||||||
run: python -m pytest -v
|
|
||||||
71
.github/workflows/game-recording-precommit.yml
vendored
71
.github/workflows/game-recording-precommit.yml
vendored
@ -1,71 +0,0 @@
|
|||||||
name: game_recording pre-commit
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
# The workflow's own file counts as game_recording: editing only this file used
|
|
||||||
# to trigger nothing, so a fix to the job itself could never prove itself.
|
|
||||||
paths: ['game_recording/**', '.github/workflows/game-recording-precommit.yml']
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['game_recording/**', '.github/workflows/game-recording-precommit.yml']
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
pre-commit:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.x"
|
|
||||||
# Only pre-commit itself. Every linting hook runs in its own isolated
|
|
||||||
# env -- ruff, mypy, pylint, bandit and codespell each come from their
|
|
||||||
# own repo+rev, and the local hooks need nothing beyond bash and
|
|
||||||
# python3 -- so installing the full requirements.txt spent 9s a run on
|
|
||||||
# packages no pre-commit-stage hook imports. Verified by running this
|
|
||||||
# package's config green in a venv holding pre-commit and nothing else.
|
|
||||||
# The pin is read out of requirements.txt rather than repeated here, so
|
|
||||||
# it cannot drift from what the dependency-freshness gate governs.
|
|
||||||
- name: Install pre-commit
|
|
||||||
run: |
|
|
||||||
pip install "$(grep '^pre-commit==' game_recording/requirements.txt)"
|
|
||||||
|
|
||||||
# Keyed on THIS package's config. pre-commit/action@v3.0.1 caches on
|
|
||||||
# hashFiles('.pre-commit-config.yaml') -- the repo ROOT's -- so editing
|
|
||||||
# this package's config would not invalidate it, and other jobs in the
|
|
||||||
# repo that cache hooks under that key could overwrite it with a
|
|
||||||
# different hook set. A key from this config cannot go stale that way.
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cache/pre-commit
|
|
||||||
key: >-
|
|
||||||
pre-commit-game-recording-${{ env.pythonLocation }}-${{
|
|
||||||
hashFiles('game_recording/.pre-commit-config.yaml') }}
|
|
||||||
# Prefix fallback, or this fix would evaporate on the very
|
|
||||||
# event that motivated it: bumping a hook rev changes the
|
|
||||||
# exact key, and a total miss means reinstalling every hook
|
|
||||||
# again. pre-commit's store is keyed internally by hook
|
|
||||||
# repo+rev, so a superseded entry is ignored disk rather
|
|
||||||
# than a wrong hook, and cache still re-saves under the new
|
|
||||||
# exact key after a prefix-only hit.
|
|
||||||
restore-keys: pre-commit-game-recording-${{ env.pythonLocation }}-
|
|
||||||
# mypy re-analyses the stdlib and every third-party stub from scratch
|
|
||||||
# without this, which measured 10s of the hook step in CI against 0.25s
|
|
||||||
# warm locally -- a 19MB cache dir does the whole difference. Keyed on
|
|
||||||
# the config, not the sources: mypy's own cache metadata records the
|
|
||||||
# interpreter, the flag set and a hash per source file, so it re-checks
|
|
||||||
# what changed and cannot pass stale code. Deliberately NOT keyed on
|
|
||||||
# github.sha -- that re-saves 19MB every commit and would evict the
|
|
||||||
# 68MB hook caches under the repo's 10GB LRU budget. A fixed key keeps
|
|
||||||
# the expensive part, the dependency analysis, which is what costs 10s.
|
|
||||||
- uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: .mypy_cache
|
|
||||||
key: >-
|
|
||||||
mypy-game-recording-${{ env.pythonLocation }}-${{
|
|
||||||
hashFiles('game_recording/.pre-commit-config.yaml') }}
|
|
||||||
restore-keys: mypy-game-recording-${{ env.pythonLocation }}-
|
|
||||||
- name: Run the hooks
|
|
||||||
run: >-
|
|
||||||
pre-commit run --config game_recording/.pre-commit-config.yaml
|
|
||||||
--all-files --show-diff-on-failure
|
|
||||||
35
.github/workflows/game-recording-tests.yml
vendored
35
.github/workflows/game-recording-tests.yml
vendored
@ -1,35 +0,0 @@
|
|||||||
name: game_recording tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
# The workflow's own file counts as game_recording: editing only this file used
|
|
||||||
# to trigger nothing, so a fix to the job itself could never prove itself.
|
|
||||||
paths: ['game_recording/**', '.github/workflows/game-recording-tests.yml']
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['game_recording/**', '.github/workflows/game-recording-tests.yml']
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: game_recording
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: "3.x"
|
|
||||||
|
|
||||||
# The finalize and library tests run the real ffmpeg and ffprobe.
|
|
||||||
- name: Install ffmpeg
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y ffmpeg
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pip install -r requirements.txt
|
|
||||||
|
|
||||||
- name: Run tests with coverage
|
|
||||||
run: python -m pytest -v --cov=game_recording
|
|
||||||
12
.github/workflows/gatelock-tests.yml
vendored
12
.github/workflows/gatelock-tests.yml
vendored
@ -5,10 +5,10 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
# The workflow's own file counts as gatelock: editing only this file used
|
# The workflow's own file counts as gatelock: editing only this file used
|
||||||
# to trigger nothing, so a fix to the job itself could never prove itself.
|
# to trigger nothing, so a fix to the job itself could never prove itself.
|
||||||
paths: ['gatelock/**', 'earned_time/**', 'freedays/**', 'sickdays/**', '.github/workflows/gatelock-tests.yml']
|
paths: ['gatelock/**', '.github/workflows/gatelock-tests.yml']
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths: ['gatelock/**', 'earned_time/**', 'freedays/**', 'sickdays/**', '.github/workflows/gatelock-tests.yml']
|
paths: ['gatelock/**', '.github/workflows/gatelock-tests.yml']
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@ -26,14 +26,6 @@ jobs:
|
|||||||
cache: pip
|
cache: pip
|
||||||
cache-dependency-path: gatelock/requirements.txt
|
cache-dependency-path: gatelock/requirements.txt
|
||||||
|
|
||||||
# The evening chain (gatelock.evening_chain) reads earned_time, freedays
|
|
||||||
# and sickdays; they are siblings in this repo, so CI installs the
|
|
||||||
# checkout, not a tag.
|
|
||||||
- name: Install the sibling packages
|
|
||||||
run: >-
|
|
||||||
pip install ../crdt-sync ../earned_time
|
|
||||||
&& pip install --no-deps ../freedays ../sickdays
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pip install -r requirements.txt
|
run: pip install -r requirements.txt
|
||||||
|
|
||||||
|
|||||||
38
.github/workflows/godot-dev-tools-tests.yml
vendored
38
.github/workflows/godot-dev-tools-tests.yml
vendored
@ -1,38 +0,0 @@
|
|||||||
name: godot_dev_tools tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['godot_dev_tools/**', '.github/workflows/godot-dev-tools-tests.yml']
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['godot_dev_tools/**', '.github/workflows/godot-dev-tools-tests.yml']
|
|
||||||
|
|
||||||
env:
|
|
||||||
GODOT_VERSION: "4.7.2"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with: { python-version: "3.15.2" }
|
|
||||||
|
|
||||||
- name: Install Godot
|
|
||||||
run: |
|
|
||||||
curl -fsSL -o godot.zip "https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}-stable/Godot_v${GODOT_VERSION}-stable_linux.x86_64.zip"
|
|
||||||
unzip -q godot.zip
|
|
||||||
chmod +x "Godot_v${GODOT_VERSION}-stable_linux.x86_64"
|
|
||||||
sudo mv "Godot_v${GODOT_VERSION}-stable_linux.x86_64" /usr/local/bin/godot
|
|
||||||
rm godot.zip
|
|
||||||
|
|
||||||
- name: Install gdtoolkit (pinned)
|
|
||||||
run: pip install -r godot_dev_tools/requirements-dev.txt
|
|
||||||
|
|
||||||
- name: Lint (gdlint, gdformat)
|
|
||||||
run: godot_dev_tools/lint.sh
|
|
||||||
|
|
||||||
- name: GUT against the stub host (GUT is fetched at its pinned tag)
|
|
||||||
run: godot_dev_tools/test.sh
|
|
||||||
36
.github/workflows/rtdb-relay-dart-tests.yml
vendored
36
.github/workflows/rtdb-relay-dart-tests.yml
vendored
@ -1,36 +0,0 @@
|
|||||||
name: rtdb_relay dart tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['rtdb_relay/dart/**']
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
paths: ['rtdb_relay/dart/**']
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: rtdb_relay/dart
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up Flutter
|
|
||||||
uses: subosito/flutter-action@v2
|
|
||||||
with:
|
|
||||||
channel: stable
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: flutter pub get
|
|
||||||
|
|
||||||
- name: Analyze
|
|
||||||
run: flutter analyze
|
|
||||||
|
|
||||||
- name: Run tests with coverage
|
|
||||||
run: flutter test --coverage
|
|
||||||
|
|
||||||
- name: Enforce 100% line coverage
|
|
||||||
run: scripts/check_coverage.sh coverage/lcov.info 100
|
|
||||||
2
.github/workflows/ts-config-tests.yml
vendored
2
.github/workflows/ts-config-tests.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "26.13.1"
|
node-version: "24.22.1"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|||||||
2
.github/workflows/ts-core-tests.yml
vendored
2
.github/workflows/ts-core-tests.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "26.13.1"
|
node-version: "24.22.1"
|
||||||
|
|
||||||
# The preset is a `link:../ts_config` dependency. pnpm links the
|
# The preset is a `link:../ts_config` dependency. pnpm links the
|
||||||
# directory but installs nothing inside it, and a flat config imports
|
# directory but installs nothing inside it, and a flat config imports
|
||||||
|
|||||||
2
.github/workflows/web-ui-tests.yml
vendored
2
.github/workflows/web-ui-tests.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: "26.13.1"
|
node-version: "24.22.1"
|
||||||
|
|
||||||
# The preset is a `link:../ts_config` dependency. pnpm links the
|
# The preset is a `link:../ts_config` dependency. pnpm links the
|
||||||
# directory but installs nothing inside it, and a flat config imports
|
# directory but installs nothing inside it, and a flat config imports
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
# utils
|
# utils
|
||||||
|
|
||||||
Monorepo of shared gates and libraries (app_errors, dep_freshness, file_length, md_naming,
|
Monorepo of shared gates and libraries (dep_freshness, file_length, md_naming,
|
||||||
repo_contract, coverage_gaps, crdt-sync, gatelock, freedays, sickdays, earned_time, music_theory, game_recording,
|
repo_contract, coverage_gaps, crdt-sync, gatelock, freedays, sickdays, earned_time, music_theory,
|
||||||
flutter_web_drive (headless Flutter-web E2E driver + MCP), ...).
|
flutter_web_drive (headless Flutter-web E2E driver + MCP), ...).
|
||||||
`godot_dev_tools/` is a Godot addon (GDScript): `godot_dev_tools/test.sh` runs its GUT tests.
|
|
||||||
Python packages with a root-level `<pkg>/tests` run with `PYTHONPATH=.`;
|
Python packages with a root-level `<pkg>/tests` run with `PYTHONPATH=.`;
|
||||||
subprojects with their own `pyproject.toml` run via `scripts/run_subproject_tests.sh <dir>`.
|
subprojects with their own `pyproject.toml` run via `scripts/run_subproject_tests.sh <dir>`.
|
||||||
`scripts/check_repo_contract.sh` is the REAL shared gate (not a shim): never
|
`scripts/check_repo_contract.sh` is the REAL shared gate (not a shim): never
|
||||||
@ -17,4 +16,3 @@ overwrite it with `repo_contract/templates/check_repo_contract.shim.sh`.
|
|||||||
- lint: `ruff check agent_ready coverage_gaps flutter_web_drive repo_contract`
|
- lint: `ruff check agent_ready coverage_gaps flutter_web_drive repo_contract`
|
||||||
- coverage: `PYTHONPATH=. python -m pytest -q agent_ready/tests flutter_web_drive/tests repo_contract/tests unified-design-system/tests --cov=agent_ready --cov=flutter_web_drive --cov=repo_contract --cov=conformance --cov=conformance_diff --cov-branch --cov-report=xml --cov-fail-under=100`
|
- coverage: `PYTHONPATH=. python -m pytest -q agent_ready/tests flutter_web_drive/tests repo_contract/tests unified-design-system/tests --cov=agent_ready --cov=flutter_web_drive --cov=repo_contract --cov=conformance --cov=conformance_diff --cov-branch --cov-report=xml --cov-fail-under=100`
|
||||||
- coverage-gaps: `coverage-gaps coverage.xml`
|
- coverage-gaps: `coverage-gaps coverage.xml`
|
||||||
- deploy: `git -C ~/src/utils pull --ff-only && ~/src/utils/scripts/deploy.sh` (installs the sickdays CLI + launcher from the live checkout, then exits 1 unless every released library's version tag is on origin and matches HEAD and the live `sickdays` runs the text-free checkout; `--verify-only` for the health check alone)
|
|
||||||
|
|||||||
@ -1,61 +0,0 @@
|
|||||||
# App errors and slow waits become board tickets
|
|
||||||
|
|
||||||
kuhy's rule (2026-11-17): every error, and every wait the user sees over 1 s, in
|
|
||||||
any of his apps is reported automatically. The board then turns each one into a
|
|
||||||
ticket that fixes itself. This doc covers the apps' half and the PC ingest. The
|
|
||||||
board's half is todoImplementer `DOCS-errors.md`, with the contract in
|
|
||||||
`contracts/app-error.schema.json`. The design is kartka's pipeline
|
|
||||||
(`~/src/kartka`, `docs/DOCS-error-reports.md`), made shared.
|
|
||||||
|
|
||||||
## Pipeline
|
|
||||||
|
|
||||||
1. **Apps report.** Each report is one *entry* (see `app_errors/README.md`):
|
|
||||||
- Flutter, `crdt_sync_flutter` 0.9.0: `installAppErrors` hooks
|
|
||||||
`FlutterError.onError` and `PlatformDispatcher.onError`. `WaitWatch` turns
|
|
||||||
a spinner shown over 1 s into `perf.slow`. The device deduplicates (30 s,
|
|
||||||
20 a minute) and redacts each report, and queues it in
|
|
||||||
`SharedPreferences`. It uploads to RTDB `/<app>/errors/<device>/<id>` with
|
|
||||||
the build (versionCode).
|
|
||||||
- Python/Tk, `gatelock` 0.15.0: `gatelock.error_report.install` hooks
|
|
||||||
`sys.excepthook`, `threading.excepthook` and Tk callback errors.
|
|
||||||
`watch_stalls(root, rep)` reports a frozen Tk loop over 1 s.
|
|
||||||
`rep.wait(...)` and `rep.begin(...)` time a wait.
|
|
||||||
- Godot, `godot_dev_tools` 0.2.0, `addons/app_errors`: an `OS.add_logger`
|
|
||||||
logger catches script errors and `push_error`. A frame over 1 s, or
|
|
||||||
`report_wait` over 1 s, becomes `perf.slow`. Headless runs and
|
|
||||||
`APP_ERRORS_OFF=1` write nothing, so a game's own test gates file no
|
|
||||||
tickets.
|
|
||||||
- PC apps (Tk and Godot) append to the local spool
|
|
||||||
`~/.local/state/app-errors-spool/<app>.jsonl`. They need no RTDB, because
|
|
||||||
the ingest runs on the same PC.
|
|
||||||
2. **The PC ingests.** `app-errors-ingest.timer` runs `app-errors ingest` every
|
|
||||||
5 min. It reads RTDB through an already seeded crdt-sync session
|
|
||||||
(`firebase_backup`) and reads the spool. It merges reports by signature
|
|
||||||
(Dart signatures are kartka-identical), deletes what it read, and writes
|
|
||||||
`~/.local/state/app-errors/<app>.json` as a contract `report`.
|
|
||||||
3. **The board files tickets.** It scans that folder every 60 s and makes one
|
|
||||||
ticket per `app:signature` (todoImplementer `DOCS-errors.md`).
|
|
||||||
|
|
||||||
`app-errors resolve <app> <signature>` sets `open: false`. A later report opens
|
|
||||||
the error again only when it is a regression: a newer build when both sides
|
|
||||||
know the build, else a report made after the resolve. The board never calls
|
|
||||||
`resolve` on its own, because folder sources have no resolve hook. It tracks
|
|
||||||
shipped fixes by `fixed_build`.
|
|
||||||
|
|
||||||
## Choices made (no questions asked, per the brief)
|
|
||||||
|
|
||||||
- kartka moved over on 2026-11-17: the shared ingest reads `/kartka` too
|
|
||||||
(it parses kartka's older entry shape: `sourceId`, per-entry `build`),
|
|
||||||
the board's `error_sources` is `[]` and `kartka-errors.timer` is retired.
|
|
||||||
Ticket ids stayed the same: all 134 stored kartka signatures recompute
|
|
||||||
identically.
|
|
||||||
- Tk and Godot use the local spool instead of RTDB: they only run on the PC.
|
|
||||||
- The Godot reporter is its own addon folder, mounted in every build. It is
|
|
||||||
not part of `dev_tools`, which only loads for `--dev` runs.
|
|
||||||
- Reporting is silent: no text, dialog or notification in any app.
|
|
||||||
|
|
||||||
## Install and check
|
|
||||||
|
|
||||||
`scripts/deploy.sh` runs `app_errors/install.sh`. That installs the venv and
|
|
||||||
`~/.local/bin/app-errors`, enables the timer, and checks that the timer is
|
|
||||||
active and the venv imports the live checkout.
|
|
||||||
31
README.md
31
README.md
@ -77,13 +77,6 @@ watcher + pacman hooks). Not a package — installed by running
|
|||||||
Consumed by `steam-backlog-enforcer` (expects a `guard-lib/install.sh`
|
Consumed by `steam-backlog-enforcer` (expects a `guard-lib/install.sh`
|
||||||
sibling clone) and referenced by `screen-locker`.
|
sibling clone) and referenced by `screen-locker`.
|
||||||
|
|
||||||
## app_errors/
|
|
||||||
|
|
||||||
The PC ingest of the shared app error and slow-wait reporting: RTDB and local
|
|
||||||
spool reports in, todoImplementer board tickets out, on a systemd `--user`
|
|
||||||
timer. The reporters live in `crdt_sync_flutter`, `gatelock` and
|
|
||||||
`godot_dev_tools/addons/app_errors`. See [`DOCS-app-errors.md`](DOCS-app-errors.md).
|
|
||||||
|
|
||||||
## gatelock/
|
## gatelock/
|
||||||
|
|
||||||
Python lock-window + HMAC log-integrity backend (package: `gatelock`, not
|
Python lock-window + HMAC log-integrity backend (package: `gatelock`, not
|
||||||
@ -108,17 +101,6 @@ Consume via:
|
|||||||
music_theory @ git+https://github.com/kuhyx/utils@music-theory-v0.1.0#subdirectory=music_theory
|
music_theory @ git+https://github.com/kuhyx/utils@music-theory-v0.1.0#subdirectory=music_theory
|
||||||
```
|
```
|
||||||
|
|
||||||
## game_recording/
|
|
||||||
|
|
||||||
Session recorder for a game (package: `game_recording`, stdlib only, not
|
|
||||||
published to PyPI): records a dev run from outside the game and stamps its
|
|
||||||
telemetry moments onto the video. A game configures it with one `Config`.
|
|
||||||
|
|
||||||
Consume via:
|
|
||||||
```
|
|
||||||
game_recording @ git+https://github.com/kuhyx/utils@game-recording-v0.1.0#subdirectory=game_recording
|
|
||||||
```
|
|
||||||
|
|
||||||
## unified-design-system/
|
## unified-design-system/
|
||||||
|
|
||||||
Not a package — the frozen design tokens (colors, spacing, type, radius,
|
Not a package — the frozen design tokens (colors, spacing, type, radius,
|
||||||
@ -146,16 +128,3 @@ planted violation per rule family proves each gate bites.
|
|||||||
"@kuhyx/ts-config": "github:kuhyx/utils#ts_config-v0.1.0&path:/ts_config"
|
"@kuhyx/ts-config": "github:kuhyx/utils#ts_config-v0.1.0&path:/ts_config"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## godot_dev_tools/
|
|
||||||
|
|
||||||
Godot addon (`addons/dev_tools/`): the F12 dev feedback mode of kuhy's games
|
|
||||||
(annotate the frozen frame, save a bundle that `feedback_inbox` turns into a
|
|
||||||
task). A game mounts it at a pinned tag; the game's own code stays a small host
|
|
||||||
object. Read [`godot_dev_tools/README.md`](godot_dev_tools/README.md).
|
|
||||||
|
|
||||||
Consume via a shallow fetch of the tag, then mount the addon folder:
|
|
||||||
```
|
|
||||||
git clone --depth 1 --branch godot-dev-tools-v0.1.1 https://github.com/kuhyx/utils
|
|
||||||
# link or copy godot_dev_tools/addons/dev_tools to res://addons/dev_tools
|
|
||||||
```
|
|
||||||
|
|||||||
@ -1,52 +0,0 @@
|
|||||||
# app_errors
|
|
||||||
|
|
||||||
The PC side of kuhy's app error and slow-wait reporting. Every app reports
|
|
||||||
errors, and every wait the user sees over 1 s (`perf.slow`). This ingest merges
|
|
||||||
the reports by signature and writes `~/.local/state/app-errors/<app>.json` in
|
|
||||||
the todoImplementer `contracts/app-error.schema.json` `report` shape. The board
|
|
||||||
reads that folder and turns each open error into a self-fixing ticket
|
|
||||||
(todoImplementer `DOCS-errors.md`).
|
|
||||||
|
|
||||||
Generalised from kartka's `tools/errors`. Dart signatures are byte-identical to
|
|
||||||
kartka's. See `DOCS-app-errors.md` at the repo root for the whole pipeline.
|
|
||||||
|
|
||||||
## Where reports come from
|
|
||||||
|
|
||||||
| Reporter | Runs on | Writes |
|
|
||||||
|---|---|---|
|
|
||||||
| `crdt_sync_flutter` `installErrorReporting` | phone, desktop, web | RTDB `/<app>/errors/<device>/<id>` |
|
|
||||||
| `gatelock.error_report.install` | PC (Tk) | spool `~/.local/state/app-errors-spool/<app>.jsonl` |
|
|
||||||
| Godot `addons/app_errors` (`godot_dev_tools/`) | PC | the same spool |
|
|
||||||
|
|
||||||
The ingest skips `kartka` in RTDB, because kartka still runs its own ingest.
|
|
||||||
|
|
||||||
## Entry (one report, every language)
|
|
||||||
|
|
||||||
`at` (ISO UTC), `kind` (`uncaught.flutter`, `uncaught.python`, `uncaught.gdscript`,
|
|
||||||
`ui.snackbar`, `perf.slow`, ...), `error`, `stack` (list of frames), plus these
|
|
||||||
optional fields:
|
|
||||||
|
|
||||||
- `repo` (`owner/name`, default `kuhyx/<app>`)
|
|
||||||
- `mark` (the substring that marks the app's own frames: `package:todo/`,
|
|
||||||
`leetcode_guard/`, `res://`)
|
|
||||||
- `route`
|
|
||||||
- `operation`, `durationMs`, `waitId` and `still` (slow waits)
|
|
||||||
- `build` (versionCode, 0 when unknown) and `version`
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
app-errors ingest # what the timer runs every 5 min
|
|
||||||
app-errors ingest --keep # leave RTDB entries in place
|
|
||||||
app-errors ingest --no-rtdb # local spool only
|
|
||||||
app-errors resolve <app> <signature> # mark it fixed; a newer build reopens it
|
|
||||||
```
|
|
||||||
|
|
||||||
`app_errors/install.sh` installs the venv
|
|
||||||
(`~/.local/share/app-errors/venv`), the `app-errors` link and
|
|
||||||
`app-errors-ingest.timer`. `scripts/deploy.sh` runs it.
|
|
||||||
|
|
||||||
RTDB access reuses an already seeded crdt-sync session (`--session`, default
|
|
||||||
`firebase_backup`), so the ingest needs no sign-in of its own.
|
|
||||||
|
|
||||||
Tests: `cd app_errors && python -m pytest` (100 % branch coverage).
|
|
||||||
@ -1,2 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Shared app error and slow-wait ingest: RTDB and spool reports in, board tickets out."""
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""``app-errors``: ``ingest`` (what the timer runs) and ``resolve <app> <signature>``."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import datetime as dt
|
|
||||||
import sys
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from app_errors import ingest, store
|
|
||||||
from app_errors.rtdb import DEFAULT_SESSION, RtdbError, open_rtdb
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Sequence
|
|
||||||
|
|
||||||
|
|
||||||
def _parser() -> argparse.ArgumentParser:
|
|
||||||
parser = argparse.ArgumentParser(prog="app-errors", description=__doc__)
|
|
||||||
sub = parser.add_subparsers(dest="command", required=True)
|
|
||||||
run = sub.add_parser("ingest", help="read RTDB and the spool, write the board reports")
|
|
||||||
run.add_argument("--keep", action="store_true", help="leave RTDB entries in place")
|
|
||||||
run.add_argument("--no-rtdb", action="store_true", help="read the local spool only")
|
|
||||||
run.add_argument("--session", default=DEFAULT_SESSION, help="seeded crdt-sync credential store")
|
|
||||||
res = sub.add_parser("resolve", help="mark an error fixed (a newer build reopens it)")
|
|
||||||
res.add_argument("app")
|
|
||||||
res.add_argument("signature")
|
|
||||||
return parser
|
|
||||||
|
|
||||||
|
|
||||||
def _ingest(args: argparse.Namespace) -> int:
|
|
||||||
db, error = None, None
|
|
||||||
if not args.no_rtdb:
|
|
||||||
try:
|
|
||||||
db = open_rtdb(args.session)
|
|
||||||
except RtdbError as e:
|
|
||||||
error = str(e)
|
|
||||||
summary = ingest.run(ingest.default_paths(), db, keep=args.keep)
|
|
||||||
error = error or summary.rtdb_error
|
|
||||||
print(f"app-errors: {summary.merged} new") # noqa: T201 -- terminal-only CLI
|
|
||||||
if error:
|
|
||||||
print(f"app-errors: RTDB: {error}", file=sys.stderr) # noqa: T201
|
|
||||||
return 1
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def _resolve(args: argparse.Namespace) -> int:
|
|
||||||
paths = ingest.default_paths()
|
|
||||||
state = store.load(paths.state)
|
|
||||||
now = dt.datetime.now(dt.UTC).strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
|
||||||
if not store.resolve(state, args.app, args.signature, now=now):
|
|
||||||
print(f"app-errors: unknown error {args.app} {args.signature}", file=sys.stderr) # noqa: T201
|
|
||||||
return 1
|
|
||||||
store.save(paths.state, state)
|
|
||||||
store.write_reports(paths.reports, state)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv: Sequence[str] | None = None) -> int:
|
|
||||||
"""Run the CLI; return the exit code."""
|
|
||||||
args = _parser().parse_args(argv)
|
|
||||||
return _ingest(args) if args.command == "ingest" else _resolve(args)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,96 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""One ingest pass: RTDB and the local spool in, the board's reports out.
|
|
||||||
|
|
||||||
In: RTDB ``/<app>/errors/<device>/<id>`` and the spool. Out:
|
|
||||||
``<state>/app-errors/<app>.json``, the board's contract report.
|
|
||||||
|
|
||||||
RTDB entries are deleted once the state holding them is saved (``keep``
|
|
||||||
leaves them; ``seen`` stops a second count). kartka is skipped: it still runs
|
|
||||||
its own ingest (``~/src/kartka/tools/errors``), which the board reads through
|
|
||||||
its ``kartka`` adapter, and two readers of ``/kartka/errors`` would race.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from app_errors import spool, store
|
|
||||||
from app_errors.rtdb import RtdbError
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from app_errors.rtdb import Rtdb
|
|
||||||
|
|
||||||
#: Apps with their own ingest, never read here (kartka moved over 2026-11-17).
|
|
||||||
SKIP_APPS: frozenset[str] = frozenset()
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Paths:
|
|
||||||
"""Where the ingest keeps its state, writes reports and reads the spool."""
|
|
||||||
|
|
||||||
state: Path
|
|
||||||
reports: Path
|
|
||||||
spool: Path
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Summary:
|
|
||||||
"""What one pass did."""
|
|
||||||
|
|
||||||
merged: int
|
|
||||||
rtdb_error: str | None
|
|
||||||
|
|
||||||
|
|
||||||
def default_paths() -> Paths:
|
|
||||||
"""Return the paths under ``$XDG_STATE_HOME`` (default ``~/.local/state``)."""
|
|
||||||
base = Path(os.environ.get("XDG_STATE_HOME") or Path.home() / ".local" / "state")
|
|
||||||
return Paths(
|
|
||||||
base / "app-errors-ingest" / "state.json",
|
|
||||||
base / "app-errors",
|
|
||||||
base / "app-errors-spool",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _rtdb_entries(
|
|
||||||
db: Rtdb,
|
|
||||||
) -> tuple[list[tuple[str, str, object]], dict[str, dict[str, object]]]:
|
|
||||||
"""Return (app, device/id, entry) for every RTDB report, and the deletes that consume them."""
|
|
||||||
found: list[tuple[str, str, object]] = []
|
|
||||||
deletes: dict[str, dict[str, object]] = {}
|
|
||||||
top = db.get("", shallow=True)
|
|
||||||
for app in sorted(top) if isinstance(top, dict) else []:
|
|
||||||
if app in SKIP_APPS or not store.APP_NAME.match(app):
|
|
||||||
continue
|
|
||||||
devices = db.get(f"{app}/errors")
|
|
||||||
for device, entries in devices.items() if isinstance(devices, dict) else []:
|
|
||||||
for entry_id, entry in entries.items() if isinstance(entries, dict) else []:
|
|
||||||
found.append((app, f"{device}/{entry_id}", entry))
|
|
||||||
deletes.setdefault(app, {})[f"{device}/{entry_id}"] = None
|
|
||||||
return found, deletes
|
|
||||||
|
|
||||||
|
|
||||||
def run(paths: Paths, db: Rtdb | None, *, keep: bool = False) -> Summary:
|
|
||||||
"""Ingest everything once; RTDB failures are returned, the spool still goes in."""
|
|
||||||
state = store.load(paths.state)
|
|
||||||
merged = 0
|
|
||||||
rtdb_error = None
|
|
||||||
deletes: dict[str, dict[str, object]] = {}
|
|
||||||
if db is not None:
|
|
||||||
try:
|
|
||||||
found, deletes = _rtdb_entries(db)
|
|
||||||
except RtdbError as e:
|
|
||||||
found, rtdb_error = [], str(e)
|
|
||||||
merged += sum(store.merge(state, app, key, entry) for app, key, entry in found)
|
|
||||||
merged += sum(store.merge(state, line.app, line.id, line.entry) for line in spool.drain(paths.spool))
|
|
||||||
store.save(paths.state, state)
|
|
||||||
store.write_reports(paths.reports, state)
|
|
||||||
if db is not None and not keep:
|
|
||||||
try:
|
|
||||||
for app, paths_gone in deletes.items():
|
|
||||||
db.patch(f"{app}/errors", paths_gone)
|
|
||||||
except RtdbError as e:
|
|
||||||
rtdb_error = str(e)
|
|
||||||
return Summary(merged, rtdb_error)
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""A minimal RTDB REST client on a seeded crdt-sync Google session.
|
|
||||||
|
|
||||||
Ported from kartka's ``tools/errors`` (``kartka_errors.rtdb``), plus
|
|
||||||
``shallow`` reads to list the apps. The sync account is Google-only, so the
|
|
||||||
session is an already seeded ``~/.config/<store>/firebase_auth.json`` (crdt-
|
|
||||||
sync's ``tool.seed_session`` writes one; it refreshes itself). The request URL
|
|
||||||
carries the ID token (``?auth=``), so no error raised here ever includes it.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from collections.abc import Callable
|
|
||||||
import json
|
|
||||||
from typing import Protocol
|
|
||||||
import urllib.error
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
#: The credential store read by default: the backup timer's, a PC-side reader
|
|
||||||
#: of the same database (any seeded store of the sync account works).
|
|
||||||
DEFAULT_SESSION = "firebase_backup"
|
|
||||||
#: Per-request timeout, seconds (token refresh has its own, below).
|
|
||||||
TIMEOUT = 15.0
|
|
||||||
TOKEN_TIMEOUT = 8.0
|
|
||||||
|
|
||||||
type Opener = Callable[..., object]
|
|
||||||
|
|
||||||
|
|
||||||
class RtdbError(RuntimeError):
|
|
||||||
"""An RTDB request failed, or there is no session (the message never names the URL)."""
|
|
||||||
|
|
||||||
|
|
||||||
class Rtdb(Protocol):
|
|
||||||
"""Read and multi-path write access to RTDB."""
|
|
||||||
|
|
||||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
|
||||||
"""Return the decoded JSON at ``path`` (None when absent)."""
|
|
||||||
...
|
|
||||||
|
|
||||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
|
||||||
"""Apply a multi-path update of ``path`` (a None value deletes)."""
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
class RestRtdb:
|
|
||||||
"""RTDB over REST with ``?auth=<id token>``."""
|
|
||||||
|
|
||||||
def __init__(
|
|
||||||
self,
|
|
||||||
database_url: str,
|
|
||||||
id_token: Callable[[], str],
|
|
||||||
opener: Opener = urllib.request.urlopen,
|
|
||||||
) -> None:
|
|
||||||
"""Talk to ``database_url`` with tokens from ``id_token``."""
|
|
||||||
self._url = database_url.rstrip("/")
|
|
||||||
self._id_token = id_token
|
|
||||||
self._open = opener
|
|
||||||
|
|
||||||
def _send(self, method: str, path: str, body: bytes | None, query: str = "") -> object:
|
|
||||||
try:
|
|
||||||
token = self._id_token()
|
|
||||||
except Exception as e: # noqa: BLE001 -- any refresh failure, typed only
|
|
||||||
msg = f"RTDB {method} {path}: token refresh failed ({type(e).__name__})"
|
|
||||||
raise RtdbError(msg) from None
|
|
||||||
req = urllib.request.Request( # noqa: S310 -- https only, built here
|
|
||||||
f"{self._url}/{path}.json?auth={token}{query}",
|
|
||||||
data=body,
|
|
||||||
method=method,
|
|
||||||
headers={"Content-Type": "application/json"},
|
|
||||||
)
|
|
||||||
try:
|
|
||||||
with self._open(req, timeout=TIMEOUT) as res: # type: ignore[attr-defined]
|
|
||||||
return json.loads(res.read() or b"null")
|
|
||||||
except urllib.error.HTTPError as e:
|
|
||||||
msg = f"RTDB {method} {path}: HTTP {e.code}"
|
|
||||||
raise RtdbError(msg) from None
|
|
||||||
except (urllib.error.URLError, OSError, ValueError) as e:
|
|
||||||
msg = f"RTDB {method} {path}: {type(e).__name__}"
|
|
||||||
raise RtdbError(msg) from None
|
|
||||||
|
|
||||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
|
||||||
"""GET ``path``; raises :class:`RtdbError` on any failure."""
|
|
||||||
return self._send("GET", path, None, "&shallow=true" if shallow else "")
|
|
||||||
|
|
||||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
|
||||||
"""PATCH ``data`` into ``path``; raises :class:`RtdbError`."""
|
|
||||||
self._send("PATCH", path, json.dumps(data).encode())
|
|
||||||
|
|
||||||
|
|
||||||
def open_rtdb(session: str = DEFAULT_SESSION) -> RestRtdb:
|
|
||||||
"""Return the client on the seeded ``session``; :class:`RtdbError` without one."""
|
|
||||||
import crdt_sync # noqa: PLC0415 -- only the RTDB path needs it; spool-only runs stay stdlib
|
|
||||||
|
|
||||||
try:
|
|
||||||
config = crdt_sync.FirebaseConfig.load()
|
|
||||||
except Exception as e: # noqa: BLE001 -- a missing or broken config, typed only
|
|
||||||
msg = f"no Firebase config ({type(e).__name__})"
|
|
||||||
raise RtdbError(msg) from None
|
|
||||||
store = crdt_sync.credential_store_for(session)
|
|
||||||
auth = crdt_sync.FirebaseTokenProvider(config.api_key, store, timeout_seconds=TOKEN_TIMEOUT)
|
|
||||||
if not auth.has_session():
|
|
||||||
msg = f"no seeded sign-in session '{session}'; seed one with crdt-sync's tool.seed_session --app {session}"
|
|
||||||
raise RtdbError(msg)
|
|
||||||
return RestRtdb(config.database_url, auth.id_token)
|
|
||||||
@ -1,128 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Group error reports: one signature per bug, however often it fires.
|
|
||||||
|
|
||||||
Ported from kartka's ``tools/errors`` (``kartka_errors.signature``) and kept
|
|
||||||
byte-identical for Dart entries, so kartka's existing tickets keep their ids
|
|
||||||
when it moves onto this ingest. Generalised in one place only: which stack
|
|
||||||
frames belong to the app. An entry's ``mark`` names them (``package:todo/``
|
|
||||||
for Dart, ``leetcode_guard/`` for Python, ``res://`` for GDScript); without
|
|
||||||
one it is ``package:<app>/``.
|
|
||||||
|
|
||||||
A signature is the error type, the message with its volatile parts (numbers,
|
|
||||||
ids, URLs) masked, and where it happened: the first app frame without line
|
|
||||||
numbers (so an edit elsewhere in the file does not split it), else the route,
|
|
||||||
else the entry kind. A slow wait is its route + operation, never its time.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import hashlib
|
|
||||||
import re
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Mapping, Sequence
|
|
||||||
|
|
||||||
#: The longest normalised message kept in a signature.
|
|
||||||
MAX_MESSAGE = 160
|
|
||||||
#: The entry kind of a user-visible wait over a second.
|
|
||||||
SLOW_KIND = "perf.slow"
|
|
||||||
|
|
||||||
_TYPE = re.compile(r"^(?:Unhandled error: )?([A-Z][\w$]*(?:Exception|Error))\b")
|
|
||||||
#: Dart errors whose ``toString`` does not name their type.
|
|
||||||
_DART_PREFIXES = {
|
|
||||||
"Bad state": "StateError",
|
|
||||||
"Invalid argument": "ArgumentError",
|
|
||||||
"Unsupported operation": "UnsupportedError",
|
|
||||||
"Null check operator": "TypeError",
|
|
||||||
"Concurrent modification": "ConcurrentModificationError",
|
|
||||||
}
|
|
||||||
_URL = re.compile(r"(https?://\S+|<url>)")
|
|
||||||
_UUID = re.compile(r"\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b", re.IGNORECASE)
|
|
||||||
_HEX = re.compile(r"\b(?=[0-9a-f]*\d)[0-9a-f]{8,}\b", re.IGNORECASE)
|
|
||||||
_NUMBER = re.compile(r"\b\d+(\.\d+)?\b")
|
|
||||||
_SPACE = re.compile(r"\s+")
|
|
||||||
_FRAME = re.compile(r"^#\d+\s+")
|
|
||||||
_LINE_COL = re.compile(r"(\.(?:dart|py|gd))(:\d+)+")
|
|
||||||
#: Frames of the reporting plumbing itself, never the bug's location.
|
|
||||||
_PLUMBING = (
|
|
||||||
"package:kartka/app/error_hooks.dart",
|
|
||||||
"package:kartka/core/diagnostics/",
|
|
||||||
"package:crdt_sync_flutter/src/errors/",
|
|
||||||
"gatelock/error_report.py",
|
|
||||||
"res://addons/app_errors/",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Signature:
|
|
||||||
"""What groups reports of one bug."""
|
|
||||||
|
|
||||||
id: str
|
|
||||||
type: str
|
|
||||||
message: str
|
|
||||||
where: str
|
|
||||||
|
|
||||||
|
|
||||||
def error_type(error: str, kind: str) -> str:
|
|
||||||
"""Return the exception type named by ``error``, else ``kind``."""
|
|
||||||
if match := _TYPE.match(error):
|
|
||||||
return match[1]
|
|
||||||
for prefix, name in _DART_PREFIXES.items():
|
|
||||||
if error.startswith(prefix):
|
|
||||||
return name
|
|
||||||
return kind
|
|
||||||
|
|
||||||
|
|
||||||
def normalise(message: str) -> str:
|
|
||||||
"""Return ``message`` with URLs, uuids, long hex and numbers masked, trimmed."""
|
|
||||||
text = _URL.sub("<url>", message)
|
|
||||||
text = _UUID.sub("<uuid>", text)
|
|
||||||
text = _HEX.sub("<hex>", text)
|
|
||||||
text = _NUMBER.sub("<n>", text)
|
|
||||||
return _SPACE.sub(" ", text).strip()[:MAX_MESSAGE]
|
|
||||||
|
|
||||||
|
|
||||||
def top_frame(stack: Sequence[str], mark: str) -> str | None:
|
|
||||||
"""Return the first frame containing ``mark`` outside the reporting plumbing."""
|
|
||||||
for frame in stack:
|
|
||||||
if mark in frame and not any(p in frame for p in _PLUMBING):
|
|
||||||
return _LINE_COL.sub(r"\1", _FRAME.sub("", frame.strip()))
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def mark_of(entry: Mapping[str, object], app: str) -> str:
|
|
||||||
"""Return the substring that marks the app's own frames in ``entry``."""
|
|
||||||
mark = entry.get("mark")
|
|
||||||
return mark if isinstance(mark, str) and mark else f"package:{app}/"
|
|
||||||
|
|
||||||
|
|
||||||
def strings(value: object) -> list[str]:
|
|
||||||
"""Return ``value`` as a list of strings; empty when it is not a list."""
|
|
||||||
return [str(v) for v in value] if isinstance(value, list) else []
|
|
||||||
|
|
||||||
|
|
||||||
def _digest(text: str) -> str:
|
|
||||||
return hashlib.sha1(text.encode()).hexdigest()[:10] # noqa: S324 -- a grouping key, not security
|
|
||||||
|
|
||||||
|
|
||||||
def signature(entry: Mapping[str, object], *, app: str) -> Signature:
|
|
||||||
"""Return the signature of one report of ``app``."""
|
|
||||||
kind = str(entry.get("kind", "?"))
|
|
||||||
if kind == SLOW_KIND:
|
|
||||||
operation = str(entry.get("operation") or "?")
|
|
||||||
where = f"route {entry.get('route') or '?'}"
|
|
||||||
return Signature(
|
|
||||||
_digest(f"{SLOW_KIND}|{where}|{operation}"),
|
|
||||||
SLOW_KIND,
|
|
||||||
f"slow wait: {operation}",
|
|
||||||
where,
|
|
||||||
)
|
|
||||||
error = str(entry.get("error", ""))
|
|
||||||
frame = top_frame(strings(entry.get("stack")), mark_of(entry, app))
|
|
||||||
route = entry.get("route")
|
|
||||||
where = frame or (f"route {route}" if route else f"kind {kind}")
|
|
||||||
kind_type = error_type(error, kind)
|
|
||||||
message = normalise(error)
|
|
||||||
return Signature(_digest(f"{kind_type}|{message}|{where}"), kind_type, message, where)
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""The local spool: how PC apps (Tk gate windows, Godot games) report.
|
|
||||||
|
|
||||||
They run on the PC the ingest runs on, so they need no RTDB: each report is
|
|
||||||
one JSON line appended to ``<spool>/<app>.jsonl`` (the writers are
|
|
||||||
``gatelock.error_report`` and the Godot ``app_errors`` addon; this module is
|
|
||||||
the reference writer and the reader). The ingest claims a file by renaming it
|
|
||||||
to ``.jsonl.ingesting`` before reading, so a line appended meanwhile lands in
|
|
||||||
a fresh file and is never lost. The spool sits beside, not inside, the
|
|
||||||
board's ``app-errors/`` folder, which reads every ``*.json`` there.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from app_errors.store import APP_NAME
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Iterator, Mapping
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
SUFFIX = ".jsonl"
|
|
||||||
CLAIMED = ".jsonl.ingesting"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Line:
|
|
||||||
"""One spooled report: its app, a stable id and the decoded entry."""
|
|
||||||
|
|
||||||
app: str
|
|
||||||
id: str
|
|
||||||
entry: object
|
|
||||||
|
|
||||||
|
|
||||||
def append(folder: Path, app: str, entry: Mapping[str, object]) -> None:
|
|
||||||
"""Append ``entry`` as one line to ``app``'s spool file."""
|
|
||||||
folder.mkdir(parents=True, exist_ok=True)
|
|
||||||
with (folder / f"{app}{SUFFIX}").open("a", encoding="utf-8") as f:
|
|
||||||
f.write(json.dumps(entry, sort_keys=True) + "\n")
|
|
||||||
|
|
||||||
|
|
||||||
def _claim(folder: Path) -> list[Path]:
|
|
||||||
for path in folder.glob(f"*{SUFFIX}"):
|
|
||||||
path.replace(path.with_name(path.name.removesuffix(SUFFIX) + CLAIMED))
|
|
||||||
return sorted(folder.glob(f"*{CLAIMED}"))
|
|
||||||
|
|
||||||
|
|
||||||
def drain(folder: Path) -> Iterator[Line]:
|
|
||||||
"""Yield every spooled line, then delete the files it came from."""
|
|
||||||
if not folder.is_dir():
|
|
||||||
return
|
|
||||||
for path in _claim(folder):
|
|
||||||
app = path.name.removesuffix(CLAIMED)
|
|
||||||
if APP_NAME.match(app):
|
|
||||||
for text in path.read_text(encoding="utf-8").splitlines():
|
|
||||||
try:
|
|
||||||
entry = json.loads(text)
|
|
||||||
except ValueError:
|
|
||||||
continue
|
|
||||||
digest = hashlib.sha1(text.encode()).hexdigest()[:20] # noqa: S324 -- an id, not security
|
|
||||||
yield Line(app, f"spool/{digest}", entry)
|
|
||||||
path.unlink()
|
|
||||||
@ -1,207 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""The local record of every report ingested, grouped by app and signature.
|
|
||||||
|
|
||||||
It is the source of truth once RTDB entries and spool lines are consumed:
|
|
||||||
``seen`` makes a re-read count nothing twice, and each signature keeps its
|
|
||||||
count, first and last time, newest build and its resolution. :func:`report`
|
|
||||||
turns one app's records into the todoImplementer ``app-error`` contract
|
|
||||||
(``contracts/app-error.schema.json``, ``report``).
|
|
||||||
|
|
||||||
Resolve and reopen: ``resolve`` stores the time and the newest build seen. A
|
|
||||||
later report reopens the error only when it is a regression: a newer build
|
|
||||||
when both sides know the build, else a report made after the resolve.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
import tempfile
|
|
||||||
from typing import TYPE_CHECKING, NotRequired, TypedDict, cast
|
|
||||||
|
|
||||||
from app_errors.signature import SLOW_KIND, mark_of, signature, strings, top_frame
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Mapping
|
|
||||||
|
|
||||||
#: Entry ids remembered for dedup (oldest dropped first).
|
|
||||||
MAX_SEEN = 5000
|
|
||||||
#: An app name the board accepts (the contract's ``app`` pattern).
|
|
||||||
APP_NAME = re.compile(r"^[a-z0-9][a-z0-9_-]*$")
|
|
||||||
_REPO = re.compile(r"^[^/\s]+/[^/\s]+$")
|
|
||||||
|
|
||||||
|
|
||||||
class Resolved(TypedDict):
|
|
||||||
"""When the error was marked fixed, and the newest build seen then."""
|
|
||||||
|
|
||||||
at: str
|
|
||||||
build: int
|
|
||||||
|
|
||||||
|
|
||||||
class Rec(TypedDict):
|
|
||||||
"""Everything known about one signature of one app."""
|
|
||||||
|
|
||||||
signature: str
|
|
||||||
repo: str
|
|
||||||
kind: str
|
|
||||||
message: str
|
|
||||||
top_frame: str | None
|
|
||||||
route: str | None
|
|
||||||
count: int
|
|
||||||
first_seen: str
|
|
||||||
last_seen: str
|
|
||||||
build: int
|
|
||||||
version_name: str | None
|
|
||||||
longest_ms: NotRequired[int]
|
|
||||||
resolved: Resolved | None
|
|
||||||
|
|
||||||
|
|
||||||
class State(TypedDict):
|
|
||||||
"""The whole state file."""
|
|
||||||
|
|
||||||
version: int
|
|
||||||
seen: dict[str, str]
|
|
||||||
apps: dict[str, dict[str, Rec]]
|
|
||||||
|
|
||||||
|
|
||||||
def empty() -> State:
|
|
||||||
"""Return a state that knows nothing."""
|
|
||||||
return {"version": 1, "seen": {}, "apps": {}}
|
|
||||||
|
|
||||||
|
|
||||||
def load(path: Path) -> State:
|
|
||||||
"""Return the state at ``path``; empty when missing or unreadable."""
|
|
||||||
try:
|
|
||||||
data = json.loads(path.read_text())
|
|
||||||
except OSError, ValueError:
|
|
||||||
return empty()
|
|
||||||
if not isinstance(data, dict) or data.get("version") != 1:
|
|
||||||
return empty()
|
|
||||||
return cast("State", data)
|
|
||||||
|
|
||||||
|
|
||||||
def _atomic_write(path: Path, text: str) -> None:
|
|
||||||
path.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
fd, tmp = tempfile.mkstemp(dir=path.parent, prefix=f".{path.stem}-")
|
|
||||||
with os.fdopen(fd, "w") as f:
|
|
||||||
f.write(text)
|
|
||||||
Path(tmp).replace(path)
|
|
||||||
|
|
||||||
|
|
||||||
def save(path: Path, state: State) -> None:
|
|
||||||
"""Write ``state`` atomically (temp file + rename)."""
|
|
||||||
_atomic_write(path, json.dumps(state, indent=1, sort_keys=True))
|
|
||||||
|
|
||||||
|
|
||||||
def _int(value: object) -> int:
|
|
||||||
return value if isinstance(value, int) and not isinstance(value, bool) and value >= 0 else 0
|
|
||||||
|
|
||||||
|
|
||||||
def _str(value: object) -> str | None:
|
|
||||||
return value if isinstance(value, str) and value else None
|
|
||||||
|
|
||||||
|
|
||||||
def _reopens(resolved: Resolved, at: str, build: int) -> bool:
|
|
||||||
if build and resolved["build"]:
|
|
||||||
return build > resolved["build"]
|
|
||||||
return at > resolved["at"]
|
|
||||||
|
|
||||||
|
|
||||||
def merge(state: State, app: str, entry_id: str, raw: object) -> bool:
|
|
||||||
"""Count one report ``raw`` of ``app`` under its signature; False when seen or not a report."""
|
|
||||||
if not isinstance(raw, dict):
|
|
||||||
return False
|
|
||||||
entry = cast("Mapping[str, object]", raw)
|
|
||||||
at, kind = entry.get("at"), entry.get("kind")
|
|
||||||
if not isinstance(at, str) or not at or not isinstance(kind, str) or not kind:
|
|
||||||
return False
|
|
||||||
key = f"{app}/{entry_id}"
|
|
||||||
if key in state["seen"]:
|
|
||||||
return False
|
|
||||||
state["seen"][key] = at
|
|
||||||
while len(state["seen"]) > MAX_SEEN:
|
|
||||||
del state["seen"][next(iter(state["seen"]))]
|
|
||||||
sig = signature(entry, app=app)
|
|
||||||
build = _int(entry.get("build"))
|
|
||||||
recs = state["apps"].setdefault(app, {})
|
|
||||||
rec = recs.get(sig.id)
|
|
||||||
if rec is None:
|
|
||||||
repo = _str(entry.get("repo"))
|
|
||||||
rec = recs[sig.id] = {
|
|
||||||
"signature": sig.id,
|
|
||||||
"repo": repo if repo and _REPO.match(repo) else f"kuhyx/{app}",
|
|
||||||
"kind": kind,
|
|
||||||
"message": sig.message,
|
|
||||||
"top_frame": top_frame(strings(entry.get("stack")), mark_of(entry, app)),
|
|
||||||
"route": _str(entry.get("route")),
|
|
||||||
"count": 0,
|
|
||||||
"first_seen": at,
|
|
||||||
"last_seen": at,
|
|
||||||
"build": 0,
|
|
||||||
"version_name": None,
|
|
||||||
"resolved": None,
|
|
||||||
}
|
|
||||||
rec["count"] += 1
|
|
||||||
rec["first_seen"] = min(rec["first_seen"], at)
|
|
||||||
rec["last_seen"] = max(rec["last_seen"], at)
|
|
||||||
if build >= rec["build"]:
|
|
||||||
rec["build"] = build
|
|
||||||
rec["version_name"] = _str(entry.get("version")) or rec["version_name"]
|
|
||||||
if kind == SLOW_KIND:
|
|
||||||
rec["longest_ms"] = max(rec.get("longest_ms", 0), _int(entry.get("durationMs")))
|
|
||||||
resolved = rec["resolved"]
|
|
||||||
if resolved is not None and _reopens(resolved, at, build):
|
|
||||||
rec["resolved"] = None
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def resolve(state: State, app: str, sig: str, *, now: str) -> bool:
|
|
||||||
"""Mark ``app``'s ``sig`` fixed as of ``now``; False when there is no such error."""
|
|
||||||
rec = state["apps"].get(app, {}).get(sig)
|
|
||||||
if rec is None:
|
|
||||||
return False
|
|
||||||
rec["resolved"] = {"at": now, "build": rec["build"]}
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def _detail(rec: Rec) -> str | None:
|
|
||||||
route = f"route {rec['route']}" if rec["route"] else None
|
|
||||||
if rec["kind"] == SLOW_KIND:
|
|
||||||
longest = f"longest wait {rec.get('longest_ms', 0)} ms"
|
|
||||||
return f"{longest}, {route}" if route else longest
|
|
||||||
return route
|
|
||||||
|
|
||||||
|
|
||||||
def report(state: State, app: str) -> dict[str, object]:
|
|
||||||
"""Return ``app``'s records as a contract ``report``."""
|
|
||||||
errors = [
|
|
||||||
{
|
|
||||||
"app": app,
|
|
||||||
"repo": rec["repo"],
|
|
||||||
"signature": rec["signature"],
|
|
||||||
"kind": rec["kind"],
|
|
||||||
"message": rec["message"],
|
|
||||||
"top_frame": rec["top_frame"],
|
|
||||||
"count": rec["count"],
|
|
||||||
"first_seen": rec["first_seen"],
|
|
||||||
"last_seen": rec["last_seen"],
|
|
||||||
"build": rec["build"],
|
|
||||||
"version_name": rec["version_name"],
|
|
||||||
"detail": _detail(rec),
|
|
||||||
"open": rec["resolved"] is None,
|
|
||||||
}
|
|
||||||
for rec in sorted(state["apps"].get(app, {}).values(), key=lambda r: r["signature"])
|
|
||||||
]
|
|
||||||
return {"version": 1, "errors": errors}
|
|
||||||
|
|
||||||
|
|
||||||
def write_reports(folder: Path, state: State) -> list[Path]:
|
|
||||||
"""Write ``<folder>/<app>.json`` for every app with records; return the paths."""
|
|
||||||
written = []
|
|
||||||
for app in sorted(state["apps"]):
|
|
||||||
path = folder / f"{app}.json"
|
|
||||||
_atomic_write(path, json.dumps(report(state, app), indent=1))
|
|
||||||
written.append(path)
|
|
||||||
return written
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
||||||
"$id": "https://todoimplementer.local/contracts/app-error.schema.json",
|
|
||||||
"title": "App errors",
|
|
||||||
"description": "What an app writes for the errors loop (DOCS-errors.md): `~/.local/state/app-errors/<app>.json` is a `report`; kartka's own state.json is mapped to the same `record` by an adapter. One record per identical error (signature).",
|
|
||||||
"$defs": {
|
|
||||||
"record": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "One identical error or slow wait. The loop makes one ticket per `app:signature`.",
|
|
||||||
"properties": {
|
|
||||||
"app": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },
|
|
||||||
"repo": { "type": "string", "pattern": "^[^/\\s]+/[^/\\s]+$", "description": "owner/name of the repo that holds the fix." },
|
|
||||||
"signature": { "type": "string", "minLength": 1, "pattern": "^\\S+$", "description": "Stable id of the error: the same error always gets the same one." },
|
|
||||||
"kind": { "type": "string", "minLength": 1, "description": "crash, ui.error, perf.slow, ..." },
|
|
||||||
"message": { "type": "string", "description": "Masked message (no secrets, no user data)." },
|
|
||||||
"top_frame": { "type": ["string", "null"] },
|
|
||||||
"count": { "type": "integer", "minimum": 1 },
|
|
||||||
"first_seen": { "type": "string", "minLength": 1 },
|
|
||||||
"last_seen": { "type": "string", "minLength": 1 },
|
|
||||||
"build": { "type": "integer", "minimum": 0, "description": "Monotonic build of the newest report (Android versionCode); 0 when the source does not know it." },
|
|
||||||
"version_name": { "type": ["string", "null"] },
|
|
||||||
"detail": { "type": ["string", "null"], "description": "Free text: durations, route." },
|
|
||||||
"open": { "type": "boolean", "description": "False once the source marks the error resolved; default true." }
|
|
||||||
},
|
|
||||||
"required": ["app", "repo", "signature", "kind", "message", "count", "first_seen", "last_seen", "build"],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"report": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"version": { "const": 1 },
|
|
||||||
"errors": { "type": "array", "items": { "$ref": "#/$defs/record" } }
|
|
||||||
},
|
|
||||||
"required": ["version", "errors"],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "One entry of settings.json `error_sources`. `resolve` and `build` are argv lists; `{signature}`, `{repo_dir}` and `{commit}` are replaced.",
|
|
||||||
"properties": {
|
|
||||||
"app": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*$" },
|
|
||||||
"repo": { "type": "string", "pattern": "^[^/\\s]+/[^/\\s]+$" },
|
|
||||||
"adapter": { "enum": ["kartka", "contract"] },
|
|
||||||
"path": { "type": "string", "minLength": 1 },
|
|
||||||
"resolve": { "type": "array", "items": { "type": "string" } },
|
|
||||||
"build": { "type": "array", "items": { "type": "string" } }
|
|
||||||
},
|
|
||||||
"required": ["app", "repo", "adapter", "path"],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"ledger": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "`<run root>/app-errors.json`: what the loop knows per `app:signature`.",
|
|
||||||
"additionalProperties": { "$ref": "#/$defs/entry" }
|
|
||||||
},
|
|
||||||
"entry": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"state": { "enum": ["ticket", "shipped", "fixed"] },
|
|
||||||
"repo": { "type": "string" },
|
|
||||||
"title": { "type": "string" },
|
|
||||||
"count": { "type": "integer", "minimum": 0 },
|
|
||||||
"starts": { "type": "integer", "minimum": 0 },
|
|
||||||
"commit": { "type": "string" },
|
|
||||||
"shipped_at": { "type": "number" },
|
|
||||||
"fixed_build": { "type": "integer", "minimum": 0 },
|
|
||||||
"installed_at": { "type": "number" },
|
|
||||||
"missing": { "type": "integer", "minimum": 0, "description": "Ticks the part was not on the board (a Ship may be closing it)." }
|
|
||||||
},
|
|
||||||
"required": ["state", "repo", "title", "count", "starts"],
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,175 +0,0 @@
|
|||||||
"""The ingest: RTDB and local spools in, one board report per app out."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from app_errors import cli, ingest, spool
|
|
||||||
from app_errors.rtdb import RtdbError
|
|
||||||
|
|
||||||
|
|
||||||
class FakeRtdb:
|
|
||||||
"""An in-memory RTDB: ``get`` honours ``shallow``, ``patch`` deletes on None."""
|
|
||||||
|
|
||||||
def __init__(self, data: dict[str, object]) -> None:
|
|
||||||
self.data = data
|
|
||||||
self.patches: list[tuple[str, dict[str, object]]] = []
|
|
||||||
self.fail = False
|
|
||||||
|
|
||||||
def _at(self, path: str) -> object:
|
|
||||||
node: object = self.data
|
|
||||||
for part in [p for p in path.split("/") if p]:
|
|
||||||
if not isinstance(node, dict) or part not in node:
|
|
||||||
return None
|
|
||||||
node = node[part]
|
|
||||||
return node
|
|
||||||
|
|
||||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
|
||||||
if self.fail:
|
|
||||||
raise RtdbError("down")
|
|
||||||
node = self._at(path)
|
|
||||||
if shallow and isinstance(node, dict):
|
|
||||||
return dict.fromkeys(node, True)
|
|
||||||
return node
|
|
||||||
|
|
||||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
|
||||||
self.patches.append((path, data))
|
|
||||||
for key, value in data.items():
|
|
||||||
parts = [p for p in f"{path}/{key}".split("/") if p]
|
|
||||||
node = self.data
|
|
||||||
for part in parts[:-1]:
|
|
||||||
node = node.setdefault(part, {}) # type: ignore[assignment]
|
|
||||||
if value is None:
|
|
||||||
node.pop(parts[-1], None)
|
|
||||||
else:
|
|
||||||
node[parts[-1]] = value
|
|
||||||
|
|
||||||
|
|
||||||
def _crash(at: str) -> dict[str, object]:
|
|
||||||
return {
|
|
||||||
"repo": "kuhyx/todo",
|
|
||||||
"at": at,
|
|
||||||
"kind": "uncaught.flutter",
|
|
||||||
"error": "Bad state: x",
|
|
||||||
"build": 3,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def dirs(tmp_path: Path) -> ingest.Paths:
|
|
||||||
return ingest.Paths(
|
|
||||||
state=tmp_path / "ingest" / "state.json",
|
|
||||||
reports=tmp_path / "app-errors",
|
|
||||||
spool=tmp_path / "app-errors-spool",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_rtdb_entries_become_reports_and_are_deleted(dirs: ingest.Paths) -> None:
|
|
||||||
db = FakeRtdb({
|
|
||||||
"todo": {"errors": {"dev1": {"e1": _crash("2026-11-17T10:00:00Z"), "e2": _crash("2026-11-17T10:00:01Z")}}},
|
|
||||||
# kartka's own pre-0.9 uploader shape: sourceId, build per entry.
|
|
||||||
"kartka": {"errors": {"dev": {"k": {**_crash("2026-11-17T10:00:00Z"), "sourceId": "mangadex", "build": 556}}}},
|
|
||||||
"other": {"data": 1},
|
|
||||||
}) # fmt: skip
|
|
||||||
summary = ingest.run(dirs, db)
|
|
||||||
assert summary.merged == 3
|
|
||||||
report = json.loads((dirs.reports / "todo.json").read_text())
|
|
||||||
assert report["errors"][0]["count"] == 2
|
|
||||||
kartka = json.loads((dirs.reports / "kartka.json").read_text()) # kartka moved over 2026-11-17
|
|
||||||
assert kartka["errors"][0]["build"] == 556
|
|
||||||
assert db.data["todo"] == {"errors": {"dev1": {}}} # ingested entries are removed from RTDB
|
|
||||||
assert db.data["kartka"] == {"errors": {"dev": {}}}
|
|
||||||
|
|
||||||
|
|
||||||
def test_keep_leaves_rtdb_and_still_counts_once(dirs: ingest.Paths) -> None:
|
|
||||||
db = FakeRtdb({"todo": {"errors": {"d": {"e": _crash("2026-11-17T10:00:00Z")}}}})
|
|
||||||
ingest.run(dirs, db, keep=True)
|
|
||||||
ingest.run(dirs, db, keep=True)
|
|
||||||
report = json.loads((dirs.reports / "todo.json").read_text())
|
|
||||||
assert report["errors"][0]["count"] == 1
|
|
||||||
assert db.patches == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_rtdb_down_still_ingests_spool(dirs: ingest.Paths) -> None:
|
|
||||||
spool.append(dirs.spool, "tk-app", {"repo": "kuhyx/tk", "at": "2026-11-17T10:00:00Z",
|
|
||||||
"kind": "uncaught.python", "error": "ValueError: x"}) # fmt: skip
|
|
||||||
db = FakeRtdb({})
|
|
||||||
db.fail = True
|
|
||||||
summary = ingest.run(dirs, db)
|
|
||||||
assert summary.merged == 1
|
|
||||||
assert summary.rtdb_error == "down"
|
|
||||||
assert json.loads((dirs.reports / "tk-app.json").read_text())["errors"][0]["repo"] == "kuhyx/tk"
|
|
||||||
assert list(dirs.spool.glob("*")) == [] # the spool is consumed
|
|
||||||
|
|
||||||
|
|
||||||
def test_no_rtdb_at_all(dirs: ingest.Paths) -> None:
|
|
||||||
assert ingest.run(dirs, None).merged == 0
|
|
||||||
|
|
||||||
|
|
||||||
def test_spool_bad_lines_and_bad_names_are_skipped(dirs: ingest.Paths) -> None:
|
|
||||||
dirs.spool.mkdir(parents=True)
|
|
||||||
(dirs.spool / "ok.jsonl").write_text('not json\n{"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"}\n[]\n')
|
|
||||||
(dirs.spool / "Bad Name.jsonl").write_text('{"at": "x", "kind": "k", "error": "e"}\n')
|
|
||||||
assert ingest.run(dirs, None).merged == 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_leftover_claimed_spool_is_ingested(dirs: ingest.Paths) -> None:
|
|
||||||
dirs.spool.mkdir(parents=True)
|
|
||||||
(dirs.spool / "ok.jsonl.ingesting").write_text('{"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"}\n')
|
|
||||||
assert ingest.run(dirs, None).merged == 1
|
|
||||||
assert list(dirs.spool.glob("*")) == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_rtdb_odd_shapes_are_skipped(dirs: ingest.Paths) -> None:
|
|
||||||
db = FakeRtdb(
|
|
||||||
{
|
|
||||||
"todo": {"errors": {"d": "nope", "e": {"x": "nope"}}},
|
|
||||||
"bad key!": {"errors": {}},
|
|
||||||
}
|
|
||||||
)
|
|
||||||
assert ingest.run(dirs, db).merged == 0
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_ingest_and_resolve(dirs: ingest.Paths, monkeypatch: pytest.MonkeyPatch,
|
|
||||||
capsys: pytest.CaptureFixture[str]) -> None: # fmt: skip
|
|
||||||
monkeypatch.setattr(ingest, "default_paths", lambda: dirs)
|
|
||||||
spool.append(dirs.spool, "tk", {"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"})
|
|
||||||
assert cli.main(["ingest", "--no-rtdb"]) == 0
|
|
||||||
sig = json.loads((dirs.reports / "tk.json").read_text())["errors"][0]["signature"]
|
|
||||||
assert cli.main(["resolve", "tk", sig]) == 0
|
|
||||||
assert json.loads((dirs.reports / "tk.json").read_text())["errors"][0]["open"] is False
|
|
||||||
assert cli.main(["resolve", "tk", "missing"]) == 1
|
|
||||||
assert "unknown" in capsys.readouterr().err
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_ingest_rtdb_session_missing(dirs: ingest.Paths, monkeypatch: pytest.MonkeyPatch,
|
|
||||||
capsys: pytest.CaptureFixture[str]) -> None: # fmt: skip
|
|
||||||
monkeypatch.setattr(ingest, "default_paths", lambda: dirs)
|
|
||||||
|
|
||||||
def no_session(_app: str) -> FakeRtdb:
|
|
||||||
raise RtdbError("no session")
|
|
||||||
|
|
||||||
monkeypatch.setattr(cli, "open_rtdb", no_session)
|
|
||||||
spool.append(dirs.spool, "tk", {"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "e"})
|
|
||||||
assert cli.main(["ingest"]) == 1 # the spool still went in, but RTDB is reported broken
|
|
||||||
assert (dirs.reports / "tk.json").exists()
|
|
||||||
assert "no session" in capsys.readouterr().err
|
|
||||||
|
|
||||||
|
|
||||||
def test_cli_ingest_with_rtdb(dirs: ingest.Paths, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
||||||
monkeypatch.setattr(ingest, "default_paths", lambda: dirs)
|
|
||||||
db = FakeRtdb({"todo": {"errors": {"d": {"e": _crash("2026-11-17T10:00:00Z")}}}})
|
|
||||||
monkeypatch.setattr(cli, "open_rtdb", lambda _app: db)
|
|
||||||
assert cli.main(["ingest", "--keep", "--session", "x"]) == 0
|
|
||||||
assert (dirs.reports / "todo.json").exists()
|
|
||||||
|
|
||||||
|
|
||||||
def test_default_paths_follow_xdg(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:
|
|
||||||
monkeypatch.setenv("XDG_STATE_HOME", str(tmp_path))
|
|
||||||
paths = ingest.default_paths()
|
|
||||||
assert paths.reports == tmp_path / "app-errors"
|
|
||||||
assert paths.spool == tmp_path / "app-errors-spool"
|
|
||||||
assert paths.state == tmp_path / "app-errors-ingest" / "state.json"
|
|
||||||
@ -1,140 +0,0 @@
|
|||||||
"""The REST client: URLs, shallow reads, typed errors that never name the token."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import email.message
|
|
||||||
import io
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
import types
|
|
||||||
from typing import cast
|
|
||||||
import urllib.error
|
|
||||||
import urllib.request
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from app_errors import ingest, rtdb, store
|
|
||||||
from app_errors.rtdb import RestRtdb, RtdbError
|
|
||||||
|
|
||||||
|
|
||||||
class _Res(io.BytesIO):
|
|
||||||
def __enter__(self) -> _Res:
|
|
||||||
return self
|
|
||||||
|
|
||||||
def __exit__(self, *_: object) -> None:
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_and_patch_build_urls() -> None:
|
|
||||||
seen: list[tuple[str, str, object]] = []
|
|
||||||
|
|
||||||
def opener(req: urllib.request.Request, timeout: float) -> _Res:
|
|
||||||
seen.append((req.get_method(), req.full_url, req.data))
|
|
||||||
return _Res(b'{"a": true}')
|
|
||||||
|
|
||||||
db = RestRtdb("https://db.example/", lambda: "TOK", opener)
|
|
||||||
assert db.get("", shallow=True) == {"a": True}
|
|
||||||
db.patch("todo/errors", {"d/e": None})
|
|
||||||
assert seen[0][:2] == ("GET", "https://db.example/.json?auth=TOK&shallow=true")
|
|
||||||
assert seen[1][0] == "PATCH"
|
|
||||||
assert json.loads(cast("bytes", seen[1][2])) == {"d/e": None}
|
|
||||||
|
|
||||||
|
|
||||||
def test_empty_body_is_none() -> None:
|
|
||||||
assert RestRtdb("https://x", lambda: "t", lambda req, timeout: _Res(b"")).get("p") is None
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"exc",
|
|
||||||
[
|
|
||||||
urllib.error.HTTPError("u", 401, "no", email.message.Message(), None),
|
|
||||||
urllib.error.URLError("down"),
|
|
||||||
OSError("x"),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_failures_are_typed_and_tokenless(exc: Exception) -> None:
|
|
||||||
def opener(req: urllib.request.Request, timeout: float) -> _Res:
|
|
||||||
raise exc
|
|
||||||
|
|
||||||
with pytest.raises(RtdbError) as info:
|
|
||||||
RestRtdb("https://x", lambda: "SECRET", opener).get("p")
|
|
||||||
assert "SECRET" not in str(info.value)
|
|
||||||
|
|
||||||
|
|
||||||
def test_token_failure_is_typed() -> None:
|
|
||||||
def boom() -> str:
|
|
||||||
raise ValueError("SECRET")
|
|
||||||
|
|
||||||
with pytest.raises(RtdbError, match="token refresh failed"):
|
|
||||||
RestRtdb("https://x", boom).get("p")
|
|
||||||
|
|
||||||
|
|
||||||
def _fake_crdt(monkeypatch: pytest.MonkeyPatch, *, session: bool, config_ok: bool = True) -> None:
|
|
||||||
mod = types.ModuleType("crdt_sync")
|
|
||||||
|
|
||||||
class Config:
|
|
||||||
api_key, database_url = "k", "https://db"
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def load() -> Config:
|
|
||||||
if not config_ok:
|
|
||||||
raise FileNotFoundError("cfg")
|
|
||||||
return Config()
|
|
||||||
|
|
||||||
class Provider:
|
|
||||||
def __init__(self, *_: object, **__: object) -> None: ...
|
|
||||||
def has_session(self) -> bool:
|
|
||||||
return session
|
|
||||||
|
|
||||||
def id_token(self) -> str:
|
|
||||||
return "t"
|
|
||||||
|
|
||||||
mod.FirebaseConfig = Config # type: ignore[attr-defined]
|
|
||||||
mod.FirebaseTokenProvider = Provider # type: ignore[attr-defined]
|
|
||||||
mod.credential_store_for = lambda name: name # type: ignore[attr-defined]
|
|
||||||
monkeypatch.setitem(sys.modules, "crdt_sync", mod)
|
|
||||||
|
|
||||||
|
|
||||||
def test_open_rtdb(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
||||||
_fake_crdt(monkeypatch, session=True)
|
|
||||||
assert isinstance(rtdb.open_rtdb("s"), RestRtdb)
|
|
||||||
_fake_crdt(monkeypatch, session=False)
|
|
||||||
with pytest.raises(RtdbError, match="no seeded"):
|
|
||||||
rtdb.open_rtdb("s")
|
|
||||||
_fake_crdt(monkeypatch, session=True, config_ok=False)
|
|
||||||
with pytest.raises(RtdbError, match="no Firebase config"):
|
|
||||||
rtdb.open_rtdb("s")
|
|
||||||
|
|
||||||
|
|
||||||
class _PatchFails:
|
|
||||||
def get(self, path: str, *, shallow: bool = False) -> object:
|
|
||||||
if shallow:
|
|
||||||
return {"todo": True}
|
|
||||||
return {"d": {"e": {"at": "2026-11-17T10:00:00Z", "kind": "k", "error": "x"}}}
|
|
||||||
|
|
||||||
def patch(self, path: str, data: dict[str, object]) -> None:
|
|
||||||
raise RtdbError("patch down")
|
|
||||||
|
|
||||||
|
|
||||||
def test_delete_failure_is_reported_after_save(tmp_path: Path) -> None:
|
|
||||||
paths = ingest.Paths(tmp_path / "s.json", tmp_path / "r", tmp_path / "sp")
|
|
||||||
summary = ingest.run(paths, _PatchFails())
|
|
||||||
assert summary == ingest.Summary(1, "patch down")
|
|
||||||
assert (tmp_path / "r" / "todo.json").exists()
|
|
||||||
|
|
||||||
|
|
||||||
def test_old_state_version_and_seen_trim(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
||||||
path = tmp_path / "s.json"
|
|
||||||
path.write_text('{"version": 0}')
|
|
||||||
assert store.load(path) == store.empty()
|
|
||||||
monkeypatch.setattr(store, "MAX_SEEN", 2)
|
|
||||||
state = store.empty()
|
|
||||||
for i in range(3):
|
|
||||||
store.merge(
|
|
||||||
state,
|
|
||||||
"a",
|
|
||||||
str(i),
|
|
||||||
{"at": f"2026-11-17T10:00:0{i}Z", "kind": "k", "error": "x"},
|
|
||||||
)
|
|
||||||
assert list(state["seen"]) == ["a/1", "a/2"]
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
"""Signatures: one per bug, kartka-identical for Dart, generalised for Python and GDScript."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from app_errors.signature import normalise, signature, top_frame
|
|
||||||
|
|
||||||
|
|
||||||
def test_dart_crash_matches_kartka_vector() -> None:
|
|
||||||
# Vector from kartka_errors.signature (kartka 2026-11-17): moving kartka
|
|
||||||
# onto this ingest must not rename its open tickets.
|
|
||||||
entry = {
|
|
||||||
"kind": "uncaught.flutter",
|
|
||||||
"error": "Bad state: no element 42",
|
|
||||||
"stack": [
|
|
||||||
"#0 List.first (dart:core/list.dart:12:3)",
|
|
||||||
"#1 Reader.open (package:kartka/reader/reader.dart:88:7)",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
sig = signature(entry, app="kartka")
|
|
||||||
assert sig.id == "ffcd864656"
|
|
||||||
assert sig.type == "StateError"
|
|
||||||
assert sig.where == "Reader.open (package:kartka/reader/reader.dart)"
|
|
||||||
|
|
||||||
|
|
||||||
def test_slow_wait_matches_kartka_vector() -> None:
|
|
||||||
entry = {
|
|
||||||
"kind": "perf.slow",
|
|
||||||
"operation": "reader.open",
|
|
||||||
"route": "/reader/:id",
|
|
||||||
"durationMs": 2100,
|
|
||||||
}
|
|
||||||
sig = signature(entry, app="kartka")
|
|
||||||
assert sig.id == "29a53e8824"
|
|
||||||
assert sig.message == "slow wait: reader.open"
|
|
||||||
|
|
||||||
|
|
||||||
def test_slow_wait_ignores_duration() -> None:
|
|
||||||
one = {"kind": "perf.slow", "operation": "load", "durationMs": 1100}
|
|
||||||
two = {"kind": "perf.slow", "operation": "load", "durationMs": 9000}
|
|
||||||
assert signature(one, app="a").id == signature(two, app="a").id
|
|
||||||
|
|
||||||
|
|
||||||
def test_mark_picks_app_frame_and_skips_plumbing() -> None:
|
|
||||||
stack = [
|
|
||||||
"#0 ErrorReporter.report (package:crdt_sync_flutter/src/errors/error_reporter.dart:5:1)",
|
|
||||||
"#1 Home.build (package:todo/home.dart:10:2)",
|
|
||||||
]
|
|
||||||
assert top_frame(stack, "package:todo/") == "Home.build (package:todo/home.dart)"
|
|
||||||
|
|
||||||
|
|
||||||
def test_python_frame_line_numbers_dropped() -> None:
|
|
||||||
entry = {
|
|
||||||
"kind": "uncaught.python",
|
|
||||||
"error": "ValueError: bad 12",
|
|
||||||
"stack": [
|
|
||||||
"gatelock/error_report.py:40 in hook",
|
|
||||||
"leetcode_guard/ui.py:123 in solve",
|
|
||||||
],
|
|
||||||
"mark": "leetcode_guard/",
|
|
||||||
}
|
|
||||||
sig = signature(entry, app="leetcode-guard")
|
|
||||||
assert sig.where == "leetcode_guard/ui.py in solve"
|
|
||||||
assert sig.type == "ValueError"
|
|
||||||
assert sig.message == "ValueError: bad <n>"
|
|
||||||
|
|
||||||
|
|
||||||
def test_godot_frame_and_kind_fallback() -> None:
|
|
||||||
entry = {
|
|
||||||
"kind": "uncaught.gdscript",
|
|
||||||
"error": "Invalid access to property 'x'",
|
|
||||||
"stack": [
|
|
||||||
"res://addons/app_errors/error_reporter.gd:9 in _log",
|
|
||||||
"res://scripts/car.gd:77 in _ready",
|
|
||||||
],
|
|
||||||
"mark": "res://",
|
|
||||||
}
|
|
||||||
sig = signature(entry, app="car-rental-sim")
|
|
||||||
assert sig.where == "res://scripts/car.gd in _ready"
|
|
||||||
assert sig.type == "uncaught.gdscript"
|
|
||||||
|
|
||||||
|
|
||||||
def test_no_frame_falls_back_to_route_then_kind() -> None:
|
|
||||||
assert signature({"kind": "ui.snackbar", "error": "x", "route": "/a"}, app="a").where == "route /a"
|
|
||||||
assert signature({"kind": "ui.snackbar", "error": "x"}, app="a").where == "kind ui.snackbar"
|
|
||||||
|
|
||||||
|
|
||||||
def test_normalise_masks_volatile_parts() -> None:
|
|
||||||
text = "GET https://x.y/z 3f2a9c1d00ff 123e4567-e89b-12d3-a456-426614174000 took 15 s"
|
|
||||||
assert normalise(text) == "GET <url> <hex> <uuid> took <n> s"
|
|
||||||
@ -1,144 +0,0 @@
|
|||||||
"""The merged state: counts, builds, resolve and reopen, and the board report."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import jsonschema
|
|
||||||
|
|
||||||
from app_errors import store
|
|
||||||
|
|
||||||
SCHEMA = json.loads((Path(__file__).parent / "data" / "app-error.schema.json").read_text())
|
|
||||||
|
|
||||||
|
|
||||||
def _crash(at: str, build: int = 7, **extra: object) -> dict[str, object]:
|
|
||||||
return {
|
|
||||||
"app": "todo",
|
|
||||||
"repo": "kuhyx/todo",
|
|
||||||
"at": at,
|
|
||||||
"kind": "uncaught.flutter",
|
|
||||||
"error": "Bad state: boom",
|
|
||||||
"stack": ["#0 Home.build (package:todo/home.dart:3:1)"],
|
|
||||||
"build": build,
|
|
||||||
"version": "1.0.0",
|
|
||||||
**extra,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _report(state: store.State, app: str) -> dict[str, object]:
|
|
||||||
report = store.report(state, app)
|
|
||||||
jsonschema.Draft202012Validator({**SCHEMA, "$ref": "#/$defs/report"}).validate(report)
|
|
||||||
return report
|
|
||||||
|
|
||||||
|
|
||||||
def test_ten_identical_errors_are_one_record_with_count_ten() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
for i in range(10):
|
|
||||||
assert store.merge(state, "todo", f"dev/{i}", _crash(f"2026-11-17T10:00:{i:02d}Z"))
|
|
||||||
errors = _report(state, "todo")["errors"]
|
|
||||||
assert isinstance(errors, list)
|
|
||||||
assert len(errors) == 1
|
|
||||||
rec = errors[0]
|
|
||||||
assert rec["count"] == 10
|
|
||||||
assert rec["first_seen"] == "2026-11-17T10:00:00Z"
|
|
||||||
assert rec["last_seen"] == "2026-11-17T10:00:09Z"
|
|
||||||
assert rec["build"] == 7
|
|
||||||
assert rec["version_name"] == "1.0.0"
|
|
||||||
assert rec["open"] is True
|
|
||||||
assert rec["repo"] == "kuhyx/todo"
|
|
||||||
|
|
||||||
|
|
||||||
def test_same_entry_id_counts_once() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
assert store.merge(state, "todo", "dev/a", _crash("2026-11-17T10:00:00Z"))
|
|
||||||
assert not store.merge(state, "todo", "dev/a", _crash("2026-11-17T10:00:00Z"))
|
|
||||||
assert state["apps"]["todo"][next(iter(state["apps"]["todo"]))]["count"] == 1
|
|
||||||
|
|
||||||
|
|
||||||
def test_newest_build_wins() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z", build=9))
|
|
||||||
store.merge(state, "todo", "b", _crash("2026-11-17T11:00:00Z", build=4))
|
|
||||||
assert _report(state, "todo")["errors"][0]["build"] == 9 # type: ignore[index]
|
|
||||||
|
|
||||||
|
|
||||||
def test_slow_wait_detail_names_longest_wait() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
for i, ms in enumerate((1500, 2100)):
|
|
||||||
store.merge(
|
|
||||||
state,
|
|
||||||
"todo",
|
|
||||||
f"w{i}",
|
|
||||||
{"app": "todo", "repo": "kuhyx/todo", "at": f"2026-11-17T10:00:0{i}Z", "kind": "perf.slow",
|
|
||||||
"error": f"list.load waited {ms} ms", "operation": "list.load", "route": "/", "durationMs": ms},
|
|
||||||
) # fmt: skip
|
|
||||||
rec = _report(state, "todo")["errors"][0] # type: ignore[index]
|
|
||||||
assert rec["kind"] == "perf.slow"
|
|
||||||
assert rec["count"] == 2
|
|
||||||
assert "2100 ms" in rec["detail"]
|
|
||||||
assert rec["build"] == 0
|
|
||||||
|
|
||||||
|
|
||||||
def test_resolve_closes_and_older_build_does_not_reopen() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z", build=7))
|
|
||||||
sig = _report(state, "todo")["errors"][0]["signature"] # type: ignore[index]
|
|
||||||
assert store.resolve(state, "todo", sig, now="2026-11-17T12:00:00Z")
|
|
||||||
assert _report(state, "todo")["errors"][0]["open"] is False # type: ignore[index]
|
|
||||||
store.merge(state, "todo", "b", _crash("2026-11-17T13:00:00Z", build=7))
|
|
||||||
assert _report(state, "todo")["errors"][0]["open"] is False # type: ignore[index]
|
|
||||||
store.merge(state, "todo", "c", _crash("2026-11-17T14:00:00Z", build=8))
|
|
||||||
assert _report(state, "todo")["errors"][0]["open"] is True # type: ignore[index]
|
|
||||||
|
|
||||||
|
|
||||||
def test_resolve_without_build_reopens_on_later_report() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
store.merge(state, "tk", "a", _crash("2026-11-17T10:00:00Z", build=0, app="tk"))
|
|
||||||
sig = _report(state, "tk")["errors"][0]["signature"] # type: ignore[index]
|
|
||||||
store.resolve(state, "tk", sig, now="2026-11-17T12:00:00Z")
|
|
||||||
store.merge(state, "tk", "b", _crash("2026-11-17T11:00:00Z", build=0, app="tk"))
|
|
||||||
assert _report(state, "tk")["errors"][0]["open"] is False # type: ignore[index]
|
|
||||||
store.merge(state, "tk", "c", _crash("2026-11-17T13:00:00Z", build=0, app="tk"))
|
|
||||||
assert _report(state, "tk")["errors"][0]["open"] is True # type: ignore[index]
|
|
||||||
|
|
||||||
|
|
||||||
def test_resolve_unknown_signature_is_false() -> None:
|
|
||||||
assert not store.resolve(store.empty(), "todo", "nope", now="2026-11-17T12:00:00Z")
|
|
||||||
|
|
||||||
|
|
||||||
def test_missing_repo_defaults_to_kuhyx_app() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
entry = _crash("2026-11-17T10:00:00Z")
|
|
||||||
del entry["repo"]
|
|
||||||
store.merge(state, "todo", "a", entry)
|
|
||||||
assert _report(state, "todo")["errors"][0]["repo"] == "kuhyx/todo" # type: ignore[index]
|
|
||||||
|
|
||||||
|
|
||||||
def test_bad_entry_is_skipped() -> None:
|
|
||||||
state = store.empty()
|
|
||||||
assert not store.merge(state, "todo", "a", {"kind": 3})
|
|
||||||
assert not store.merge(state, "todo", "b", "nope")
|
|
||||||
assert store.report(state, "todo")["errors"] == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_save_and_load_round_trip(tmp_path: Path) -> None:
|
|
||||||
state = store.empty()
|
|
||||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z"))
|
|
||||||
path = tmp_path / "s" / "state.json"
|
|
||||||
store.save(path, state)
|
|
||||||
assert store.load(path) == state
|
|
||||||
path.write_text("{broken")
|
|
||||||
assert store.load(path) == store.empty()
|
|
||||||
assert store.load(tmp_path / "missing.json") == store.empty()
|
|
||||||
|
|
||||||
|
|
||||||
def test_write_reports_writes_one_file_per_app(tmp_path: Path) -> None:
|
|
||||||
state = store.empty()
|
|
||||||
store.merge(state, "todo", "a", _crash("2026-11-17T10:00:00Z"))
|
|
||||||
store.merge(state, "tk", "a", _crash("2026-11-17T10:00:00Z", app="tk"))
|
|
||||||
written = store.write_reports(tmp_path, state)
|
|
||||||
assert sorted(p.name for p in written) == ["tk.json", "todo.json"]
|
|
||||||
data = json.loads((tmp_path / "todo.json").read_text())
|
|
||||||
assert data["version"] == 1
|
|
||||||
assert len(data["errors"]) == 1
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# ============================================================================
|
|
||||||
# Install the app-errors CLI and its ingest timer for the current user.
|
|
||||||
#
|
|
||||||
# Own venv at ~/.local/share/app-errors/venv, the package installed editable
|
|
||||||
# from this checkout (run it from the live ~/src/utils, never a worktree).
|
|
||||||
# crdt-sync comes from the sibling directory, so the venv runs what is on disk.
|
|
||||||
# Idempotent: rerun it after any change. Exits non-zero unless the timer is
|
|
||||||
# active and one ingest pass over the local spool succeeds.
|
|
||||||
# ============================================================================
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
||||||
UTILS_DIR="$(dirname "$REPO_DIR")"
|
|
||||||
readonly REPO_DIR UTILS_DIR
|
|
||||||
readonly VENV_DIR="${HOME}/.local/share/app-errors/venv"
|
|
||||||
readonly BIN_DIR="${HOME}/.local/bin"
|
|
||||||
readonly UNIT_DIR="${HOME}/.config/systemd/user"
|
|
||||||
readonly TIMER="app-errors-ingest.timer"
|
|
||||||
|
|
||||||
log() { printf 'install: %s\n' "$1" >&2; }
|
|
||||||
fail() { printf 'install: FAILED -- %s\n' "$1" >&2; exit 1; }
|
|
||||||
|
|
||||||
build_venv() {
|
|
||||||
[[ -x "$VENV_DIR/bin/python" ]] || /usr/bin/python3 -m venv "$VENV_DIR" || fail "venv"
|
|
||||||
"$VENV_DIR/bin/pip" install --quiet "$UTILS_DIR/crdt-sync" || fail "crdt-sync"
|
|
||||||
"$VENV_DIR/bin/pip" install --quiet --no-deps -e "$REPO_DIR" || fail "app-errors"
|
|
||||||
mkdir -p "$BIN_DIR"
|
|
||||||
ln -sf "$VENV_DIR/bin/app-errors" "$BIN_DIR/app-errors"
|
|
||||||
}
|
|
||||||
|
|
||||||
install_timer() {
|
|
||||||
mkdir -p "$UNIT_DIR"
|
|
||||||
install -m 0644 "$REPO_DIR/systemd/app-errors-ingest.service" "$REPO_DIR/systemd/$TIMER" "$UNIT_DIR/"
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
systemctl --user enable --now "$TIMER"
|
|
||||||
}
|
|
||||||
|
|
||||||
verify() {
|
|
||||||
systemctl --user is-active --quiet "$TIMER" || fail "$TIMER is not active"
|
|
||||||
"$VENV_DIR/bin/app-errors" ingest --no-rtdb >/dev/null || fail "a spool-only ingest pass failed"
|
|
||||||
log "ok: $TIMER active, ingest runs"
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
log "installing app-errors from $REPO_DIR"
|
|
||||||
build_venv
|
|
||||||
install_timer
|
|
||||||
verify
|
|
||||||
}
|
|
||||||
|
|
||||||
main "$@"
|
|
||||||
@ -1,186 +0,0 @@
|
|||||||
[project]
|
|
||||||
name = "app-errors"
|
|
||||||
version = "0.1.1"
|
|
||||||
description = "Shared app error and slow-wait ingest: RTDB and local spool reports become todoImplementer error tickets"
|
|
||||||
requires-python = ">=3.14"
|
|
||||||
dependencies = [
|
|
||||||
"crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync",
|
|
||||||
]
|
|
||||||
|
|
||||||
[project.optional-dependencies]
|
|
||||||
test = ["jsonschema==4.26.0", "pytest==9.2.0", "pytest-cov==7.1.0"]
|
|
||||||
|
|
||||||
[project.scripts]
|
|
||||||
app-errors = "app_errors.cli:main"
|
|
||||||
|
|
||||||
[tool.setuptools]
|
|
||||||
packages = ["app_errors"]
|
|
||||||
|
|
||||||
# py.typed: consumers type-check against the package (PEP 561).
|
|
||||||
[tool.setuptools.package-data]
|
|
||||||
app_errors = ["py.typed"]
|
|
||||||
|
|
||||||
[tool.ruff]
|
|
||||||
target-version = "py314"
|
|
||||||
line-length = 120
|
|
||||||
include = ["*.py", "**/*.py"]
|
|
||||||
exclude = [".git", ".venv", "__pycache__", "build", "dist", ".eggs"]
|
|
||||||
|
|
||||||
[tool.ruff.lint]
|
|
||||||
select = ["ALL"]
|
|
||||||
ignore = [
|
|
||||||
"D203",
|
|
||||||
"D213",
|
|
||||||
"COM812",
|
|
||||||
"ISC001",
|
|
||||||
"S603",
|
|
||||||
]
|
|
||||||
fixable = ["ALL"]
|
|
||||||
unfixable = []
|
|
||||||
|
|
||||||
[tool.ruff.lint.per-file-ignores]
|
|
||||||
"**/tests/*.py" = ["ANN", "ARG", "CPY001", "D", "EM101", "PLC0415", "PLR2004", "PYI034", "S101", "SLF001", "TC002", "TC003", "TRY003"]
|
|
||||||
"**/_fake_*.py" = ["ANN401", "ARG002"]
|
|
||||||
"**/test_*.py" = ["ANN", "ARG", "CPY001", "D", "EM101", "PLC0415", "PLR2004", "PYI034", "S101", "SLF001", "TC002", "TC003", "TRY003"]
|
|
||||||
|
|
||||||
|
|
||||||
[tool.ruff.lint.pydocstyle]
|
|
||||||
convention = "google"
|
|
||||||
|
|
||||||
[tool.ruff.lint.isort]
|
|
||||||
force-single-line = false
|
|
||||||
force-sort-within-sections = true
|
|
||||||
known-first-party = ["app_errors"]
|
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-quotes]
|
|
||||||
docstring-quotes = "double"
|
|
||||||
inline-quotes = "double"
|
|
||||||
|
|
||||||
[tool.ruff.lint.flake8-tidy-imports]
|
|
||||||
ban-relative-imports = "all"
|
|
||||||
|
|
||||||
[tool.ruff.format]
|
|
||||||
quote-style = "double"
|
|
||||||
indent-style = "space"
|
|
||||||
skip-magic-trailing-comma = false
|
|
||||||
line-ending = "auto"
|
|
||||||
docstring-code-format = true
|
|
||||||
|
|
||||||
[tool.mypy]
|
|
||||||
python_version = "3.14"
|
|
||||||
strict = true
|
|
||||||
warn_return_any = true
|
|
||||||
warn_unused_configs = true
|
|
||||||
disallow_untyped_defs = true
|
|
||||||
disallow_incomplete_defs = true
|
|
||||||
check_untyped_defs = true
|
|
||||||
disallow_untyped_decorators = true
|
|
||||||
no_implicit_optional = true
|
|
||||||
warn_redundant_casts = true
|
|
||||||
warn_unused_ignores = true
|
|
||||||
warn_no_return = true
|
|
||||||
warn_unreachable = true
|
|
||||||
# crdt_sync ships no py.typed: its names would all be "unfollowed".
|
|
||||||
disallow_any_unimported = false
|
|
||||||
disallow_any_explicit = false
|
|
||||||
disallow_any_generics = true
|
|
||||||
disallow_subclassing_any = true
|
|
||||||
strict_equality = true
|
|
||||||
extra_checks = true
|
|
||||||
ignore_missing_imports = true
|
|
||||||
show_error_codes = true
|
|
||||||
color_output = true
|
|
||||||
exclude = [".venv/"]
|
|
||||||
|
|
||||||
[tool.pylint.main]
|
|
||||||
# The repo root on the path, so pylint resolves the package's own imports the
|
|
||||||
# same way pytest does instead of reporting import-error for them.
|
|
||||||
init-hook = "import sys; sys.path.insert(0, 'app_errors')"
|
|
||||||
analyse-fallback-blocks = true
|
|
||||||
persistent = true
|
|
||||||
jobs = 0
|
|
||||||
py-version = "3.14"
|
|
||||||
ignore = [".venv", "__pycache__"]
|
|
||||||
# Test suites intentionally use patterns (protected-access, fixture-arg
|
|
||||||
# shadowing) that don't apply to source code; ruff's per-file-ignores carry
|
|
||||||
# the equivalent exemptions, so tests stay linted -- by ruff. This is the same
|
|
||||||
# source-only pylint scope wake-alarm / diet-guard / testsAndMisc use. It has
|
|
||||||
# to be `ignore-paths`, not `ignore = ["tests"]`: `ignore` only matches the
|
|
||||||
# basename of what pylint is *given*, and pre-commit hands it explicit file
|
|
||||||
# paths, so a directory name in `ignore` never fires under the hook.
|
|
||||||
ignore-paths = ["^(.*/)?tests/.*$"]
|
|
||||||
ignore-patterns = [".*\\.pyi$"]
|
|
||||||
|
|
||||||
[tool.pylint.basic]
|
|
||||||
# snake_case, plus the ``do_<METHOD>`` names http.server dispatches on: the
|
|
||||||
# stdlib looks handlers up as ``"do_" + command``, so ``do_GET`` is the only
|
|
||||||
# spelling that works and cannot be renamed to satisfy the style.
|
|
||||||
method-rgx = "([^\\W\\dA-Z][^\\WA-Z]{2,}|_[^\\WA-Z]*|__[^\\W\\dA-Z][^\\WA-Z]+__|do_[A-Z]+|of)$"
|
|
||||||
|
|
||||||
[tool.pylint.messages_control]
|
|
||||||
enable = "all"
|
|
||||||
disable = []
|
|
||||||
|
|
||||||
[tool.pylint.design]
|
|
||||||
min-public-methods = 0
|
|
||||||
max-module-lines = 1000
|
|
||||||
max-attributes = 10
|
|
||||||
|
|
||||||
[tool.pylint.typecheck]
|
|
||||||
generated-members = [
|
|
||||||
".*\\.assert_called_once_with",
|
|
||||||
".*\\.assert_called_once",
|
|
||||||
".*\\.assert_called",
|
|
||||||
".*\\.assert_not_called",
|
|
||||||
".*\\.assert_any_call",
|
|
||||||
".*\\.call_args",
|
|
||||||
".*\\.call_args_list",
|
|
||||||
".*\\.call_count",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.bandit]
|
|
||||||
exclude_dirs = ["tests", ".venv"]
|
|
||||||
|
|
||||||
[tool.pytest.ini_options]
|
|
||||||
testpaths = ["app_errors/tests"]
|
|
||||||
python_files = ["test_*.py", "*_test.py"]
|
|
||||||
python_classes = ["Test*"]
|
|
||||||
python_functions = ["test_*"]
|
|
||||||
addopts = [
|
|
||||||
"-v",
|
|
||||||
"--strict-markers",
|
|
||||||
"--strict-config",
|
|
||||||
"-ra",
|
|
||||||
"--cov=app_errors",
|
|
||||||
"--cov-branch",
|
|
||||||
"--cov-report=term-missing",
|
|
||||||
"--cov-report=lcov",
|
|
||||||
]
|
|
||||||
filterwarnings = [
|
|
||||||
"error",
|
|
||||||
"ignore::DeprecationWarning",
|
|
||||||
"default::pytest.PytestUnraisableExceptionWarning",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.coverage.run]
|
|
||||||
source = ["app_errors"]
|
|
||||||
branch = true
|
|
||||||
omit = [
|
|
||||||
"*/__pycache__/*",
|
|
||||||
"*/tests/*",
|
|
||||||
"*/.venv/*",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.coverage.report]
|
|
||||||
fail_under = 100
|
|
||||||
show_missing = true
|
|
||||||
skip_covered = false
|
|
||||||
exclude_lines = [
|
|
||||||
"pragma: no cover",
|
|
||||||
"raise NotImplementedError",
|
|
||||||
"raise AssertionError",
|
|
||||||
"if TYPE_CHECKING:",
|
|
||||||
"^\\s*\\.\\.\\.$",
|
|
||||||
'if __name__ == "__main__":',
|
|
||||||
]
|
|
||||||
partial_branches = ["pragma: no branch"]
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
# Exact pins, enforced by the shared dependency-freshness gate.
|
|
||||||
crdt-sync @ git+https://github.com/kuhyx/utils@crdt-sync-v0.11.1#subdirectory=crdt-sync
|
|
||||||
jsonschema==4.26.0
|
|
||||||
pytest==9.2.0
|
|
||||||
pytest-cov==7.1.0
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Ingest app error and slow-wait reports for the todoImplementer board
|
|
||||||
After=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
ExecStart=%h/.local/share/app-errors/venv/bin/app-errors ingest
|
|
||||||
Nice=19
|
|
||||||
IOSchedulingClass=idle
|
|
||||||
TimeoutStartSec=120
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
[Unit]
|
|
||||||
Description=Ingest app error reports every 5 minutes
|
|
||||||
|
|
||||||
[Timer]
|
|
||||||
OnBootSec=2min
|
|
||||||
OnUnitActiveSec=5min
|
|
||||||
Persistent=true
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=timers.target
|
|
||||||
@ -1,601 +0,0 @@
|
|||||||
version = 1
|
|
||||||
revision = 5
|
|
||||||
requires-python = ">=3.14"
|
|
||||||
resolution-markers = [
|
|
||||||
"python_full_version >= '3.15'",
|
|
||||||
"python_full_version < '3.15'",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "app-errors"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = { virtual = "." }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "crdt-sync" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.optional-dependencies]
|
|
||||||
test = [
|
|
||||||
{ name = "jsonschema" },
|
|
||||||
{ name = "pytest" },
|
|
||||||
{ name = "pytest-cov" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.metadata]
|
|
||||||
requires-dist = [
|
|
||||||
{ name = "crdt-sync", git = "https://github.com/kuhyx/utils?subdirectory=crdt-sync&rev=crdt-sync-v0.11.1" },
|
|
||||||
{ name = "jsonschema", marker = "extra == 'test'", specifier = "==4.26.0" },
|
|
||||||
{ name = "pytest", marker = "extra == 'test'", specifier = "==9.2.0" },
|
|
||||||
{ name = "pytest-cov", marker = "extra == 'test'", specifier = "==7.1.0" },
|
|
||||||
]
|
|
||||||
provides-extras = ["test"]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "argon2-cffi"
|
|
||||||
version = "25.1.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "argon2-cffi-bindings" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/0e/89/ce5af8a7d472a67cc819d5d998aa8c82c5d860608c4db9f46f1162d7dab9/argon2_cffi-25.1.0.tar.gz", hash = "sha256:694ae5cc8a42f4c4e2bf2ca0e64e51e23a040c6a517a85074683d3959e1346c1", size = 45706, upload-time = "2025-06-03T06:55:32.073Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4f/d3/a8b22fa575b297cd6e3e3b0155c7e25db170edf1c74783d6a31a2490b8d9/argon2_cffi-25.1.0-py3-none-any.whl", hash = "sha256:fdc8b074db390fccb6eb4a3604ae7231f219aa669a2652e0f20e16ba513d5741", size = 14657, upload-time = "2025-06-03T06:55:30.804Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "argon2-cffi-bindings"
|
|
||||||
version = "26.2.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "cffi" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/76/3b/f7bd1daac24c7017b6d09d05c56bb3f71aaae76b2ac4234ed2c00e0dd2d2/argon2_cffi_bindings-26.2.0.tar.gz", hash = "sha256:f21ab89bb9850f32b9ca038d9961424bb0d3669d579cbbbfed068cffa6fc0643", size = 1792536, upload-time = "2026-11-13T07:16:40.386Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b4/21/d0e756a1b47b2674aec2919aa81096bb4143c9e3b912b9fe9e11d66bebc5/argon2_cffi_bindings-26.2.0-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:5ec171ae5e52691b5f111d815cb656a8142bedc1408c3db904d1a11df44604ca", size = 24273, upload-time = "2026-11-13T07:15:53.707Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/18/aa/149b2b67262a83f09895fe1aa0aa9c6ac688457f11449905ab007c05f133/argon2_cffi_bindings-26.2.0-cp310-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:92d65a0831e78294e19d7297d101eaa871033825ad2aa7cb87af2f706062acd7", size = 27232, upload-time = "2026-11-13T07:15:55.174Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7a/82/a9226c27133c26c7892ebc7b174304f81774a78c5b1e97a96e3c15b2cba8/argon2_cffi_bindings-26.2.0-cp310-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:2d475baecbcb506e40ab1cb05a84c9cc913a8950061a4045fd0ec0eb54aa7fa2", size = 26650, upload-time = "2026-11-13T07:15:56.269Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ca/24/38bd2a7706025d8c2134ee493c29855ea0a74754adad619e1e929fa09068/argon2_cffi_bindings-26.2.0-cp310-abi3-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:f073ba5029bfc847aac130b251120ed09a4fda3a3c7ac023294710351c080835", size = 27458, upload-time = "2026-11-13T07:15:57.374Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a7/89/e4325077a26a76ded84017114139e72af9d9845fac6574c307e08743080b/argon2_cffi_bindings-26.2.0-cp310-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:92629f581248269326aa4cf15974326ae0f3f141ad47e2f34100c5fea7d43083", size = 27186, upload-time = "2026-11-13T07:15:58.647Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e2/c4/befa5f3b4a7f2f988fa54e114a6e6abff8eac89ce78007e9658dd5b0118e/argon2_cffi_bindings-26.2.0-cp310-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:6b344daa1aec0fdfb3160eb2ef3f429914777288bff4097fc3e5e1e1e97c642e", size = 27643, upload-time = "2026-11-13T07:15:59.785Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7c/6a/6f7bfd95b496e2511906f1ee05bc87914187f9ab67b71ebc5bfba38ee223/argon2_cffi_bindings-26.2.0-cp310-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:df0374dd11e703522e9606318640d0cd37824264ae32c888d7f0cb4ce7aa00f1", size = 26838, upload-time = "2026-11-13T07:16:00.922Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1a/5f/957abb665fda517d96bc7e63a61cb52a6ecb4f14d395ca3a260c867ad803/argon2_cffi_bindings-26.2.0-cp310-abi3-win32.whl", hash = "sha256:b995a2d20c1725c92de86be8b0ce6c433b01b562ad3615530c8c04b6d3b6e9fe", size = 23953, upload-time = "2026-11-13T07:16:02.046Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d8/20/9c2ba6433cb58297b1bc8b14bfb5a703c8dccdee16c99c76ddfb66082aa4/argon2_cffi_bindings-26.2.0-cp310-abi3-win_amd64.whl", hash = "sha256:d2d4ae065e7cce4b286d3eb7c59128bfd11f8e407863b88629e9d391b864a3df", size = 25783, upload-time = "2026-11-13T07:16:03.152Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4e/a5/f98f1e2489eda5d3316ce031022531883d45a84774c7d26b7ffb93978894/argon2_cffi_bindings-26.2.0-cp310-abi3-win_arm64.whl", hash = "sha256:a2787a5f57dbf91a6435a896a31b9253b4a2e16063e2e68764d2a9e61b46bf4b", size = 25857, upload-time = "2026-11-13T07:16:04.269Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e7/1f/88734dfaeea3f3eca4d879b9232ef8795241a4640259f09c6a2fd2f37a23/argon2_cffi_bindings-26.2.0-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:1e61d4840665b8937d4a5a8741c2afd76b56de94319c634f7250b8d19291d32a", size = 15502, upload-time = "2026-11-13T07:16:06.403Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b4/8b/4e3c1d94f2e0076731af0aeacb8d97159dcecb6e44ff822652568e8e4349/argon2_cffi_bindings-26.2.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:5985328953da31dd3e48bbe0bd8e46d8b1dc11ecbbac7c9e743f1aeea2b5ba97", size = 24456, upload-time = "2026-11-13T07:16:07.588Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/26/e0/eb153e55ac74a12ed473c3d5adad88ef8cc49c2377b78c1d4b50011d74ba/argon2_cffi_bindings-26.2.0-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:38a730ae67462338896f84860daf90af506b9d35e56599ec1cb4e096afc0f185", size = 27362, upload-time = "2026-11-13T07:16:08.693Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/2a/20/05df4d4a9bd02fae832aedb5ce6aa1d3791163b167ae0a1a57ef853f5787/argon2_cffi_bindings-26.2.0-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:78c3f90627e34b45064f23ee4f76f629e100c92aadc64fca946bd87199297ca2", size = 26825, upload-time = "2026-11-13T07:16:10.297Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c5/7a/d31269cf7f2429cb960190bcadc573d27d948a6b5fbabbbcb54edd3e4e66/argon2_cffi_bindings-26.2.0-cp314-cp314t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:02086528488a85d374655e2f2f83fea03f49764587ac49d8e10bf6471df9f163", size = 27626, upload-time = "2026-11-13T07:16:11.413Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/41/94/b28583d91ff999365197fadab1dc00e1493ffa27fd61398050c6632519f3/argon2_cffi_bindings-26.2.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:dcb323dafcff4105ddcb7691b8b2aaac771ccf7ffab6932d77cc63bc20dc6d64", size = 27334, upload-time = "2026-11-13T07:16:12.497Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/16/cb/e0b13ce2795c16a7cb096c01a4cbf3568fefd3a25eb07b048e126854e143/argon2_cffi_bindings-26.2.0-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:2ed4524e0b397373b11358d9808436b6562ba1fe28ecc5d23305250989f2bf23", size = 27828, upload-time = "2026-11-13T07:16:13.534Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d6/69/02e4ea29e229e02d31b1e132b168a8d3b1a866229a11e7d2e8da0980d9e4/argon2_cffi_bindings-26.2.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0817f20fed8df025dd4347177158f38cf44c54544f53232a4cdcfe7fa6a13fa5", size = 26987, upload-time = "2026-11-13T07:16:14.621Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8d/70/32e55e0d1f6b9f1fd54f0069061dbcd749abe48e16fae1c51a6d8c4bb4c5/argon2_cffi_bindings-26.2.0-cp314-cp314t-win32.whl", hash = "sha256:d98134ca7f99f6b6b1afbfc5e0fe87375ee9b0aa0e30645729d8761b9ed5bce8", size = 24929, upload-time = "2026-11-13T07:16:15.762Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6e/2b/0ffed34635844d442fdb12a0092961f0e390e9762a2e359773bd9142ea4c/argon2_cffi_bindings-26.2.0-cp314-cp314t-win_amd64.whl", hash = "sha256:0771a338067f951844d2e8219472f4d30da498952c80f67a9c8e7b569e32d82a", size = 26711, upload-time = "2026-11-13T07:16:17.077Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d4/79/0adb06280989f75c0ded9c78b066553afde031e921618997e1a1efb285a9/argon2_cffi_bindings-26.2.0-cp314-cp314t-win_arm64.whl", hash = "sha256:cad3e53733c9382d09a442804aaedebf82d505502f9c6cedba336fd591959b01", size = 26857, upload-time = "2026-11-13T07:16:18.196Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/a5/75bbb0548ae95bffa4e192b587a767e8ed95715bcbb6e0131c2bdb3e07cd/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-macosx_11_0_arm64.whl", hash = "sha256:128796ea187b2ea2d240ab4c3a9d3d07f638c72bdb3341d4085bba1e95d85907", size = 24292, upload-time = "2026-11-13T07:16:19.269Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/96/9a/2e6baf2d40a25aa0f954d1c59df1d886b4ced60ba6bfd4af4c9992435ed9/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4fd4e255efdf1156415093db43270da540e3752b9496edf25f34bc64eb0eca60", size = 27241, upload-time = "2026-11-13T07:16:20.357Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0f/40/63a5f02cc09655207d004d33a9cda248b5f5fbc7b2ccccd81142817a06a4/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d1cf917a9917dafc5665d21745b9697d73a0678a82025f4d146976b3b4a0660f", size = 26665, upload-time = "2026-11-13T07:16:21.707Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/01/32/bbd6c60e7d13e0a52d5308e42388227a84569d67254e16fc4822d2979330/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-manylinux_2_34_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:cad283b6122f69fd8ff30b3c1d982db4947aa9bbb1728908321352fe74013fc7", size = 27459, upload-time = "2026-11-13T07:16:22.968Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ec/d7/b18cc175008afa10bc2ec1720e0aea6ecc602a185cc216ebc3c58db49ec3/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-musllinux_1_2_aarch64.whl", hash = "sha256:9c497363618d80c59533b21538a8475b6c83cd152ecf98e31339847a484b4faa", size = 27184, upload-time = "2026-11-13T07:16:24.083Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/31/d2/44fd5746db6b66372854fd33f55c3bf27fcc1d5ae50a4fad1c076963738d/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-musllinux_1_2_riscv64.whl", hash = "sha256:26c35612ae797817c9a94467df2d59d449253bc2a341bd81bcaeedcf2186ce9b", size = 27659, upload-time = "2026-11-13T07:16:25.185Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/29/83/849951df8a62f0094c61bde749289925c6985b27358b9ed487b526db9cd5/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-musllinux_1_2_x86_64.whl", hash = "sha256:0605c024d02be0896112f4dc90a896df69464c634ec578ef6b0fe6caf9777e69", size = 26881, upload-time = "2026-11-13T07:16:26.283Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/84/91/04067bac98f55bc9be663cc1442ea516b523d8ed658113c84d008313ccb8/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-win32.whl", hash = "sha256:b60f1f12567f86a7087b1c4edb2b673a1e396703d3b6137f13b1f6cea8e1473f", size = 24745, upload-time = "2026-11-13T07:16:27.446Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/39/b9/2799f5dda0bc7de972901321ba0faca8536b125afb1d71002170405c63d2/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-win_amd64.whl", hash = "sha256:9f9f0215ddc8638b2003f8e8c5b0c378e0e976869c40911ac015f375a60fcca4", size = 26522, upload-time = "2026-11-13T07:16:28.538Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6d/ed/4177677a981464afa55c324ae575cc6b9752affa8668acc40eb6899f98fc/argon2_cffi_bindings-26.2.0-cp315-abi3.abi3t-win_arm64.whl", hash = "sha256:1a525e093acb8dd2cd85317577271251be1920ad4d1e5a05bffde9c7a53290cd", size = 26646, upload-time = "2026-11-13T07:16:29.771Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "attrs"
|
|
||||||
version = "26.1.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/9a/8e/82a0fe20a541c03148528be8cac2408564a6c9a0cc7e9171802bc1d26985/attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32", size = 952055, upload-time = "2026-03-19T14:22:25.026Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/64/b4/17d4b0b2a2dc85a6df63d1157e028ed19f90d4cd97c36717afef2bc2f395/attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309", size = 67548, upload-time = "2026-03-19T14:22:23.645Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "certifi"
|
|
||||||
version = "2026.10.23"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/fd/11/b524cbd9bbdaca58608e4cf4053fd463417549e1959fa8d3aa18319f9555/certifi-2026.10.23.tar.gz", hash = "sha256:a9895e6e2758b371e0545e321a3a8fd1fcfd9829ada8824a936dfb16aaaf36cd", size = 136225, upload-time = "2026-10-23T11:36:16.478Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/32/d1/a3652fe2c19134d0d15922177821d863cbd7e842d53a21bbe7e8e3a1b5ac/certifi-2026.10.23-py3-none-any.whl", hash = "sha256:e9b54de76e530bb6cf0ccd036787103acb58fd42ba930ea8bf948ddbaa2f61d1", size = 135082, upload-time = "2026-10-23T11:36:14.763Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cffi"
|
|
||||||
version = "2.1.1"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "pycparser", marker = "implementation_name != 'PyPy'" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/9e/ef/008a1939e372c06329a3fce4279c02f328488f3526744906eeec3da7ad5f/cffi-2.1.1.tar.gz", hash = "sha256:dd31f52ea1086513bb9df30f8fcee9b8918323ae067a3d5b78bc826a000712be", size = 530807, upload-time = "2026-08-03T21:21:18.939Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d3/7b/d6bbf82b8b96e7391438898c42f5bd96dd02030fd5b64937d248220003e2/cffi-2.1.1-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7dbb61fe3a7699468030f71bbe5f8a0e326a151daa91beb11a6fc1f980c55e1c", size = 194064, upload-time = "2026-08-03T21:20:17.148Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/94/e6/bcc91b283be94735e268487a054004f0aa19947b6348fa367db53230abc8/cffi-2.1.1-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:f24fb43132a4c6b4cb4eb029492919b2db645be6808d738f244fd146c03c32cb", size = 196720, upload-time = "2026-08-03T21:20:18.268Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d9/99/c4b0c17cacdc9c3b8f280026286a9826d6a208c0f047591a3c3ce99b91fd/cffi-2.1.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:d28630f5854ab07ab1fd4aba756de52326c82e6be15d414b12793f1975048b54", size = 184964, upload-time = "2026-08-03T21:20:19.708Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b3/a9/9db617d05d7367c1ad0ab00b3aa6e6f9281edd689b4ee9ea0e5a84e89c97/cffi-2.1.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:661c298b4821edebead0c91edd2b00374d67ad7c5a1f7a91d4442633b79d6a72", size = 184962, upload-time = "2026-08-03T21:20:20.833Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/67/b8/b42132ca113dc567d37684437b46ca1dafc885902b02a110a02d5b511857/cffi-2.1.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:58acb8ab8e295e6c5ea12f888cbb13cf21511ef2a3303a23f4325c29d17fe5c1", size = 222328, upload-time = "2026-08-03T21:20:22.118Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/80/10/c5c0cbf0a657aecf59ef511409734230bf556f05a0d6c9eed7aa5c0a0166/cffi-2.1.1-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:456a61fa52d579ebf9df2e9552ead5129855dbaff6c1e5a9b1bc408809bdc062", size = 209985, upload-time = "2026-08-03T21:20:23.401Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d5/6c/bfa0b87b03b9238148beca990292843c9396ba069b54496596594173de7b/cffi-2.1.1-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a4f00aa42f75d6e4595e8866e748cc1705adc0cddfeb2ca86d0d03993d63ba03", size = 208530, upload-time = "2026-08-03T21:20:24.628Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e9/02/4e7d553a7ac4b4238b38b3c1b80d486e9d4436f8d2acbf87a0997fe3f402/cffi-2.1.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:b0431303acaea1089ad4b3e9ce4e6518193def1118d4073ca848635ee4ea2e96", size = 221525, upload-time = "2026-08-03T21:20:25.758Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/82/1d/a4aaf9babd75acb4d5f223bff71533bee748dd770a382619a798960ee9ba/cffi-2.1.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:64faea20f4e2613363a1a9b9c7dd73058f3ecd00133a511e72ad7c511658f527", size = 225053, upload-time = "2026-08-03T21:20:26.985Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/81/10/5dc0e7bdd18e22107054288283380fc97a06ae3f1656a106908d666a3c88/cffi-2.1.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:5c58fe613dc5e5336357eff555824a314d8e43282600435c8d1cb6a7a2fedd13", size = 223213, upload-time = "2026-08-03T21:20:28.277Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0b/e9/d0061c364cde06ee43168a0d076ac1da512cbc380d44767b844ba34fe2b6/cffi-2.1.1-cp314-cp314-win32.whl", hash = "sha256:1a18a57b58cfb21fc28d72e876acf10eaed67a1ed96226f92af4df681d571c4c", size = 177682, upload-time = "2026-08-03T21:20:44.288Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a7/06/1c3e01e3ba14c39f6d10bfbac52753b7e22259e38088e5cfe1d704918690/cffi-2.1.1-cp314-cp314-win_amd64.whl", hash = "sha256:3222ba5d678f80a030e6afbcc33dc1ae5cb45facabb61cee2c7016b8432fde48", size = 187949, upload-time = "2026-08-03T21:20:45.623Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/87/5b/da4e39efe18eeb89cf580ea9cfc66b6a7c3eadb808fc0cc1d3a295cb5a5d/cffi-2.1.1-cp314-cp314-win_arm64.whl", hash = "sha256:ab36d55f9ed2d067327667c2fea18dda018eb628dd6347aa01dda6cf1f5d3836", size = 182947, upload-time = "2026-08-03T21:20:46.955Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/23/59/40338bf421c5accea1d45158170c87006ef1cd371b05c077e76476949728/cffi-2.1.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7750c6449dff7864bb9bb27ddfb0267756189201a3afc911d82b3caacd70dfc3", size = 188504, upload-time = "2026-08-03T21:20:29.495Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7d/47/5ecf1023850036e674c77ec4de86182d309ae344e39e7cba984b7df5d647/cffi-2.1.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:0beceaabe56af686895136a2de78db54ecd8e4046b236b8fd6d6cb61389e9bf2", size = 188259, upload-time = "2026-08-03T21:20:31.291Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/2a/9c/92934c3bea9f785b23eba304538c0b4d37a2a96d2431eb3a1bc87a11aa19/cffi-2.1.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:49cbc70e6542d4ccccb936558d1064a8012541e78f821f955cff24e357776c94", size = 223864, upload-time = "2026-08-03T21:20:32.571Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4d/45/ba4c93527bc38616a8bd36488acb69a2212d60486794f0c1f318949bbb76/cffi-2.1.1-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:e2d65b31f36619cda3999b78b2aa9632e76b78448e7a56fc4240824200e7c4fc", size = 211538, upload-time = "2026-08-03T21:20:33.808Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/80/e9/b6ef565e452acb932fb0cb5443f44a78efbd1233e566f02b5a83855e9115/cffi-2.1.1-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:28907ab9bfb6aa13184cfc17c6b8e1023c5ab6fd7076d8c20a35e59fe04f8f29", size = 210688, upload-time = "2026-08-03T21:20:34.974Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9a/95/eff5f0cee78d2eabc7eebffec40d3fc1876b5f3c95582e018bb4b99601f2/cffi-2.1.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:51b31d1c98274844cfd7838ce00bfc27c7423a4dc00fc0772fc3331c2cc90676", size = 223803, upload-time = "2026-08-03T21:20:36.564Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fa/01/579d39fb8bef00a335a23d83757b44feb24cd6345a2c451b64cb67b9c362/cffi-2.1.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:5e7cecbaadb83884793e05828cee59b210b24583b9c7425d0ba6a754fe22eb4e", size = 226763, upload-time = "2026-08-03T21:20:37.816Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8d/b0/0b44f47c60b01b57b6e2bbd92343f13a85a1d93bc46ccf6e47e244acd99c/cffi-2.1.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:25792eac27877609e7bb06d42ff88278a6624fff2ba9bbb523c09616b117e80f", size = 225688, upload-time = "2026-08-03T21:20:38.959Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/eb/d2/3b7176cb570a1d3e27faf67b72f591af508036e0d8b2be2ef9af9e8c84bb/cffi-2.1.1-cp314-cp314t-win32.whl", hash = "sha256:8ef53b2de9bcb9197d31854256575d59dbac0cba72ac627bb291ef5eceb74be4", size = 182868, upload-time = "2026-08-03T21:20:40.388Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/56/78/31f00c1bcd97c9bbf55f1bfdf5bc809a5de8887473e90bb9960dca825e80/cffi-2.1.1-cp314-cp314t-win_amd64.whl", hash = "sha256:616f097f2fe415bc92a247f02e11f634e1f9e9a83d327e3c915c15089c87869e", size = 194104, upload-time = "2026-08-03T21:20:41.725Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7b/1b/58496f2ed0a35de575250c02a43ab3cc2c04d494a88fed31c1cabc0fd176/cffi-2.1.1-cp314-cp314t-win_arm64.whl", hash = "sha256:ad2c86c495b899d862ea0f4b42891b8713a3bd45dd4105c7fd51c2a72f39f3a5", size = 186402, upload-time = "2026-08-03T21:20:43.042Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c1/8f/9ebe220eab48a093d1a5a5e339ab0dc7316eef3bb04d63c42f0251b61f50/cffi-2.1.1-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:dddad92b554513a31f272570678ba307fb9f618f05e3d4a5eacafff9eae03e1d", size = 194043, upload-time = "2026-08-03T21:20:48.179Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ff/69/844bad3ece306c4782c2ecb93597035b6690d48704b803914c199da1e8b3/cffi-2.1.1-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:da0e573f9f97159390c89d9f1a9e41908b66d408cc5b58d08cf3847d844c531b", size = 196737, upload-time = "2026-08-03T21:20:49.457Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1b/8a/af668013284634733f02d683458a0728739c7d6ddb5e14cb0c20832266fe/cffi-2.1.1-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:fb92203a88b3d3053034db775110081c49d28be6551923805e039924093761e4", size = 184933, upload-time = "2026-08-03T21:20:50.639Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0c/75/2f5207ff6d1a613133b23a5203cc0c2a628313b5eb3974d7956ae3c57950/cffi-2.1.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:2ae64be792b8966f2c69538199728b290e34726562896df1e5dc8ffd8d8188e8", size = 185002, upload-time = "2026-08-03T21:20:52.173Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e2/31/9e1313b0a6e30e91b3b3d3fff51ae99c857c07738e3afcce1f7334e1b7ab/cffi-2.1.1-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:507a24c282e0f42f8ed737cf048572cbf580468da5555764a8331735e9c736b6", size = 222271, upload-time = "2026-08-03T21:20:53.462Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/50/e3/f6234a833e6e08c7007003074723c406559eecf9b48dfc97471e5a8eb7a0/cffi-2.1.1-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:246fa40ce8645a614ff682e0b70f37134e460eaf93a775e0cbe3cca585a67a80", size = 209919, upload-time = "2026-08-03T21:20:54.783Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0d/fc/5f74e293fced6edb51af3a46c4ccf6c23c9943774ecb375ddbd522c76add/cffi-2.1.1-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:471cee653ae88de62096552e6d24ccb4a5adb8c8c9f10b5054d0122c15bf2779", size = 208529, upload-time = "2026-08-03T21:20:56.066Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/44/16/29e6d01b388bef055ecd6ca8244b3f4d336bd09e92d5d892187b9601084e/cffi-2.1.1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:aeae0e330c9f6acd681f647d46cefd30c29f93e3392882e792e82080c9691399", size = 221630, upload-time = "2026-08-03T21:20:57.336Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a4/18/fa7f1f6857d5eb88a4ca99ffcbfb7c387a287ccc154c64a73e86314745d7/cffi-2.1.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:42a494cee34437f05546455144f2b5d9ac09b1face62bcfce597d2e521066688", size = 225134, upload-time = "2026-08-03T21:20:58.675Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e0/9f/e8e3dfa04a1b4c241f8c91faacad872b4d4efd051d49764ad4e2fd4b9fea/cffi-2.1.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:cc572dace3f60ef98d7b12ff411d20f5362feb31a0439eab0085bbfd349982d7", size = 223197, upload-time = "2026-08-03T21:20:59.968Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f8/7e/8debeb04f1ab9fe2a6963964cd6f1aaf7192627b83926586a6a4e089c9fa/cffi-2.1.1-cp315-cp315-win32.whl", hash = "sha256:4f42141fc14250de6dde5ee7ea4432be017252d91f19c5ad043c084cea629cac", size = 177683, upload-time = "2026-08-03T21:21:14.901Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e0/31/5158704cc474ab65c1647932e88be78dc0873f47130e253be38bcaf13d01/cffi-2.1.1-cp315-cp315-win_amd64.whl", hash = "sha256:e6e8cff14d6fb0be70a09c0bdc58096f501952d04624ebf867e0e56da2df8960", size = 187897, upload-time = "2026-08-03T21:21:16.108Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/cc/4b/b3a2da8570c704ffc0f9762cdc3ec0f02c8573798e0b5cf7f11c82bbb70f/cffi-2.1.1-cp315-cp315-win_arm64.whl", hash = "sha256:27350daa11d4f10c540e6e89dada4c54feb7256ad03e9a4dc075ebad7ba360d1", size = 182935, upload-time = "2026-08-03T21:21:17.271Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d0/ef/5443574510a1207e6f6bc38ba6e1f1de36cb48fef07b2728bb896a21f430/cffi-2.1.1-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:c26608d2222fb1e94487e4a387d85f13eb55d5ed725cb25a0c589ac4ee60e7bc", size = 188464, upload-time = "2026-08-03T21:21:01.163Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7e/ae/a56fa8c4686ad50e148fcbc8d3ae0d03915ff5c30d795058988c24118cef/cffi-2.1.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:4be96343e422f2dfcd12ab5c9f5aebe03f82f737c6bffeca6830b3875cb44aab", size = 188262, upload-time = "2026-08-03T21:21:02.382Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/53/b2/6187f46f2912276a3ae284076109cc5c8680482f11f766ccf26db4a86427/cffi-2.1.1-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:937c0052c05a31ca1daf18de3158eed4dbfcb9cc107adbea227728d647be701e", size = 223779, upload-time = "2026-08-03T21:21:03.553Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/f6/c3ad28bd19f77047a03084424fbd4cbe997303267c14423737324be0385d/cffi-2.1.1-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.whl", hash = "sha256:df423d40ee8654634421812bc3b196da3f9bd7d32929da813f8394c4348a5358", size = 211520, upload-time = "2026-08-03T21:21:04.863Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a0/cd/ccac9013a5bd9fd764de118674ab9c805b5ca10c19270d90ee273f8b2240/cffi-2.1.1-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.whl", hash = "sha256:a730a083190634c65cca36ba5f489531576ebd79bcd5c8e172130f6453127231", size = 210673, upload-time = "2026-08-03T21:21:06.223Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/52/86/2976131c639aead931c5bee5aba67e4b09fbeb8018b6f282f70803f923a7/cffi-2.1.1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:363e05fa78e15116c3c32c210ee36884fd6b9afa6d440e47112c3bd511d64cb6", size = 223835, upload-time = "2026-08-03T21:21:07.539Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ac/0c/33a7aeab2f9c76918c52e084beb39c570db3588133412929e8ec06fab90b/cffi-2.1.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:770de9db11e84213beec501cfcaa013b019820ca881e03344dea5844f7876d94", size = 226705, upload-time = "2026-08-03T21:21:08.774Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e3/26/2cde30fdde421130bfc18f70395731a6e6b2053c6a1978a5258ff04e72fa/cffi-2.1.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:7da0c5eff80f0197f3b3d1232ec5a682a9325f4ae9016a78f5f5ca35f9ced1f5", size = 225539, upload-time = "2026-08-03T21:21:09.911Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6d/cd/a361394c94b2129d604bb846f624a8e88255a3ee33129c434a00d715e64f/cffi-2.1.1-cp315-cp315t-win32.whl", hash = "sha256:06c72bb76605a4b0cd0aad6930b69d4baf7dd5d806cfc409b824191099700e66", size = 182707, upload-time = "2026-08-03T21:21:11.226Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9b/b5/ba2b299993c26577d529b6ae29841f9e15b9fcf004d65f423f4fcf94ade9/cffi-2.1.1-cp315-cp315t-win_amd64.whl", hash = "sha256:d9c275eaacd24aa73f94ffd6de08fc3f932424d8b6c376f4bed7cde376fe7bc3", size = 193772, upload-time = "2026-08-03T21:21:12.39Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/aa/29/35e016098c814cd93de9cd320c66b5bfba14dc6ecedd3cb518fa7c408c69/cffi-2.1.1-cp315-cp315t-win_arm64.whl", hash = "sha256:d18e5ac0f2f03f4f518d3e23db0f0cad7faa1da8620e9c09461d443bbf6e6692", size = 186360, upload-time = "2026-08-03T21:21:13.636Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "charset-normalizer"
|
|
||||||
version = "3.5.2"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/33/1c/f41d4e74c28ab327ff3acd36053f7ea506c55872d7a90b0fa71aa3ab0c89/charset_normalizer-3.5.2.tar.gz", hash = "sha256:39de2a259fc954455c57274dc94c79d5842774e1247a016aff30bc0efed0f4ef", size = 172659, upload-time = "2026-09-30T04:39:23.398Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/58/ca/7aa91362a2f77ac8e9e28a9b902a74f7d0e11a851ef0d27a74308da8cd90/charset_normalizer-3.5.2-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:1afb975bd5d68d5ce9f6b6d44fdf2f7e34b895a35e95708a7a91b20a3b51d187", size = 226010, upload-time = "2026-09-30T04:36:27.669Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a8/cf/ac8878d0322cf88a1aad4c7b147db32ca0bd806eb0060957b2e31486dbe6/charset_normalizer-3.5.2-cp314-cp314-android_24_x86_64.whl", hash = "sha256:bbbfc8e28816f19d7c0f1816664980c0a9875d01b27cdf8eedddb639d9e108ad", size = 239266, upload-time = "2026-09-30T04:36:29.434Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c9/6d/9a08d7e0b29b7208e2c6c01dc56c8e0520e7c7beadbbfb024b58fd69c8a5/charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:7967d08cf06dee78443b874f98c98036f624f3a4e73e11f9f64f5be4d25393cf", size = 206783, upload-time = "2026-09-30T04:36:30.872Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/82/44/b0aa350280e6ff5a5492d17cf10460dd39d5ee848f872f7ba2df10607f60/charset_normalizer-3.5.2-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4c2b5031f63e331e3839b40aed2dd6f191e9c07edbde303e7876846ea1946995", size = 210449, upload-time = "2026-09-30T04:36:32.625Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7c/8a/40db9aa9f5907bb0e6f8b6d64064bf8852fb33d4b813ff9414911df7647c/charset_normalizer-3.5.2-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:fcff63213e8e6e47770541a4607175404f47cbb3ebea7b6058cc82d524a0e424", size = 367815, upload-time = "2026-09-30T04:36:34.197Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7f/72/9c5e7707b57c8ddfa9ddf7b0b1d009d7fbab9e9e887d5b721060f37e307d/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:8d86d6fc60743dc916eb79e2eb1ec4818e21e427731543af40a3021851174a13", size = 247095, upload-time = "2026-09-30T04:36:35.803Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/83/09/71e453691e927de4ddf792770cfaab3f49d494e222f66ea5e404bbd5e39c/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:7a881931aa470808df94a8c380eed2bbbc76cd9dc622310f99665658c821eb6d", size = 233942, upload-time = "2026-09-30T04:36:37.407Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9f/86/85c84e4da8b27dd409577d9437926ff581c5f9d3c66038dc68c1a526de51/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:8024d00c3faf3fc0c16e07a69f4405e8eac7cc0ab15f65fe6cf43827c4cf72b4", size = 273762, upload-time = "2026-09-30T04:36:38.904Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/92/08/564955a4b5f2ccb410ab480bbe8c6a18063ff27f2d35458731c4a5335df9/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:4d48f2d08b9de5864e2c8744d4461b862fb149a18274abc8b698c45975573438", size = 269514, upload-time = "2026-09-30T04:36:40.469Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/18/24/bad3ac4271589df29cf5ce2f5ae490518a5739358052bd0d61209e6fea54/charset_normalizer-3.5.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:34276fd796040bf0993ab33a369aa572e6979c7aab225a88893667ad8eac8f7a", size = 255056, upload-time = "2026-09-30T04:36:42.02Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d6/3e/350d89ad49916b86554d6f5f2d03ec1152148f87e5ff735106c6a03b1a36/charset_normalizer-3.5.2-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0521c5665880b33d603717defa76c094048900010897909952397feb3039da56", size = 251311, upload-time = "2026-09-30T04:36:43.577Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/56/5b/4970a2d154df502e133402906dd04e3ae7cada7b3011283c88d0479a2585/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:eff0ac9dbe711a4aee69bf04a83896aa9b85f19641264053a9f6d48573abb7dd", size = 250190, upload-time = "2026-09-30T04:36:45.185Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/88/8c/f1a91bddc8fb47c2889e29ea7ea49a194eb0d9868675d786806519c00d76/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_armv7l.whl", hash = "sha256:1503bccbeb36d5527790c3930327704c39af22de3112f1b1666a9f3ce15ee204", size = 237098, upload-time = "2026-09-30T04:36:46.689Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/24/0e/bb5dace3cc7e79068425386a6589c19b5a2ab5fefc2a46abea6919683332/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:52aa6992700996af31f375de0c6bacd402b0097fe40b53c426b9f51a90ebabc7", size = 274228, upload-time = "2026-09-30T04:36:48.31Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9d/79/b849ad523017ea9f5a45581bbebed91439e0cf42fd2860a6f64e358eb5a6/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:e09a3942ecbdee5cce73ea9d42da82b81b72ac1bf031ce069b93b5adf4eac8cd", size = 252401, upload-time = "2026-09-30T04:36:50.091Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/89/8c/75469d690cf47200bce8f6cad7655724fc23148e147abfc5ce78b5f65863/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_s390x.whl", hash = "sha256:c7c9ab723cde841fefb34efbad91e87f00a674b1fe1cd0784fde742bf2c154dc", size = 271846, upload-time = "2026-09-30T04:36:51.719Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/26/cd/6d52d3c7437cdcf2e310ce9f28f282e733d4ef60ed19105d1819c356255f/charset_normalizer-3.5.2-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ddc7dacc8ece3a182e7f15cb862d1fd616b46d076cb1ae9dd232b2c38b655874", size = 258151, upload-time = "2026-09-30T04:36:53.234Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/4c/070b38bdb5f49a70199fce923ec0726a49536a63ab262abbfcaaf351110b/charset_normalizer-3.5.2-cp314-cp314-pyemscripten_2026_0_wasm32.whl", hash = "sha256:ee43c17b173d46a3212baa6ead3ae258eeabdae48c263a01ccf0218c366dd655", size = 143570, upload-time = "2026-09-30T04:36:54.816Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/81/84/9ebfc8ed6c8c4fcd8e726ff6bf220cc8deb3966e31dce9be8dd8aa017e64/charset_normalizer-3.5.2-cp314-cp314-win32.whl", hash = "sha256:4f87960d57feabfb618e4e0af6e7371645fa26a277860739d6e5d6e0012c92f0", size = 186412, upload-time = "2026-09-30T04:36:56.643Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d1/78/5ed86f743d4bc350db307e7636419a0a5ee1d91806d30c7f667bd5c80dae/charset_normalizer-3.5.2-cp314-cp314-win_amd64.whl", hash = "sha256:e4e81e09c1578b8df602e3db08b0b3ea0a6947ad612f52bf8dc5ea8d47691f0c", size = 210965, upload-time = "2026-09-30T04:36:58.205Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/53/94/a3a7698e9b1a395e1eb99ccd9a324be9347973bff4e72db2a06496d7cd27/charset_normalizer-3.5.2-cp314-cp314-win_arm64.whl", hash = "sha256:80d02b6f04e92601a081dd97b23d3128033098bff5d35d392ddcc0476ea11253", size = 200406, upload-time = "2026-09-30T04:36:59.764Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c1/48/c5dd00d5ef7791f02666de250a5bb6071e29b7e133cf4b835800b6d3bc27/charset_normalizer-3.5.2-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:dca9ab98072a5a54ebacebdc45f53e645336b320c667410b061be1ca588ae709", size = 396871, upload-time = "2026-09-30T04:37:01.543Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/12/c8/8379554b42e8368161d898476686947a0fdbd3e8865170d7909dcabfdee8/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:f0aa869112ef88429ae17820d99c3dd9504c9e9c671d3c246f3d7442cb051084", size = 249711, upload-time = "2026-09-30T04:37:03.111Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4a/eb/2ddb1035d17320caa9f41682935123a9a250277b261c3efc86b2d2a21343/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:c0afc6800ba57ccc350374c5bd6150419915d95ce93cdbab2d783d75eaf30ecb", size = 231146, upload-time = "2026-09-30T04:37:04.721Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4a/24/2ecb4bde104322cd7859d6594fcfa74649f8d90b3221c9feecbef149875b/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:7dcd882da75ef9adf94903b1e3b9419e8aa8fb4c7396822b834b9ef7fb96954f", size = 271552, upload-time = "2026-09-30T04:37:06.295Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3f/98/9d5f6ebc3aee9fef5d30b4aff11fb2ab7a1222b4064f8ef2c7c87cde217a/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2e06a3a98f916dd41d27f3105e02e7a40181c98c94b9158733d03a6f80506c09", size = 269810, upload-time = "2026-09-30T04:37:07.905Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/09/e1/a3b06a10461b1b7628853c934c644e03bc28e42767116afb52f19a56519b/charset_normalizer-3.5.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6bd128f206a7752ae1f2ab6c61bf8a24ba28913a10df8b14c2637b973ff97a80", size = 259845, upload-time = "2026-09-30T04:37:09.554Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fd/d3/6f561f74a296cf27d61775a1dc665ad13f3bff6a798810ca05907f37a7c4/charset_normalizer-3.5.2-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:c8f3d67aeaf55f017982b73683f0e7342ba2f6635a78f69ce89ebb26aa411e5c", size = 252825, upload-time = "2026-09-30T04:37:11.274Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/26/9f/69e13ca3b18f43e0eafcd34c04a45b732ae22a43b54a5fc9e119103356eb/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:fe9753dfee015c570d73df76f899f18444d41388bffcde097deba51c4fadbb9f", size = 252659, upload-time = "2026-09-30T04:37:12.941Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/73/a9/ace29806a0dae18939919c76ba526472d83214afa101105fabff2cf30625/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_armv7l.whl", hash = "sha256:92888bb3187c5ba50500b00b3b310c9f2c651709d28036077680cb5255450a03", size = 238819, upload-time = "2026-09-30T04:37:14.659Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f8/c1/6116d52a2e3311ec80f21f5fb5e17b27405f10b9608af8f6e69516841a1b/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:d008d90a7f2471519aef0c90dfbe73b3e6e4d5e66ac48e19154c17e89e98b604", size = 272973, upload-time = "2026-09-30T04:37:16.346Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/19/aa/9955c7e93bba10a9c7e8f7a5031b7ced66f3a1883a55c00712b8d5850ff3/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:31f3930700408d211f13378ccbe1c40845d8da54bd0681fac3a9b5aae81c7aa8", size = 253692, upload-time = "2026-09-30T04:37:18.212Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/bb/33/2a6ae7fdc1b10cb581cef91addd8cdfc5f40d50abb5702309369d5834579/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_s390x.whl", hash = "sha256:2a925889534b3748302dae5dead07cc13480de1dac3aea80a941b729b471ef93", size = 268757, upload-time = "2026-09-30T04:37:19.877Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a2/22/80992720a0282cd39bba1db35868e6b9c22f41281160143a836544bc1d8a/charset_normalizer-3.5.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:f5ec61164adcec446f8969a3358ec3f9b26bbda3b9213e5586d219afa8df2915", size = 262220, upload-time = "2026-09-30T04:37:21.583Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/92/9f/181fd07e1bffea1d95cd80c84ac537354f50699c22cfc4d3c02b6fc16208/charset_normalizer-3.5.2-cp314-cp314t-win32.whl", hash = "sha256:598a11a2c7ebaa5334bf698bf29568c9c390abac6a154d8170fedecd1cea38c5", size = 197797, upload-time = "2026-09-30T04:37:23.235Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/49/1c/25d8415ec1c4f2f41f1680435e4c87cfb378ff2f677d950946f2a45d0632/charset_normalizer-3.5.2-cp314-cp314t-win_amd64.whl", hash = "sha256:7fdde2c9fd9e3eca40631e024664cf2584272cc8f96308cbe5fdfc930f51d8bc", size = 222765, upload-time = "2026-09-30T04:37:24.891Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3e/b4/46b48f013dadfc0d0d33b375438e31bdf5a989dc68389c6bf627054d4df9/charset_normalizer-3.5.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d1befeed746d247c81127bb14de9dc3d30edb6e5976d34f83f86ed262b1d9105", size = 210985, upload-time = "2026-09-30T04:37:26.634Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ca/e9/34e597dee616d0b8ee4b34d29399e85c2204ade174157a48505d42baa4ff/charset_normalizer-3.5.2-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:87475fabc8d9996fd9c27debb395e642e8c838d78a00b6e932227a0e06b81e26", size = 367676, upload-time = "2026-09-30T04:37:28.329Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/60/9f/a5d1c91c0263745e2cd344c5a4415d787c575501ab1d449f1148ac6b495d/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9409a8bf35cf78353942504b24a57de3d75b708997a1e4bd8db71ac8633ce364", size = 248414, upload-time = "2026-09-30T04:37:30.167Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/26/79/e697f77464748a3ee3cf490c83d592459400d4898380d66c38366b03080c/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:498dc3188ca05a68231ac3fdbfc7f57eb67e1343c30e0fea17f8218c1599b253", size = 244775, upload-time = "2026-09-30T04:37:31.964Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ca/87/3d42a42e18ea066e2513936fd678a00696e77878b5ae04528976abdbcb83/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e242bb1c5e76e97dfa9e7f209a71e93a01d7f19ffdd5cfbb2e2d55b4f08f8ab0", size = 273877, upload-time = "2026-09-30T04:37:33.661Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c3/76/8a28136f3938ba9836f84280ce0c4d61ed1cf15a036b2034900c62634162/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:def79fa35ef0cef8d2accec024f4fdc7ead3012ff02f5215c783f39f03ef8cfc", size = 269455, upload-time = "2026-09-30T04:37:35.573Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a0/a1/4fbf5d0f0f1b2a080474c1cf9a2f12c4c6531bb0e8ba591055e846d2b4e9/charset_normalizer-3.5.2-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3df041de8887954562c9b261cba85ca0e9ded74048daf125f45edcfaa4832229", size = 257336, upload-time = "2026-09-30T04:37:37.397Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ba/a2/8b50aa320adb880ad579518e6f718f24944804b42a88b83d267d5d444125/charset_normalizer-3.5.2-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:04851f73ae72b8413dddadb16a49dfee95263553741fd42d546f7d66907e6be5", size = 257584, upload-time = "2026-09-30T04:37:39.522Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a5/57/50e3fed84e175f40349bd0da7a4fce94c87f0378f52d74f511d89e0bdc20/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:183b88127acdb4fabe59d951ab424faf1af7b63cdbb5f776186c1ea2ffcaed98", size = 251854, upload-time = "2026-09-30T04:37:41.23Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d6/54/f7fbb3493c9f49091213b9c2d6dd65800696f1ce1a3f196a4205f50417b1/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_armv7l.whl", hash = "sha256:16fa0eccf81304b79c5cd87f9271c3b85dd9dd99245e4422ae9c0dd45e0f99d3", size = 248767, upload-time = "2026-09-30T04:37:42.883Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d9/37/b3a6385acc5a1e45b39ae9c90bfb9cf838a09b9dd37ef2740ab4c6b4a2eb/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:7441d755b7ab94f8d4eb3e43ec05482d760842fd263d003a99102d742cd835e2", size = 274479, upload-time = "2026-09-30T04:37:44.658Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/89/44/809913e2cfd279e635a9294fdbbfb1b1dc62a8189d473d561f649fce98d8/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:ca403d7e4798f525fdfc78e258820419cbbd0f0ecbab9de7840e3c017cf6b8cf", size = 258310, upload-time = "2026-09-30T04:37:46.529Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/af/a2/f28400ab13359d91bd39179df8e149376b9bf36588e739a3a4f9de2b84b2/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_s390x.whl", hash = "sha256:df29a0a7107f7011e77f4eebdddec4c7331e24d787a0b21a46d63bdf7445da95", size = 271100, upload-time = "2026-09-30T04:37:48.399Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e9/89/9bab37955edf0adb3b66f8a3a6617d9f2f487e0d56f295a6a286cb640aa6/charset_normalizer-3.5.2-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:f3c96f633825733f735c5a9cf21d21a257d8e1edf0b1cee0a064b9c424ca0f7d", size = 259936, upload-time = "2026-09-30T04:37:50.023Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/23/b5/4459e08d45a679f903d50fea08bc52cfa728cca4d7bd02c757b5e5abda2e/charset_normalizer-3.5.2-cp315-cp315-win32.whl", hash = "sha256:281cb91036248400f4cc957495cccd44c275c2e0c5854f7e45ac5cf7dc193847", size = 186301, upload-time = "2026-09-30T04:37:51.722Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/98/e8/55d5fd3935b4bce6da4fe0df61898e8c82653e317e677bd58aceb9c60f13/charset_normalizer-3.5.2-cp315-cp315-win_amd64.whl", hash = "sha256:89b53f3cda69831909888e0494f4fa0bcd3537e3e138dabeb620bd6ad946bae8", size = 210858, upload-time = "2026-09-30T04:37:53.427Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a9/5b/974423c2fd8e524c7a7f64318c1e02240ef954912fa2b4d70344107b9c68/charset_normalizer-3.5.2-cp315-cp315-win_arm64.whl", hash = "sha256:6be488a102b8cf28d0391d8c4ba7748938ae28b78ad901f8585520fca33ead1a", size = 200309, upload-time = "2026-09-30T04:37:55.015Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ee/f9/00ee0195db1013d8f7c416fd770fbeb560bb46eb2e36b054d05cb56f6cfa/charset_normalizer-3.5.2-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:915563965d418f986e7e145accc592eae9e1a1be3566ff98a05d7a9ec42a76e1", size = 395343, upload-time = "2026-09-30T04:37:56.743Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/04/3a/c00b50e94c964cf934c7899cd47c97952fc11dad71cc5884b3c61795b09b/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:65cd72beeeca9d3aaea1201e5923859f308f952f9c71de93f06063c79f0f7a3b", size = 250114, upload-time = "2026-09-30T04:37:58.607Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/50/27/d102dc880bbcffd0479ab64dfc1fb96777a854355a55e2bda72a71efadcb/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:b7fd005a73d9e657273b7a10dc71a9e03c8fb9ee6999798d6918ce095b81ac7f", size = 239997, upload-time = "2026-09-30T04:38:00.511Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a5/4a/bf7ef45794dd293fab5f98a9309817977fbb845b9998f171b8cc5d8437a3/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:e54da4baf05720032d527874d40b65fa4d7e5c6c6a43d0c3adbeffcaf275a2b3", size = 272313, upload-time = "2026-09-30T04:38:02.509Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e8/ee/008a2837737991474c5754bb3191010007663860979701990982a502cbaf/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:124fbf1a8ff966d87ae05bb8bd45a71f966055ed8bba320d0c7cf450bc5f4d0e", size = 269986, upload-time = "2026-09-30T04:38:04.435Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/93/ad/bd74a283940dc910c5b14f8e4f80a248082bc9c0fcbe1f54530cb6d9cc5e/charset_normalizer-3.5.2-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:28b4f0d66fb834ff90f28209ac7bce77868c45d8c93e26f906709d9b7c2e1af9", size = 260202, upload-time = "2026-09-30T04:38:06.549Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/7b/ed341c66f69f688723501fac752be3d63c7159ca0d0d4174fc611e5710bb/charset_normalizer-3.5.2-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:58ca3755ee7ff7f59b57789ec9833c9de9ea275405cdd240eda1f193112e398a", size = 259083, upload-time = "2026-09-30T04:38:08.311Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/cc/9d/e41588b777965e5031a43128a1e96173ebb35ac75fc53ec3b517e7c21cd4/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:443eae2bf318abeaf6f15d785138f71fd6de770e99a92158b8b814265e079115", size = 253081, upload-time = "2026-09-30T04:38:10.402Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/81/35/b761eb6d8c1eb218b9b42b9b4d5ac902afdc399fb6dac6f9a9aac7bda589/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_armv7l.whl", hash = "sha256:58f361dcbab699cf8f42db3f47c8e7fd1036f138c23a5d08de9fde5f425a730c", size = 248712, upload-time = "2026-09-30T04:38:12.317Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4d/2c/147169a041b747759f37405c0a97157e8e92de967968373101ff14915cba/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:1b4cbc7c3491ccb4aa17fcd8165649d01cf39f76de1696da8631b5f71b85401d", size = 274176, upload-time = "2026-09-30T04:38:14.138Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f0/2d/0ff8db0d373ba8538db686db11cd7e8912031490b9e4f383b41912e8d594/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:ba0b1d2620edf869789c3879223f52bf2afc5d31b3cb47cc57b3a12c05e2aa9d", size = 259413, upload-time = "2026-09-30T04:38:15.841Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/8e/b4a085fb47c9d3a7e43576a4784fdd8fe23f907514a972de8086edaf7a48/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_s390x.whl", hash = "sha256:5e2b6b57e9733d39f0c9fd3185efa6b8e29652c4cd8fe94180272cf6ed9a78c4", size = 269434, upload-time = "2026-09-30T04:38:17.626Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/83/1c/d8d8d7322a7c3eecdf3237a4a419cf41d2eaad8e006ce7dfdd9d4c8fa2eb/charset_normalizer-3.5.2-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:51cf45226a9b588d0d2b4880c62d686934b63ab0bd79ca23ab0e9762eb27441b", size = 262716, upload-time = "2026-09-30T04:38:19.214Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a0/16/0e4c6ba9b44e97a2da150e52d331e8f9c968b21b358fbffa6c856cebcd89/charset_normalizer-3.5.2-cp315-cp315t-win32.whl", hash = "sha256:5fb29fb8cd1a46c27a1bf9613ad5ec2599310d46b4025d9556404a6b6a292800", size = 197159, upload-time = "2026-09-30T04:38:21.037Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/be/33/e90bc2b1374f7f36ef106f56620de5a783907e19ca857efe2277e31cac3e/charset_normalizer-3.5.2-cp315-cp315t-win_amd64.whl", hash = "sha256:a192e2c40070d92c3ccf777e3a5c4ff515573cd2bb7ed0c537fdadbbec5bbf21", size = 221322, upload-time = "2026-09-30T04:38:22.886Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/66/89/dfa6dcb08c200b7830ab56439e8c1890f2971d51aafbb3937894a2e7fcfc/charset_normalizer-3.5.2-cp315-cp315t-win_arm64.whl", hash = "sha256:749e97e1b32313717a565abbe321bc2190bc8b35f1a67e4cdbc7c56c8d8ffe58", size = 209192, upload-time = "2026-09-30T04:38:24.648Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8c/ab/176fbfd5b64939c55d652366aa5b9ef1d767af207a3aa6ebeb0d226c484d/charset_normalizer-3.5.2-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:4275811936e2f06feff5e598fb42a1b7ae852da8e39605211892b56b81a34efd", size = 331815, upload-time = "2026-09-30T04:38:26.216Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7e/84/371eac6b30bdbcbf2d632a1a01809103459216fcaae61b8b8d922c1bfb8a/charset_normalizer-3.5.2-cp37-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:1c50fe28bbc2ced33386f298650d91218076c05420e6cbd790b913adc41659e7", size = 253276, upload-time = "2026-09-30T04:38:28.032Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/43/6f/c4fbae58febff71709c51bc7e18fdfa55341dc382704740f9f0cbf03817b/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:d19fbd981a488e22cd04883659ca6b08f50b5974f9fd7c95655ef6a043e5893f", size = 241239, upload-time = "2026-09-30T04:38:29.732Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/61/71/458c3f42164a07d0c5210798e9e704b39e540a6793b05aba67f3a35243a9/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_armv7l.manylinux_2_17_armv7l.manylinux_2_31_armv7l.whl", hash = "sha256:0fed1d06615f022ee3b13caf5e8b180cfea32bb2c5aded8a9d44277afc040f93", size = 231121, upload-time = "2026-09-30T04:38:31.462Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/09/54/ab9e89367076f6331bb6c65c4bf14a5361fa5191cb6561bf534f18504e1b/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:838dcc90063569a0448120554591a1d6c4a4ffe11babf048908793154ab86ade", size = 260350, upload-time = "2026-09-30T04:38:33.239Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7c/c1/061431ecc688d9d76602502cb57cc01e691e682c18f1beb45f9673b5bbd2/charset_normalizer-3.5.2-cp37-abi3-manylinux2014_s390x.manylinux_2_17_s390x.manylinux_2_28_s390x.whl", hash = "sha256:2ce45c6627b22c47e390bc91a41c3d13032192e699fa0bea96e9671b373d69b0", size = 255430, upload-time = "2026-09-30T04:38:34.865Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8d/1f/20c8949f0676f7ab811abdeb7f4d7f1cbc6e61ff20bef08b44edeb092bc8/charset_normalizer-3.5.2-cp37-abi3-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:0774bf9bf620249fee3e0b8b9fd3065de213be30f3aa94ce2494b3b638949e26", size = 250612, upload-time = "2026-09-30T04:38:36.649Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/2b/9e/46f2fa4c431fc98c4ae76a8cb5bdca54e0341e3cfc3fcfd8e82740250818/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:1db38f4c5496827c1a501846d64d14c3b80c7e6714e406cd7dc36a9899fa1011", size = 242083, upload-time = "2026-09-30T04:38:38.26Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/bd/39/559be29a0c0f086e0bba6922babd38916cc5e0b58ced4de13ee01ea05508/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_armv7l.whl", hash = "sha256:304d8e4d493af723536393eee0c689eb7813f4a474c8b479dee63f1fdd98f621", size = 232738, upload-time = "2026-09-30T04:38:39.81Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ff/6c/387b0e4f756a282831c1d9fc6aeb6c51ca4507ca202767c8de15ce9b12e2/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_ppc64le.whl", hash = "sha256:9b7f416ff0978e2f2249330527f0ad6fa02f4932e6199692d3b52da2048c19e4", size = 260703, upload-time = "2026-09-30T04:38:41.346Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/96/92/1fdf015f09ef449f50d3ac4b67c90887c9c318b727daa95cc4f866e6521d/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_riscv64.whl", hash = "sha256:01077390b03f7988f11d700a2194e69b119741a86b1a638b1db88891e3eced8e", size = 247622, upload-time = "2026-09-30T04:38:42.937Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/dc/3c/8e7b8a5671ad5d433669fb2a76f1a0164df2d9b1718b0206bc2a16d840cc/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_s390x.whl", hash = "sha256:7e841fb9010836c992c9f12fcbd43a831de93a5f726fc1ccd8ca1d0268c5014c", size = 257500, upload-time = "2026-09-30T04:38:44.604Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b4/f0/45b579df5cabc1d5d53ea1cc35e8437d3ca768c0acccc7041517cb6fbb32/charset_normalizer-3.5.2-cp37-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:9cae88599c7219005d879f98e5ed53341e9a122af585e1091200358a3003d2a0", size = 255100, upload-time = "2026-09-30T04:38:46.289Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/31/68/fdec18a343f5fb3f310588dd478b09ac4799e0b187dbade3a8cd776f03ef/charset_normalizer-3.5.2-cp37-abi3-win32.whl", hash = "sha256:01b0c0d2262a9e28e8484a278c7e1b5d650e3ac8cf2683d2967e25899f208bdf", size = 174499, upload-time = "2026-09-30T04:38:47.999Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9d/8a/b618149cc5207943a0242068d7a27897f56a62947b5a039085f2a22029f8/charset_normalizer-3.5.2-cp37-abi3-win_amd64.whl", hash = "sha256:9f56f72050826f63dcee7a7f55b0a77168cb3bfc553fd405e7f8f9ece75a4036", size = 200092, upload-time = "2026-09-30T04:38:49.707Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/03/cf/4c66866fa9e2b1c78e3c911516d1de497a677b7ac60f1eceda74ce777ca3/charset_normalizer-3.5.2-cp37-abi3-win_arm64.whl", hash = "sha256:40ab6bffa02ae10a0581e6c198be7d2d8ca5c2a0c64e4ed3465d766df457573e", size = 294363, upload-time = "2026-09-30T04:38:51.312Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fc/ad/d07d7862a62ffa6d79d68074d14823243dd235a77c45262acbf6adeb28bf/charset_normalizer-3.5.2-py3-none-any.whl", hash = "sha256:b6b751274acb69d77b3323d6b7dbaa3c7fdfc1eb829b7eb61d262f32e1af9685", size = 68872, upload-time = "2026-09-30T04:39:21.828Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colorama"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "coverage"
|
|
||||||
version = "7.17.3"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/ed/8f/19651ed6f648de7e1383bb759207078e2ad8addeca711187e1cb3a495f14/coverage-7.17.3.tar.gz", hash = "sha256:6695d1bb2a9a2fbd7806d69d78cf30f35eb0f65045da0ec5b5045242fadd6a78", size = 1004507, upload-time = "2026-11-12T12:26:44.986Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/98/bd/86199a63e36d1ec253e128aa3df186933c7c5993945be114b9e5102b7c77/coverage-7.17.3-cp314-cp314-android_24_arm64_v8a.whl", hash = "sha256:6f8f925262bc0d6fea12d5dde6998aa57f162e05d5a7d50b95d400ab05bb4537", size = 229914, upload-time = "2026-11-12T12:25:10.352Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d5/43/e0366c117f7cd88889674837e2146e9114d7c045fd7383c9f3c551f5b863/coverage-7.17.3-cp314-cp314-android_24_x86_64.whl", hash = "sha256:9e888603ea67c63ba264f39f3459f4cf68adc78dcd9f8bfa65dde601265a40f1", size = 230030, upload-time = "2026-11-12T12:25:11.794Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a6/b6/1f7e3f29bb0700586d6709d533a0421ed96e1372b608facc6870c05b0489/coverage-7.17.3-cp314-cp314-ios_13_0_arm64_iphoneos.whl", hash = "sha256:fab6f713a1f2f0ab7fb7d55f3aea15d1f3fbd31ace61b585ecd87c8e34f898fb", size = 228215, upload-time = "2026-11-12T12:25:13.133Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9e/cd/81261279e5a47a1295992e5d648fa30626af692c05b0767a037120953a17/coverage-7.17.3-cp314-cp314-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:4300ad360b21af19584c4cc82022979544d776ba2fb2df5418b2f3cae1eee6d2", size = 228518, upload-time = "2026-11-12T12:25:14.389Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/78/37/3a28b845dc06bcf17e0501fd641020760b61754444b904aa4973fd7c8098/coverage-7.17.3-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:e033255f24c1df6e046b6c4e9f91baacae08426beb5296bea8d46176b3a137d8", size = 228726, upload-time = "2026-11-12T12:25:15.693Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/79/dd/b770682a17e5e911e9c4db6af947641ed334dfd6155632f71fa54375f4a3/coverage-7.17.3-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:22a80bbdee3c22fb3319befaa112a2ed2d6e1417aa75c310f048235170ceca44", size = 228894, upload-time = "2026-11-12T12:25:17.47Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e9/e4/420e4d6f9ce1e6b8234bafad3508974950ec926063eb4d5e8d71c498b0a5/coverage-7.17.3-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:cfb1d2c52bb66e847669000658a5394d50aba835df8e31c2146034f978c8a4cf", size = 260939, upload-time = "2026-11-12T12:25:18.67Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/26/2c/c871c22a11981f58895e4dd167f4aa64c04853c5a0e91de853408c0f2d3e/coverage-7.17.3-cp314-cp314-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:eb25b51a30d07db8493901e3040284f2e756ec2b6549ee392798b9ef4c0607b3", size = 263872, upload-time = "2026-11-12T12:25:20Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/43/f3/f90e9619f2b0e1dc4d5f487163c3e9fd21629acfe3cd8abb97fa2afa12b2/coverage-7.17.3-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:2b9a39e25bf0e6fe072c6f3bceaa02f5303b9f975e83f590d118c4e92aacf6d8", size = 264877, upload-time = "2026-11-12T12:25:21.341Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f3/8e/b45330abc908d11c65e68be5f240237ad433c8e03dcb99b474541f129e3e/coverage-7.17.3-cp314-cp314-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:9e331bc028b44496ad85d4a2656dbad0feb35baf4a66500042c4aaa878ea132c", size = 267361, upload-time = "2026-11-12T12:25:22.549Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/38/80/06eaca23adf2d3b1526fca9e6d3433b0b4aa91e653b59774ea9fc44e1c03/coverage-7.17.3-cp314-cp314-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:17a4bd9edd312744035e1298a6ac30dd7332a7f1ecdc63c9eb0685589b161eb1", size = 260674, upload-time = "2026-11-12T12:25:23.869Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/58/1b/cf0a2d4d5aaf87b6b9f7d5f0c2e5d110079e9c2a23e11c04f20c98e98689/coverage-7.17.3-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:cc12f44ac4d5d6be301285c0a4f9c4ae52e673672e284b2a2744e20d24025573", size = 262658, upload-time = "2026-11-12T12:25:25.255Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fb/23/ede764173d08bd9cefeeee344826c22e93d7111fd17b0677436616c98662/coverage-7.17.3-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:0241e03dd65a1edf2e841eb19d8d72dca21ada5c869dcef6c9fde1b166d519a9", size = 260759, upload-time = "2026-11-12T12:25:26.949Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e1/44/b93c258ecbe1848f2117f7466e8c3060554b419f6eabd3761ef95d095c4b/coverage-7.17.3-cp314-cp314-musllinux_1_2_ppc64le.whl", hash = "sha256:42a1f511a334745a66b8f580c4d561e728243e35f3ada0ada35444c4b2fb9fa9", size = 265227, upload-time = "2026-11-12T12:25:28.493Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9f/fc/09a224782b0720b6a4c9e2fba0a479b87a2b046c523ffdd56339d2d8d516/coverage-7.17.3-cp314-cp314-musllinux_1_2_riscv64.whl", hash = "sha256:095ad10d17a28c845f2e5f99e398db2f0c680401731ff63a3a1789f2e61ef1e0", size = 260428, upload-time = "2026-11-12T12:25:29.799Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1d/c9/3027a58b3db40ded4dc43a8040a45a91e61ebb9f32a4de86e30a29d8effb/coverage-7.17.3-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:28b05f6b2622551805324196c32f3f20f4fa639bade8ac299ca83073253f6663", size = 262489, upload-time = "2026-11-12T12:25:31.127Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/69/a5/f9f767f731fd5a314e66fecd55d8ae320da95467feaf0f3742edf890049f/coverage-7.17.3-cp314-cp314-win32.whl", hash = "sha256:8b8188229ab3b3769a1c4aaa22357447555416deb440326c665a3bd25fd45ce0", size = 230582, upload-time = "2026-11-12T12:25:32.302Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/5b/1f/d377b98f63d876649083ce837f0e7cc2eefbfcb4088dc4a1428612ccd741/coverage-7.17.3-cp314-cp314-win_amd64.whl", hash = "sha256:957ba72e11d26b6e6e1abdaa72e41020871f4108c8ff64ff571fc50c81fb57a3", size = 231206, upload-time = "2026-11-12T12:25:33.558Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/89/2e/2c1607f6f1505fbed80910d95e51ce520945ad34a640c532123f75de5580/coverage-7.17.3-cp314-cp314-win_arm64.whl", hash = "sha256:f7ff8b21efcbdf9c7a6c051dc158c9bb9e938b7af33e55ed264d2e529b836d17", size = 231047, upload-time = "2026-11-12T12:25:34.908Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/11/79/428dc7fe065893833222ef604a261a5e16aa304be055ee99dff0fbb3bd66/coverage-7.17.3-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:3f6d942e066ca009bd1f7ebf5450287a5e9bfc5a6e20a8d8c408a61b433c7f94", size = 229254, upload-time = "2026-11-12T12:25:36.209Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fe/e8/60ce9cf304d2505cff1389a98e13bd67792f44bed530935bcce48db693f1/coverage-7.17.3-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e3948b2e5c3af0133af3e117ee033e6cc656c43d7549d3296e4b3807908dec9f", size = 229584, upload-time = "2026-11-12T12:25:37.567Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/42/b3/f209433ec9dde9dd4e471afafd6b467b51653af4a678e39792638832c85e/coverage-7.17.3-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:0bad8245a15bc7b15d26d25ece243bbf5d1b1229144f3db189014174429b63bb", size = 269701, upload-time = "2026-11-12T12:25:38.827Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4a/0c/34a2caf1e74950efe9f24de673767ec67fe60470c900610e58fa639366f7/coverage-7.17.3-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:bdf8fefb9f1acb3e92842fb42e29968d053e9545e4e9d9edb5c32a30fab8f899", size = 272171, upload-time = "2026-11-12T12:25:40.298Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ac/1b/1e87f731b4e930cb636cc15bfb55855d52a1f31e9193d645e96ad7ebe0ab/coverage-7.17.3-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:499acdc43bf1addf7fecc59a3123847bb96873c07001cfbeb709a71b181fa03d", size = 274823, upload-time = "2026-11-12T12:25:41.529Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c8/1f/e6e2cfe9d4f4df4228587b7f528d8b9985005e9f904c2e59ce51d236dbd4/coverage-7.17.3-cp314-cp314t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:11116ab42247d55980b51ab49b5c066de9b6baa56fe371fd555e54feae338619", size = 276333, upload-time = "2026-11-12T12:25:42.834Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9e/1f/3937e3745b511d67228dcbf15f7f24cec9da7fdacee443ecf837465c1663/coverage-7.17.3-cp314-cp314t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:56b469b63d8270aa67bc919ab8457f4d83115459556a76d09238052a3ab094db", size = 269560, upload-time = "2026-11-12T12:25:44.059Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/33/73/1b597ea0d77d062ed62d556e3a94c85fb7d3e56cac526d8a273f4e8872ea/coverage-7.17.3-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:95da285cf77352d4a527e1fd16c1c5c3762e42d1d71cfa9ef2c72a5c796cce36", size = 272118, upload-time = "2026-11-12T12:25:45.643Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/60/8a/1daee0aeb0a1d16884f5da92e2cf9300913bb216f42dff221329b3bd5651/coverage-7.17.3-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:c38a85dde92c4129641544aca998382f7448a87a17d202765a6adb8a87a33fc7", size = 269548, upload-time = "2026-11-12T12:25:47.043Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/40/d3/78fa95e9980917e2b75b97c056c3e70f9c9c9170fcde210897b4c0b35d03/coverage-7.17.3-cp314-cp314t-musllinux_1_2_ppc64le.whl", hash = "sha256:e9396d4d90fb47a1e124a985ac6a3172dbd58334d1de5189f06b75ae96ff69ee", size = 273964, upload-time = "2026-11-12T12:25:48.222Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/14/fa/2870663f070df38497ead9197a7e5af06f00286d5236192ea3d23bda68a1/coverage-7.17.3-cp314-cp314t-musllinux_1_2_riscv64.whl", hash = "sha256:e266c693c8bd6541f31cd71eda9b5aa3732adecbd04522880ea3d23d99b202eb", size = 269021, upload-time = "2026-11-12T12:25:49.548Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/30/fa/390e1199f21b4c2a8797492aa5351e8b74065fef609b717255cd88e54c5a/coverage-7.17.3-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0837b71a40749d9c4016cf8c51ba8c6153f7dd40cf4dfa287a2f28376fa50917", size = 270929, upload-time = "2026-11-12T12:25:51.099Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4e/e3/e29ec216a87330812142af2290224002b84804c5361eebe68c57e2ace5cd/coverage-7.17.3-cp314-cp314t-win32.whl", hash = "sha256:8a054b755bc6665b339a923fed14a54446c43c942bf4edf08a59b1225b284c93", size = 230892, upload-time = "2026-11-12T12:25:52.755Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9c/e0/3854a8d843b31a317f251a0fc148c1980dde60f872fce30f6f037dc432e2/coverage-7.17.3-cp314-cp314t-win_amd64.whl", hash = "sha256:fa8903475085973b5c916e8a958afd22101b9559880ffbeab5aeac4196768338", size = 231750, upload-time = "2026-11-12T12:25:53.953Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/84/b7/748a7b92e7e7605532754e5718ef3109144ed7e58c0721d0d5c9fa9083a6/coverage-7.17.3-cp314-cp314t-win_arm64.whl", hash = "sha256:582c5d80b6de5b1909a4222ec1f5676bb2e03815c6be9ff43db2d8a71de5079c", size = 231381, upload-time = "2026-11-12T12:25:55.232Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e3/44/8cb5635090ddf8674625f5067c0575ead89863664fff3cf73fb2f93c9287/coverage-7.17.3-cp315-cp315-android_24_arm64_v8a.whl", hash = "sha256:49a4f12eff115fc2447d3438b2c08d7e5adb3abc811c050ee508f8189718cc5d", size = 229920, upload-time = "2026-11-12T12:25:56.587Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/54/b7ba20ab94696a790c2703ceb32f10b15f0a70dc2ae19178fd17d4915937/coverage-7.17.3-cp315-cp315-android_24_x86_64.whl", hash = "sha256:e04385647f444d55b483a0e4dc519f46134846eddd80910a0d0953ea19e58358", size = 230038, upload-time = "2026-11-12T12:25:57.842Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ae/57/00c6e8a207674280408907cf4861e925c8e136770d333f5c9ee4dde5dc12/coverage-7.17.3-cp315-cp315-ios_13_0_arm64_iphoneos.whl", hash = "sha256:faee34ea548318f6f9010928edab2f91b36a19b58376e69ab0e76d4f3a0bf9df", size = 228239, upload-time = "2026-11-12T12:25:59.159Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/81/ab/b3f996c33524cef1d9bf80fe677619bf17282fefb9f3497da83fabea67cd/coverage-7.17.3-cp315-cp315-ios_13_0_arm64_iphonesimulator.whl", hash = "sha256:7c420ffa993c25cc74c263e9c1c869fbaea7d16dcb6448eef4fa6f1905560f5a", size = 228535, upload-time = "2026-11-12T12:26:00.402Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/32/ed/83f6e5ef0f7e39deb1d7915c2eb3c8946c002afba2f5f58ae05f870e3532/coverage-7.17.3-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:e592f790fee57e2bedaa27cdc76988a082090d1aac560ca4bbea80a7a58436ec", size = 228733, upload-time = "2026-11-12T12:26:01.649Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d8/34/d256f50c5bf16255ae04aa917ba1857e127023dfd2c06499f777c7a4cd29/coverage-7.17.3-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:59c15dcae783ed291da3af6be2e70762322637ac886b19671d12123521cf6ac3", size = 228929, upload-time = "2026-11-12T12:26:02.97Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/35/a4/31617273e938a7d9c7378335cb41e147bc6c293acac8ea643d74b3bc29e3/coverage-7.17.3-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:733368982d2799ff04d768916fb755e54d4ce11af3573488ece451745c90d4a7", size = 260825, upload-time = "2026-11-12T12:26:04.219Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/10/61/1bd79ec66957f4ea7ce5f687a18aa50f3b3e8715e4843f6ed3e5f03f24bf/coverage-7.17.3-cp315-cp315-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:a13a946d8de807d8992e56a09502952d81bfbb4b80204ef77a6a2a38b4ce22be", size = 264469, upload-time = "2026-11-12T12:26:05.491Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e9/47/db887dff6eaf0a24396021ee4956eac563bd286677252e444f89a80e5166/coverage-7.17.3-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c769e6a28bb645c915449ed8ddf6059765a72d8ef79590bfd6202022a4441cd3", size = 265623, upload-time = "2026-11-12T12:26:06.798Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/69/b9/e86863e2ac724844a07dbd165da6912d31c6a2cad99ab23b2c204e655bbc/coverage-7.17.3-cp315-cp315-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:bf7a43782b20951fe9ddc6f6c28da51c65d3c0d5d5fc3c5a0e566986aa3ec0aa", size = 267981, upload-time = "2026-11-12T12:26:08.051Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/72/d0/a3536c347bf036e3aa383c85db80a3ce5f2ca961f8500f46c25ac6a14c3c/coverage-7.17.3-cp315-cp315-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:b65db089de3f219c850f21a2ca915f43f6fa1da5bfb55871c089d3be82c10369", size = 261235, upload-time = "2026-11-12T12:26:09.392Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7b/26/f7c1a5c62c66a4ceccb9889eb7fefaca6c34fc72f47553ffb134262533cb/coverage-7.17.3-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:228f4bcecadcbb1ec3ed088b0595c5c08f3fca01406b72e8a02209a3af16aff9", size = 263461, upload-time = "2026-11-12T12:26:10.684Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/45/4f/51a9d4af3dac74e146d65e0b696a98eaad7badc3837e42fa386c8ef96c55/coverage-7.17.3-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:3a5691ef42b16e22976ec0352a76a0f7c3b4196fe3d39805dcc765e31ce54f22", size = 261436, upload-time = "2026-11-12T12:26:12.421Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e5/bb/6bcac633b71c1e675d9bc7ba97e9b28c32a3309db57185ce5af35176b1c7/coverage-7.17.3-cp315-cp315-musllinux_1_2_ppc64le.whl", hash = "sha256:2765261bdcb5f6c01af41d97ec4fcfe18acd1114d8d2690536a36f86b67c179f", size = 265926, upload-time = "2026-11-12T12:26:13.684Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d4/6f/fc1007053178d2fbef0a89014a60e34a8b7a9e831d2f78301a55f0cbf644/coverage-7.17.3-cp315-cp315-musllinux_1_2_riscv64.whl", hash = "sha256:45268757a45946ab3fc9d2c30019aff2d3804ae660121d5b31f523366f604e67", size = 260770, upload-time = "2026-11-12T12:26:15.247Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/44/e4/90fee6c30eacfd84d6969223f823e4d14f02a07df9ad91e5de2b3fd6c466/coverage-7.17.3-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:24389d7d50f1fe98ac8d8ec1c946656a75b97d953b51a714484e174ed9f48eb1", size = 263276, upload-time = "2026-11-12T12:26:16.551Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3e/03/4108b8e1f428dd511a422510fce64aae0afa7b7350f73a55f6d6d5812d7e/coverage-7.17.3-cp315-cp315-win32.whl", hash = "sha256:ff0ca078fe63faffff1cff24c804afd4010e35d9c75bb593877b3d4321826c91", size = 230578, upload-time = "2026-11-12T12:26:17.793Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/95/46/e213941d820ab8e2ba788177569e781c50381bfd9ddb35d50f5f63d096cb/coverage-7.17.3-cp315-cp315-win_amd64.whl", hash = "sha256:f8f6252bb4c457d686c18e42965087b30155ff72b0dbda6e79a43ee3682c0870", size = 231196, upload-time = "2026-11-12T12:26:19.172Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/4c/703768310ea21b513fdfd42d114447f0a335b763d70aacd54f8ecbc1e59a/coverage-7.17.3-cp315-cp315-win_arm64.whl", hash = "sha256:5559549a14f997b261c936ca463ed67e030511f914ffd1692ad08b3b16ed6034", size = 231046, upload-time = "2026-11-12T12:26:20.477Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/5b/4c/e27066a48746f622abc8ccf941917294bf46ee87077427d9a22aa98a74a3/coverage-7.17.3-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:b6db3399e76a366353dd0c9a009fe74c3d1c892de35863331c4d06fbe0dd83b8", size = 229243, upload-time = "2026-11-12T12:26:22.109Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/38/29/129c10c8b1555ece4aaa9ad197769abda281bc204d7b055bf85681e12e15/coverage-7.17.3-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:47e49fced11190fdc678182b0e7f8947db4fc1c1216094923a1d2bbedba3c84a", size = 229600, upload-time = "2026-11-12T12:26:23.372Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/11/91/4cd15480a1d6bb7102dfd42c03197034aff1cb0f12b3791ed6e14872c2d6/coverage-7.17.3-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fb5945d7360fb258dee758258d93ea624a712fae494e7a0037a92505b3eb8b32", size = 270046, upload-time = "2026-11-12T12:26:24.615Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1e/b0/b7db33135f973cba720c20d8055c26177217cd07c4e903fc24a71715be0e/coverage-7.17.3-cp315-cp315t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl", hash = "sha256:47cd7674a39bad6480e565e2a5b77f8089ebfbcd3aacc572abc6cebabe1f4cc9", size = 272815, upload-time = "2026-11-12T12:26:25.864Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a1/ea/207ab861d69f4008d90d193ab5e9d5721ea2a75ec4a1e826720519142795/coverage-7.17.3-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ff5069e99039739c2fade5dd12cf8df7dc1b1217a0b915110605e0bbdddf1187", size = 275531, upload-time = "2026-11-12T12:26:27.096Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a9/6e/d5144a94a9758d25f3d9143b86a0ab04feded2a30d8c9365c646d504aea9/coverage-7.17.3-cp315-cp315t-manylinux2014_ppc64le.manylinux_2_17_ppc64le.manylinux_2_28_ppc64le.whl", hash = "sha256:b7028eabf24ad18646dbfc6b352cece01779914e69254ddcacdfb9f805d89f61", size = 276906, upload-time = "2026-11-12T12:26:28.311Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e7/b4/8328eaa253b44b081e25236abb4717f7afd37ecae02cc6ca77d853efdde9/coverage-7.17.3-cp315-cp315t-manylinux_2_31_riscv64.manylinux_2_39_riscv64.whl", hash = "sha256:349ab42e0b6b72892f187a60a0890b3a76710e93b7c31579e81648d46230a8ed", size = 270557, upload-time = "2026-11-12T12:26:29.969Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6b/bd/22effefa744acb7cac84addd7d619538c7604fe7d7b6fe3b989ad6f60fed/coverage-7.17.3-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:397e5342fd4f19ae930a5234643a63a8eaccc18a2f034a2f1765a5313123489d", size = 273009, upload-time = "2026-11-12T12:26:31.591Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a0/b6/5e1a93260f8524832bd5781108dc38497d7930bb451014350ce61b22f848/coverage-7.17.3-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:8009572d242674765b84ecceba126c2392b1824b32f41db1f3323d23d4cb598f", size = 270006, upload-time = "2026-11-12T12:26:32.85Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/25/35/e7ccdc8675afd66c4c9310e883c255dec3277fdff65c640ec0ac531b1f9e/coverage-7.17.3-cp315-cp315t-musllinux_1_2_ppc64le.whl", hash = "sha256:dc116b251f7a4ae0266dba0ef31a742c6c517d3a99b4d50016548a17d407ac5f", size = 274755, upload-time = "2026-11-12T12:26:34.058Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1e/a3/d8c76a38363e59654516041471cdc5b325fa22835a87d5213e20553454fb/coverage-7.17.3-cp315-cp315t-musllinux_1_2_riscv64.whl", hash = "sha256:b73148d024d086239fc04c03daaeb1934a6d295312dd0d6a04a937326c1207d4", size = 270158, upload-time = "2026-11-12T12:26:35.772Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0f/e9/cf0fded465f8d9a238d6b4fa4908a84f08ae483b3d4adddbd9668dc09ab0/coverage-7.17.3-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:7f02996b09190bcdee3b2af38bf2279e4a1a65306afd3e6c229029dbe41e42ea", size = 271819, upload-time = "2026-11-12T12:26:37.046Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ac/24/fcde10f418dec10e647c1d697f5fee500605adae2a0105fe772ed6dfff17/coverage-7.17.3-cp315-cp315t-win32.whl", hash = "sha256:80e219a51ef7ccf78fcd584257e523ece0d390cb3d9d3896660eac05a19ac691", size = 230874, upload-time = "2026-11-12T12:26:38.293Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/80/bf/095490c7d43ba2e38eb0c4af31a37beb1f2347c4765613e39f8587c5f00a/coverage-7.17.3-cp315-cp315t-win_amd64.whl", hash = "sha256:86563b5323fc13239d943b22a1bb9ec60f9ca17bd9a0be09c40a89836697aea2", size = 231735, upload-time = "2026-11-12T12:26:40.717Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1e/f8/21db698c4785e3604755415aaeaa49bf00220c210f09c06dd185fce6f986/coverage-7.17.3-cp315-cp315t-win_arm64.whl", hash = "sha256:f8356475aba020621f8277f1a81c2dbdbda8286c7c6130f242c9816e044062a9", size = 231374, upload-time = "2026-11-12T12:26:42.14Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d1/8e/f7d7e69e2ad34ce08595b787eb578f669c00fd57d432ed4c7cfd71666f36/coverage-7.17.3-py3-none-any.whl", hash = "sha256:21745c08f2835b847a16887b748d3084dddeb0571ae2a0d62e33644413568b99", size = 219999, upload-time = "2026-11-12T12:26:43.553Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crdt-sync"
|
|
||||||
version = "0.11.1"
|
|
||||||
source = { git = "https://github.com/kuhyx/utils?subdirectory=crdt-sync&rev=crdt-sync-v0.11.1#317448062419e3faf48aee8a50452c5572d244f9" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "argon2-cffi" },
|
|
||||||
{ name = "pynacl" },
|
|
||||||
{ name = "requests" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna"
|
|
||||||
version = "3.20"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/f5/08/8eea9d4b8302028f3abb2c0813953f7aec26d33b7a8960ed760e65ff29fa/idna-3.20.tar.gz", hash = "sha256:a7db850025b95ded1eae8a46181a1a6c56c92c96f0e2b005d9ff8dc0210cab44", size = 216463, upload-time = "2026-09-17T14:11:04.752Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/58/a2/bb081bab032533a855d44de1d56f8e8426114ff1ba5d1f07a438a0a654f8/idna-3.20-py3-none-any.whl", hash = "sha256:ab7ae7122974553370f0bdb919e1a960b2cd1bc1ef0276416d896db81c14582c", size = 69583, upload-time = "2026-09-17T14:11:03.168Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "iniconfig"
|
|
||||||
version = "2.3.1"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/01/e1/2069291243c926a2ff1cd706c7f3eeb9b62144bf60f77c9fb9ff2fb26bd3/iniconfig-2.3.1.tar.gz", hash = "sha256:67f4b9c50da0dedf52af349e7749a80a9057a5031199791b906c3bb3ae878960", size = 21209, upload-time = "2026-10-06T22:48:38.076Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/56/43/4ca9e49d27a1fcf6bece6f6aec0ea46bb9112489b93d4b688fb415457bdb/iniconfig-2.3.1-py3-none-any.whl", hash = "sha256:9121e2c1fdb355232495be3194c8dfe87ccc2d5dee45947b78e68f499790d7a7", size = 7552, upload-time = "2026-10-06T22:48:36.959Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jsonschema"
|
|
||||||
version = "4.26.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "attrs" },
|
|
||||||
{ name = "jsonschema-specifications" },
|
|
||||||
{ name = "referencing" },
|
|
||||||
{ name = "rpds-py" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/b3/fc/e067678238fa451312d4c62bf6e6cf5ec56375422aee02f9cb5f909b3047/jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326", size = 366583, upload-time = "2026-01-07T13:41:07.246Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/69/90/f63fb5873511e014207a475e2bb4e8b2e570d655b00ac19a9a0ca0a385ee/jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce", size = 90630, upload-time = "2026-01-07T13:41:05.306Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "jsonschema-specifications"
|
|
||||||
version = "2025.9.1"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "referencing" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/19/74/a633ee74eb36c44aa6d1095e7cc5569bebf04342ee146178e2d36600708b/jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d", size = 32855, upload-time = "2025-09-08T01:34:59.186Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/41/45/1a4ed80516f02155c51f51e8cedb3c1902296743db0bbc66608a0db2814f/jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe", size = 18437, upload-time = "2025-09-08T01:34:57.871Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "packaging"
|
|
||||||
version = "26.3"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pluggy"
|
|
||||||
version = "1.7.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/bf/db/7fc19e6f2dc92a966727031389fc2e08b558f0f25eb7403c1119ad4713cd/pluggy-1.7.0.tar.gz", hash = "sha256:d1eaa46ebb595891b860ab086b4d09c8588af65ebd4361b8e8f4bb8920b90ba8", size = 123304, upload-time = "2026-10-15T09:50:58.343Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/40/9e/2b38731e0fc536806f16490e1a12d7f0dc2a1235aa8cc07bcc75416a7daa/pluggy-1.7.0-py3-none-any.whl", hash = "sha256:7dd7b0d8832ba3cb632c306926ded123429211b83641b35dc5c41ad2d34f9bec", size = 27082, upload-time = "2026-10-15T09:50:56.808Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pycparser"
|
|
||||||
version = "3.12"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/cb/27/eeb9f307bf07060f3d9f9aa0fb8c15b01bdfded0a941e4b2719c7f94cacd/pycparser-3.12.tar.gz", hash = "sha256:f03387877eab82ce01bbdfd0ba7252ee55a90b1c708d5129e2ce915475cf1db6", size = 158785, upload-time = "2026-10-22T13:40:03.56Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b6/ae/315bbeee126a769cbde43cf4908acb4b40408d8bf8bbf334dd7368d8dadf/pycparser-3.12-py3-none-any.whl", hash = "sha256:a076f3f489b39b43ed13563a1dafe42447445bec2e294154ec5c57fcdda4c85e", size = 62600, upload-time = "2026-10-22T13:40:02.021Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pygments"
|
|
||||||
version = "2.21.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/49/2e/ced460408999b33da6b31b0021b0f37d329e202d4169aeb164493778f25b/pygments-2.21.0.tar.gz", hash = "sha256:610ca751c9bc2492b38eb9a38a7fbc93edbbb2d7182edaf34e66ae493dee5c8c", size = 5005329, upload-time = "2026-08-17T08:02:48.824Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pynacl"
|
|
||||||
version = "1.6.2"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "cffi", marker = "platform_python_implementation != 'PyPy'" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/d9/9a/4019b524b03a13438637b11538c82781a5eda427394380381af8f04f467a/pynacl-1.6.2.tar.gz", hash = "sha256:018494d6d696ae03c7e656e5e74cdfd8ea1326962cc401bcf018f1ed8436811c", size = 3511692, upload-time = "2026-01-01T17:48:10.851Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4b/79/0e3c34dc3c4671f67d251c07aa8eb100916f250ee470df230b0ab89551b4/pynacl-1.6.2-cp314-cp314t-macosx_10_10_universal2.whl", hash = "sha256:622d7b07cc5c02c666795792931b50c91f3ce3c2649762efb1ef0d5684c81594", size = 390064, upload-time = "2026-01-01T17:31:57.264Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/eb/1c/23a26e931736e13b16483795c8a6b2f641bf6a3d5238c22b070a5112722c/pynacl-1.6.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:d071c6a9a4c94d79eb665db4ce5cedc537faf74f2355e4d502591d850d3913c0", size = 809370, upload-time = "2026-01-01T17:31:59.198Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/87/74/8d4b718f8a22aea9e8dcc8b95deb76d4aae380e2f5b570cc70b5fd0a852d/pynacl-1.6.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:fe9847ca47d287af41e82be1dd5e23023d3c31a951da134121ab02e42ac218c9", size = 1408304, upload-time = "2026-01-01T17:32:01.162Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fd/73/be4fdd3a6a87fe8a4553380c2b47fbd1f7f58292eb820902f5c8ac7de7b0/pynacl-1.6.2-cp314-cp314t-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:04316d1fc625d860b6c162fff704eb8426b1a8bcd3abacea11142cbd99a6b574", size = 844871, upload-time = "2026-01-01T17:32:02.824Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/55/ad/6efc57ab75ee4422e96b5f2697d51bbcf6cdcc091e66310df91fbdc144a8/pynacl-1.6.2-cp314-cp314t-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:44081faff368d6c5553ccf55322ef2819abb40e25afaec7e740f159f74813634", size = 1446356, upload-time = "2026-01-01T17:32:04.452Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/78/b7/928ee9c4779caa0a915844311ab9fb5f99585621c5d6e4574538a17dca07/pynacl-1.6.2-cp314-cp314t-manylinux_2_34_aarch64.whl", hash = "sha256:a9f9932d8d2811ce1a8ffa79dcbdf3970e7355b5c8eb0c1a881a57e7f7d96e88", size = 826814, upload-time = "2026-01-01T17:32:06.078Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/a9/1bdba746a2be20f8809fee75c10e3159d75864ef69c6b0dd168fc60e485d/pynacl-1.6.2-cp314-cp314t-manylinux_2_34_x86_64.whl", hash = "sha256:bc4a36b28dd72fb4845e5d8f9760610588a96d5a51f01d84d8c6ff9849968c14", size = 1411742, upload-time = "2026-01-01T17:32:07.651Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f3/2f/5e7ea8d85f9f3ea5b6b87db1d8388daa3587eed181bdeb0306816fdbbe79/pynacl-1.6.2-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:3bffb6d0f6becacb6526f8f42adfb5efb26337056ee0831fb9a7044d1a964444", size = 801714, upload-time = "2026-01-01T17:32:09.558Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/06/ea/43fe2f7eab5f200e40fb10d305bf6f87ea31b3bbc83443eac37cd34a9e1e/pynacl-1.6.2-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:2fef529ef3ee487ad8113d287a593fa26f48ee3620d92ecc6f1d09ea38e0709b", size = 1372257, upload-time = "2026-01-01T17:32:11.026Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4d/54/c9ea116412788629b1347e415f72195c25eb2f3809b2d3e7b25f5c79f13a/pynacl-1.6.2-cp314-cp314t-win32.whl", hash = "sha256:a84bf1c20339d06dc0c85d9aea9637a24f718f375d861b2668b2f9f96fa51145", size = 231319, upload-time = "2026-01-01T17:32:12.46Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ce/04/64e9d76646abac2dccf904fccba352a86e7d172647557f35b9fe2a5ee4a1/pynacl-1.6.2-cp314-cp314t-win_amd64.whl", hash = "sha256:320ef68a41c87547c91a8b58903c9caa641ab01e8512ce291085b5fe2fcb7590", size = 244044, upload-time = "2026-01-01T17:32:13.781Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/33/33/7873dc161c6a06f43cda13dec67b6fe152cb2f982581151956fa5e5cdb47/pynacl-1.6.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d29bfe37e20e015a7d8b23cfc8bd6aa7909c92a1b8f41ee416bbb3e79ef182b2", size = 188740, upload-time = "2026-01-01T17:32:15.083Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/be/7b/4845bbf88e94586ec47a432da4e9107e3fc3ce37eb412b1398630a37f7dd/pynacl-1.6.2-cp38-abi3-macosx_10_10_universal2.whl", hash = "sha256:c949ea47e4206af7c8f604b8278093b674f7c79ed0d4719cc836902bf4517465", size = 388458, upload-time = "2026-01-01T17:32:16.829Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/1e/b4/e927e0653ba63b02a4ca5b4d852a8d1d678afbf69b3dbf9c4d0785ac905c/pynacl-1.6.2-cp38-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:8845c0631c0be43abdd865511c41eab235e0be69c81dc66a50911594198679b0", size = 800020, upload-time = "2026-01-01T17:32:18.34Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7f/81/d60984052df5c97b1d24365bc1e30024379b42c4edcd79d2436b1b9806f2/pynacl-1.6.2-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:22de65bb9010a725b0dac248f353bb072969c94fa8d6b1f34b87d7953cf7bbe4", size = 1399174, upload-time = "2026-01-01T17:32:20.239Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/68/f7/322f2f9915c4ef27d140101dd0ed26b479f7e6f5f183590fd32dfc48c4d3/pynacl-1.6.2-cp38-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:46065496ab748469cdd999246d17e301b2c24ae2fdf739132e580a0e94c94a87", size = 835085, upload-time = "2026-01-01T17:32:22.24Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3e/d0/f301f83ac8dbe53442c5a43f6a39016f94f754d7a9815a875b65e218a307/pynacl-1.6.2-cp38-abi3-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8a66d6fb6ae7661c58995f9c6435bda2b1e68b54b598a6a10247bfcdadac996c", size = 1437614, upload-time = "2026-01-01T17:32:23.766Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c4/58/fc6e649762b029315325ace1a8c6be66125e42f67416d3dbd47b69563d61/pynacl-1.6.2-cp38-abi3-manylinux_2_34_aarch64.whl", hash = "sha256:26bfcd00dcf2cf160f122186af731ae30ab120c18e8375684ec2670dccd28130", size = 818251, upload-time = "2026-01-01T17:32:25.69Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c9/a8/b917096b1accc9acd878819a49d3d84875731a41eb665f6ebc826b1af99e/pynacl-1.6.2-cp38-abi3-manylinux_2_34_x86_64.whl", hash = "sha256:c8a231e36ec2cab018c4ad4358c386e36eede0319a0c41fed24f840b1dac59f6", size = 1402859, upload-time = "2026-01-01T17:32:27.215Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/85/42/fe60b5f4473e12c72f977548e4028156f4d340b884c635ec6b063fe7e9a5/pynacl-1.6.2-cp38-abi3-musllinux_1_2_aarch64.whl", hash = "sha256:68be3a09455743ff9505491220b64440ced8973fe930f270c8e07ccfa25b1f9e", size = 791926, upload-time = "2026-01-01T17:32:29.314Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/fa/f9/e40e318c604259301cc091a2a63f237d9e7b424c4851cafaea4ea7c4834e/pynacl-1.6.2-cp38-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:8b097553b380236d51ed11356c953bf8ce36a29a3e596e934ecabe76c985a577", size = 1363101, upload-time = "2026-01-01T17:32:31.263Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/48/47/e761c254f410c023a469284a9bc210933e18588ca87706ae93002c05114c/pynacl-1.6.2-cp38-abi3-win32.whl", hash = "sha256:5811c72b473b2f38f7e2a3dc4f8642e3a3e9b5e7317266e4ced1fba85cae41aa", size = 227421, upload-time = "2026-01-01T17:32:33.076Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/41/ad/334600e8cacc7d86587fe5f565480fde569dfb487389c8e1be56ac21d8ac/pynacl-1.6.2-cp38-abi3-win_amd64.whl", hash = "sha256:62985f233210dee6548c223301b6c25440852e13d59a8b81490203c3227c5ba0", size = 239754, upload-time = "2026-01-01T17:32:34.557Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/29/7d/5945b5af29534641820d3bd7b00962abbbdfee84ec7e19f0d5b3175f9a31/pynacl-1.6.2-cp38-abi3-win_arm64.whl", hash = "sha256:834a43af110f743a754448463e8fd61259cd4ab5bbedcf70f9dabad1d28a394c", size = 184801, upload-time = "2026-01-01T17:32:36.309Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pytest"
|
|
||||||
version = "9.2.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
|
||||||
{ name = "iniconfig" },
|
|
||||||
{ name = "packaging" },
|
|
||||||
{ name = "pluggy" },
|
|
||||||
{ name = "pygments" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/79/42/bb4641652e58dedeac2ec51abc1f8cae4fee4ec63899a0999016229a0f2a/pytest-9.2.0.tar.gz", hash = "sha256:97c4f3b1f3c7414aa36465e09b8220f1d03627993bd51b1282e193753c80557b", size = 1797555, upload-time = "2026-10-27T21:30:20.728Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/51/39/1f5d8c8877a0fa327db959c19341d4be61660de1ab6b7391f9eb805bcd67/pytest-9.2.0-py3-none-any.whl", hash = "sha256:07acdcf88ec174f907dc01af70bf52d49b014bbab03faeeade31c96b18c2e588", size = 411776, upload-time = "2026-10-27T21:30:19.131Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pytest-cov"
|
|
||||||
version = "7.1.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "coverage" },
|
|
||||||
{ name = "pluggy" },
|
|
||||||
{ name = "pytest" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/b1/51/a849f96e117386044471c8ec2bd6cfebacda285da9525c9106aeb28da671/pytest_cov-7.1.0.tar.gz", hash = "sha256:30674f2b5f6351aa09702a9c8c364f6a01c27aae0c1366ae8016160d1efc56b2", size = 55592, upload-time = "2026-03-21T20:11:16.284Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/9d/7a/d968e294073affff457b041c2be9868a40c1c71f4a35fcc1e45e5493067b/pytest_cov-7.1.0-py3-none-any.whl", hash = "sha256:a0461110b7865f9a271aa1b51e516c9a95de9d696734a2f71e3e78f46e1d4678", size = 22876, upload-time = "2026-03-21T20:11:14.438Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "referencing"
|
|
||||||
version = "0.37.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "attrs" },
|
|
||||||
{ name = "rpds-py" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/22/f5/df4e9027acead3ecc63e50fe1e36aca1523e1719559c499951bb4b53188f/referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8", size = 78036, upload-time = "2025-10-13T15:30:48.871Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/2c/58/ca301544e1fa93ed4f80d724bf5b194f6e4b945841c5bfd555878eea9fcb/referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231", size = 26766, upload-time = "2025-10-13T15:30:47.625Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "requests"
|
|
||||||
version = "2.34.2"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
dependencies = [
|
|
||||||
{ name = "certifi" },
|
|
||||||
{ name = "charset-normalizer" },
|
|
||||||
{ name = "idna" },
|
|
||||||
{ name = "urllib3" },
|
|
||||||
]
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/ac/c3/e2a2b89f2d3e2179abd6d00ebd70bff6273f37fb3e0cc209f48b39d00cbf/requests-2.34.2.tar.gz", hash = "sha256:f288924cae4e29463698d6d60bc6a4da69c89185ad1e0bcc4104f584e960b9ed", size = 142856, upload-time = "2026-05-14T19:25:27.735Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a0/f4/c67b0b3f1b9245e8d266f0f112c500d50e5b4e83cb6f3b71b6528104182a/requests-2.34.2-py3-none-any.whl", hash = "sha256:2a0d60c172f83ac6ab31e4554906c0f3b3588d37b5cb939b1c061f4907e278e0", size = 73075, upload-time = "2026-05-14T19:25:26.443Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rpds-py"
|
|
||||||
version = "2026.9.1"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/42/68/3bd46b8a5e01d3c2ebdf9c5e9497912e3fe0cde02bac21a7130ca866e403/rpds_py-2026.9.1.tar.gz", hash = "sha256:4793ef7f78268b124b73fa933440f01d258bbae01de9fa53e9080c9ab0425a12", size = 63948, upload-time = "2026-10-04T16:32:36.469Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/f2/67b94be1532767803415c1c5a1fd88ea487643d74a673cec1ba140af77bb/rpds_py-2026.9.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:c9d1aca01f49170fdcf5c92761b1fafe97f554b721ca4570c5949fff778f0d4b", size = 347178, upload-time = "2026-10-04T16:30:00.865Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/04/37/b751de2b59b0197a1d92a5dd491de88e8a5e928c2e6562581974f1e85263/rpds_py-2026.9.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:3f0e9ac28fc067d4d34b88ae43c48e9489455c97fee9633d851f7eeed5a05d35", size = 341878, upload-time = "2026-10-04T16:30:02.564Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/72/e2/5873bc4643c250db9e05d48dc0c93763d4aa68bc3b81164cb1af3b45b284/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:07deecbfce94c78473018bc7d10b337cc651d12df87a1eb2cb3e4024bc9c33d0", size = 373963, upload-time = "2026-10-04T16:30:04.026Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/51/03/5acf7632158247f3f6386ff0af3a1ee48167d575037e8d0920594b76d92b/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:821b2755db9194409254012f429c56643416fb96ef9be090be82ec8826b7f477", size = 377975, upload-time = "2026-10-04T16:30:05.555Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e6/00/63fda451b8bffa5808fc8bb311ee7c073b340974b09f273c7b2a145d3d62/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3c91c210ae7645626c608400e3519b4a642f837cce09ca830db3beb2e9f274d4", size = 490347, upload-time = "2026-10-04T16:30:07.156Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a1/ae/c093ffd070ba0fb02f76c565d06fecc65ad6e4afdbae78f7031076d3cdac/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:54ac2158a6f96cfbabff0b2eedaf94b90c5ec7ca8317fcadc61e1c2b2e0ff6ef", size = 392962, upload-time = "2026-10-04T16:30:08.77Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/22/9d/d08a1128ab199b2f0cf25bfeb0639bd05119fff4b7c47bec24ef9a8ec23f/rpds_py-2026.9.1-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:eac2f5dbafd585dfe31f86a23ebf0d3ba480a9d49ebc87947267b5608d4ea0cd", size = 371623, upload-time = "2026-10-04T16:30:10.501Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/53/c7/4758ddcbb75609414bbccfcb11d612436f9b3ee821bd2f33f0f1604ee648/rpds_py-2026.9.1-cp314-cp314-manylinux_2_31_riscv64.whl", hash = "sha256:8aa5dda18d39b6143eb24809d158f9252c88f402749b6f1b62a506cc7d96cc35", size = 376997, upload-time = "2026-10-04T16:30:12.124Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/87/e4/947bd7f608ff60faf46dc9d389c3dffd0e3d767d78a0be19978448ef0ce7/rpds_py-2026.9.1-cp314-cp314-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:5c90e7fa02e8f5de0d10c17595c568ada48c5302e749462c0ea1a4c362111a86", size = 400169, upload-time = "2026-10-04T16:30:13.804Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/4b/35/fe93e020a0543b5670472c18d7e6af3197c08da571240ce1965c84f85c0f/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:e6d198bad4e49dd6732fbd636e2fc5c082f45c8cad0b4acb756b00c82c76072e", size = 551615, upload-time = "2026-10-04T16:30:15.332Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/0d/4f/5d2a0136bb03b2a56a39dc6ff92d58a6e3e53a2e17079238b86228882f16/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:96beca19ec79de272e8668585380ff9092c47077c1d7a1e098e00bbd921f4785", size = 614655, upload-time = "2026-10-04T16:30:16.92Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/09/1c/3f1025aaf70d9bf7272cc41f8b64ee76b48bf01726248138430e16f23b38/rpds_py-2026.9.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:a5cf77eb04f20b720be95265a3e00eb2a14814074255cc27069c551b2db53118", size = 579602, upload-time = "2026-10-04T16:30:18.555Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/53/0d/5c72e6204f76610608706da32b6b7e11ef7e10317558a7bb15a122e008dc/rpds_py-2026.9.1-cp314-cp314-win32.whl", hash = "sha256:a03d57b86d2a51d0a66c92177e2be154ad015f357791d306e714569999cdb4cc", size = 206315, upload-time = "2026-10-04T16:30:20.05Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/a4/0b/489d48abbcc7d70cf3fbf662d9d22abf1f4650761c0a9ae05260800800d3/rpds_py-2026.9.1-cp314-cp314-win_amd64.whl", hash = "sha256:837c6b305e26fe0f75b15c92cf3b2ba29e0ae19dc40b1c557b026cb426347d0c", size = 222852, upload-time = "2026-10-04T16:30:21.604Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/91/16/bbb05a7e6a10cf79ba639be7f799d770ee15f64175cc61d081b218dd402a/rpds_py-2026.9.1-cp314-cp314-win_arm64.whl", hash = "sha256:fce4b85234a0cbad67bf8e6e1201ee815d172c9aebad75f25645bc4d834f8e31", size = 218709, upload-time = "2026-10-04T16:30:23.036Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/22/ac/ac507a0a4ec478ca470440a09583db4be5259ba7670aeba0620822f1e57a/rpds_py-2026.9.1-cp314-cp314t-macosx_10_12_x86_64.whl", hash = "sha256:3a72c11530d71abfb66c8d7696a2f86c43e63fca8b948f1a784ac490f4ec688e", size = 349596, upload-time = "2026-10-04T16:30:24.558Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e9/f2/817a46b658d5070f477f722c298ee9a24525b0e4017347964146ef5fdd0e/rpds_py-2026.9.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:068c37bba854ec2fe42f7365c640af11dd9895890ccbf2df5070d0c059bd7f96", size = 343114, upload-time = "2026-10-04T16:30:26.048Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6c/42/6ade976b13ac1b4cb3bf2eb603f1be2fe74df19a29988d4c2b386be59d6f/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d7fca4eb6df565e2a928f1c7dad92d27db8f9df0f449e76423ed5d7e713ed445", size = 374197, upload-time = "2026-10-04T16:30:27.699Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d9/70/77cdf1d3f1a07faabe936016ae623aec7981f73108a8fe7a203ed2e21998/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c933c6678c6f116ff8af47a4c6db0868b8ace74af0343016c0ef00f00272ea69", size = 378025, upload-time = "2026-10-04T16:30:29.451Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3f/6b/18a44a3beaa9b7931acb04af7bd9539836477c630a794452d4826d6185d4/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:028ad274ea951dac64491b5d1e65712a4aeabfdbdb9fccf797b57bd899b0c495", size = 491969, upload-time = "2026-10-04T16:30:30.995Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/73/27/fb39cfd6bddaf741b024f813890374578ff8ac1f1adc473659c048b03b05/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:740d0a99cf9de0b17a3943388e9294a59becf75e7c43421f387bd3c7a9901f7c", size = 393905, upload-time = "2026-10-04T16:30:32.628Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ed/71/0fa7bb77b57af0d710273964180d11b503f62b8a5c358eb2d8c3f62feff6/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0da298fb372dc192610a4b9ecbc68a0cd8b675bbbd1fc519d01b41cfd658333e", size = 374569, upload-time = "2026-10-04T16:30:34.257Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/54/22/f41cfac269af3b449513ef1bc3d7f32fde52abbbd2d01c7e76b47743acd9/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_31_riscv64.whl", hash = "sha256:eb61be926bb81567c1f48bdc8aa22b9855048dc2efd53871f9f7e6e9a5632346", size = 377482, upload-time = "2026-10-04T16:30:35.997Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b4/fc/312b49006e7f8f9ca5f96647577b8aa6f3df30519c46bd448f5c425af0b2/rpds_py-2026.9.1-cp314-cp314t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:42e75466f83cd43f6026c81eab74246efb2bdadafb307b85700632d06c68f299", size = 400040, upload-time = "2026-10-04T16:30:37.76Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/cf/a6/18cca7a878dc7fa95165a83343fd4d7b65643fd22e54e47340a451121d5c/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:617f59cde379b4f648a09797b7f683d04b90a46344cddab85639da5aff0f5531", size = 551849, upload-time = "2026-10-04T16:30:39.443Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/e4/6d/1f5685e20f39604691bdc3c05aaa6b8bd2f954e9e996477adf2376768e33/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3edae8c5ddfdb6985d49ae9d150516e5076888879022f91a26c2de9276ce0bdb", size = 614842, upload-time = "2026-10-04T16:30:41.231Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/c6/25/98652109fd9f7e10268dd4571aa52b81987001b806f37ef1a18260de714a/rpds_py-2026.9.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:0f045bb053c9057720d72c56dffe30dffdc05997b2897a827b9325f0ab6623fa", size = 582606, upload-time = "2026-10-04T16:30:43.345Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/19/03/11ca09099bab5f53373a80a334c424ec917c13d050760a59499d2af5171e/rpds_py-2026.9.1-cp314-cp314t-win32.whl", hash = "sha256:bf35d0568abda97233239ce32896d3ad53fccc537832c104e30c94aa5fb93569", size = 203341, upload-time = "2026-10-04T16:30:44.954Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6f/8a/88909e3ffd9f47f5b58211473875d8c3c09079f0058c46fb72c55a702a26/rpds_py-2026.9.1-cp314-cp314t-win_amd64.whl", hash = "sha256:1e8d4d79d828299bf44a55db22a9388ab967b49d17132c88eab0f4360b48da8e", size = 222843, upload-time = "2026-10-04T16:30:46.486Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f6/b7/a662f367d4896dd0a10cef2fc91f10b7f08af1c10858e287e019563f338d/rpds_py-2026.9.1-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:1d77b649e6f7cdf12ca5c2a98dad0ad37f9ea9b6f960408a92f0cb12bb3d04d9", size = 347463, upload-time = "2026-10-04T16:30:48.203Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ae/3f/ad45d03df4f84ebae5439577ee81f3999d182711e82235c8037b6528890e/rpds_py-2026.9.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:00ba2d8c7dd4ee537978ddf4b3fbd712bef2d8751603f7f3146b3f4287768e25", size = 342051, upload-time = "2026-10-04T16:30:49.872Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/7e/31/3dcd68c13d4bcc59c1f7eb33ac8e80698f06f3eb0d8a1e06419836071c20/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec450527cbf485e13c8d3602a54f428ab0432fdade0ede75efd74b735421c871", size = 374143, upload-time = "2026-10-04T16:30:51.508Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/cf/0d/68c1f058a250fbd1380ebda9fc227cbf50117adf8ffe8161ef383ea79f68/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:306ee1850d8105b5baf977e78d45fcadd12c1a54678d614c9baf217708446e91", size = 378604, upload-time = "2026-10-04T16:30:53.206Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/d7/d6/2d4c59b85397cb4800594fadf692688ccf5ce556adc930e7a5bf21061a5e/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ef6b65b03247c54692ad4fd9ee97cb772781927db72e3cb05e70b3db6d1ff14f", size = 490790, upload-time = "2026-10-04T16:30:54.925Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/da/04/7e05dc3aebaf52f4e026766bd668fdd09a9d0e23f64a14686b36b3501892/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a575404ebc9cf2e91edd32eaf570ec1430eb900d4f56724ba7dd4bc1fc9c176d", size = 393146, upload-time = "2026-10-04T16:30:56.625Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/57/ca/e2e9a0a46a74ed51a0498ba1fe10f4ea6b2d9a155f372a2f91e51f18cf10/rpds_py-2026.9.1-cp315-cp315-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2c16ab111bc27c646ba8aa005d0527754edc538ebb636f0b1bf8e244b48d1945", size = 372022, upload-time = "2026-10-04T16:30:58.295Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ba/cb/8f8774df5134e23424372838bcc5c7ed4127d723e1ff52f7bebd4dcb2563/rpds_py-2026.9.1-cp315-cp315-manylinux_2_31_riscv64.whl", hash = "sha256:7664419f27db41d4f1c43a78dccda7dd6e8ef2428df3ee01d0c2a07a6b071297", size = 377092, upload-time = "2026-10-04T16:30:59.984Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/90/02/8d7095d73bf9114219be40230baa5df00611e0a82ed9517779ff9c19f82b/rpds_py-2026.9.1-cp315-cp315-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:4b26b03d9d2658ee2fa234f8f4f19f38a09773fe5261028025032e26d4d35af0", size = 400830, upload-time = "2026-10-04T16:31:01.721Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/ec/02/8206856f8f363cd042a8315dc86b3912f5dcb6d3c66bbb24b69c2bfb0775/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:be3e47e2d91aa3942ff9bf4077a505226005abfc39b6f7554a91c1b9393986b9", size = 551478, upload-time = "2026-10-04T16:31:03.472Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/41/6b/36211f1bb1f0b0313f496d92f5905b74ea107f27cb16fa3355a82f04575e/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:6307a0da524939decb8ca4a3933b8ab62525794411d6984fca6726e732804af6", size = 615173, upload-time = "2026-10-04T16:31:05.281Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/35/77/cda0c4a6f055446b692f0ed5692f73707cafd3dff82672ede31b1a9b59de/rpds_py-2026.9.1-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:159a7aab5c5e8b112c8830f54717ce56da1252ebdbb526f5be2df2309280b9e7", size = 579653, upload-time = "2026-10-04T16:31:07.065Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/74/ec/d8385f446240aed643b9e92a5055cff3015cc04a13c61f73b2883c478ed5/rpds_py-2026.9.1-cp315-cp315-win32.whl", hash = "sha256:dbc2673f9223d420c91145599b3ba45a8a50c207d1976908e5fb5ddb0c9b9429", size = 206498, upload-time = "2026-10-04T16:31:08.989Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6d/a5/71b5cd00e0521e3b6b81828baea368c62b6b700ebdd9554cd7d41ddf12fa/rpds_py-2026.9.1-cp315-cp315-win_amd64.whl", hash = "sha256:75c38c50ab9aca840225d9a9a3810bf11d04bd5c1f186cabbb8aee56db3e9b15", size = 223121, upload-time = "2026-10-04T16:31:10.84Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/33/58/dba857c3bc8221b31b62eb170a3080f4f191de79f047200389b7ed1b06a7/rpds_py-2026.9.1-cp315-cp315-win_arm64.whl", hash = "sha256:a431156bb41865fc14cd5d79bb9d7bbed83110b0159e34e62ae30951f96c0009", size = 218741, upload-time = "2026-10-04T16:31:12.592Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/5b/d0/320ab28ccc1415eeb509d68682b0014fb74690cd49f1c2d29a232475af50/rpds_py-2026.9.1-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:ef0d8c843e2827d6c120ab4687e9423fb1d893db1df27b7c1506615bcb9734a0", size = 349719, upload-time = "2026-10-04T16:31:14.48Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/56/88/f5b12f1358f443c08b7ce3cc8391d82d335f4872580e2e097847fd36087a/rpds_py-2026.9.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:45bc6bccf78b20fd834237d18db64965d7ee68ba7f60440a26c7ab71e7b8d51a", size = 343267, upload-time = "2026-10-04T16:31:16.827Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/f7/0c/c765b0059d532acb3b9c45d781ccc22f15a96dbe443d00903f643ba9df10/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1d55198263bb51f557550c6ed2e6d1cb6a6fed6eb5c9120b741c5926bef8a45d", size = 374555, upload-time = "2026-10-04T16:31:18.931Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/6b/8a/cafddfda77564a10cd21184640c3bffda6a2b8d20972fb5dedd5e0166328/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:a8763f20692da7df39b0afdd1ba3042b004c50a45994f76c2d9a25641f7673db", size = 378346, upload-time = "2026-10-04T16:31:20.75Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/b9/01/5e626016eff72c183bf6c96539240cace15d402468647a453ec08415b2fc/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:e43d4a1f673e8a1cbd8533e809e02b4bf9d4f2280269bb640436556312121250", size = 492373, upload-time = "2026-10-04T16:31:22.614Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3b/9c/15a2469e9389242f46896b3f0a01d68caea8a5a35c011fcb05ef333aae73/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:ea394a937f17a54c51239348bdbe2e3518124c8d4a8951ba04a311d3095bd18f", size = 394371, upload-time = "2026-10-04T16:31:24.768Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/63/f5/c100ff77e1e6366e947c75969c258fdfc4b7bc5bbfe7351e62ffbf2a1228/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdeaa99ce822dca76cfb1b993e9120c5ea212f2eb66d48950ad63c349668a018", size = 375132, upload-time = "2026-10-04T16:31:26.588Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/dd/f4/fe0269c9de253e99c81cabc12b8971a5feaa083debdaff1221e06264d9e3/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_31_riscv64.whl", hash = "sha256:b4f062343e7ad3fa94f2c66e5ae667dee47ee74dd41a9057c4fbe163236a123d", size = 377642, upload-time = "2026-10-04T16:31:28.677Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/05/65/b34a7b257baccff8f4a24a722933166d4941d5ebdc9c3f4bc4ffcd5ce4f4/rpds_py-2026.9.1-cp315-cp315t-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:22ffd29a63d71fb1b81552c21f2c2b734949b7ac751a9be70675a939a900839b", size = 400855, upload-time = "2026-10-04T16:31:30.802Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/98/32/844e54176b6071b90b38a564e6940bc6eb8f97b2890dc709c19db9dec0f4/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:08dae4a4095150a7c4545a1fb40b98e1ab1744fbc2770d92c977b9dadaa49ab6", size = 552573, upload-time = "2026-10-04T16:31:32.709Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/17/73/6041d20729dffbfdf155c02d65be58bc225a1c1fb548fd87c23ef306138f/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:9a0460d43603d1fd9ef59c30278531e15d78581721ddb538fa560aa7817ea4ad", size = 615840, upload-time = "2026-10-04T16:31:34.565Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/af/9e/418094adaee6b056ce199051b255448ed872829051e341b2294c80da0977/rpds_py-2026.9.1-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:1c2d1f6da5128eabf34e963d7163a818846075a52568250d006c4c953b40f903", size = 582764, upload-time = "2026-10-04T16:31:36.665Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/3d/9b/1698ebf6b840ddfe8b472198abbed6ace35c6e398faeecd6c47dae742a4e/rpds_py-2026.9.1-cp315-cp315t-win32.whl", hash = "sha256:5c6ee90dee3e85e055ddfd502d611643d9b0fd94c818220bda84ec3dacd9b27b", size = 203795, upload-time = "2026-10-04T16:31:38.53Z" },
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/8a/e2/91f70d804c61f8eac39a417e82aa1024f655ab9e8bdd7393b196242bc41b/rpds_py-2026.9.1-cp315-cp315t-win_amd64.whl", hash = "sha256:fe5ad0664ec772b02c45859041aa17655709cced7a31005817fbbbd988c25567", size = 223037, upload-time = "2026-10-04T16:31:40.468Z" },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "urllib3"
|
|
||||||
version = "2.8.0"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/e3/05/b17359e1cefb4f909b5e40b1b90a496d987258916dbbf88e842c729f510e/urllib3-2.8.0.tar.gz", hash = "sha256:63bf2ead4c879426ebf22ef2a781eeb4aa3b4ae798a0435506f8687fd5bb9b63", size = 458972, upload-time = "2026-09-15T19:29:36.253Z" }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/92/9d/c4e665119135114480843e7ab388fa94d8480650450e6f8e26b70d323a4c/urllib3-2.8.0-py3-none-any.whl", hash = "sha256:0cf3cae568d36aa9576b28dfb35f11328f1cb974ca7647d9475ebb86c75ac6e3", size = 135717, upload-time = "2026-09-15T19:29:34.577Z" },
|
|
||||||
]
|
|
||||||
@ -65,7 +65,7 @@ repos:
|
|||||||
types: [python]
|
types: [python]
|
||||||
|
|
||||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.17.4
|
rev: v0.17.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
args: [--fix, --unsafe-fixes, --exit-non-zero-on-fix, --show-fixes]
|
||||||
@ -103,19 +103,14 @@ repos:
|
|||||||
- --disable-error-code=list-item
|
- --disable-error-code=list-item
|
||||||
|
|
||||||
- repo: https://github.com/pylint-dev/pylint
|
- repo: https://github.com/pylint-dev/pylint
|
||||||
rev: v4.1.4
|
rev: v4.0.8
|
||||||
hooks:
|
hooks:
|
||||||
- id: pylint
|
- id: pylint
|
||||||
args:
|
args:
|
||||||
- --rcfile=crdt-sync/pyproject.toml
|
- --rcfile=crdt-sync/pyproject.toml
|
||||||
- --fail-under=10
|
- --fail-under=10
|
||||||
# One process: with --jobs>1 pylint pickles its AST via dill, which
|
- --jobs=4
|
||||||
# dies on Python 3.15 (code objects lost co_lnotab), 2026-11-16.
|
|
||||||
- --jobs=1
|
|
||||||
additional_dependencies:
|
additional_dependencies:
|
||||||
# Kept in step with pyproject.toml, so pylint resolves the e2e imports.
|
|
||||||
- argon2-cffi==25.1.0
|
|
||||||
- pynacl==1.6.2
|
|
||||||
- pytest
|
- pytest
|
||||||
- requests
|
- requests
|
||||||
|
|
||||||
|
|||||||
@ -14,30 +14,6 @@ from crdt_sync._config import (
|
|||||||
mirror_client_for,
|
mirror_client_for,
|
||||||
)
|
)
|
||||||
from crdt_sync._device import DeviceIdentity, load_device_identity
|
from crdt_sync._device import DeviceIdentity, load_device_identity
|
||||||
from crdt_sync._e2e_cipher import (
|
|
||||||
E2eCipher,
|
|
||||||
E2eDecryptError,
|
|
||||||
is_e2e_envelope,
|
|
||||||
open_log_text,
|
|
||||||
seal_log_text,
|
|
||||||
)
|
|
||||||
from crdt_sync._e2e_cleanup import clear_plaintext_prefix, unverified_blobs
|
|
||||||
from crdt_sync._e2e_key import (
|
|
||||||
Argon2Params,
|
|
||||||
E2eHeaderError,
|
|
||||||
E2eKey,
|
|
||||||
E2eWrongPassphraseError,
|
|
||||||
default_e2e_path,
|
|
||||||
unlock_e2e,
|
|
||||||
)
|
|
||||||
from crdt_sync._e2e_store import (
|
|
||||||
E2eLayout,
|
|
||||||
E2eLockedError,
|
|
||||||
EncryptingStore,
|
|
||||||
copy_to_encrypted,
|
|
||||||
open_encrypted_client,
|
|
||||||
reset_e2e_copy_memo,
|
|
||||||
)
|
|
||||||
from crdt_sync._firebase import (
|
from crdt_sync._firebase import (
|
||||||
DatabaseNotFoundError,
|
DatabaseNotFoundError,
|
||||||
FirebaseSyncClient,
|
FirebaseSyncClient,
|
||||||
@ -75,19 +51,10 @@ __all__ = [
|
|||||||
"CONFIG_DIR",
|
"CONFIG_DIR",
|
||||||
"CONFIG_FILE",
|
"CONFIG_FILE",
|
||||||
"PASSWORD_FILE",
|
"PASSWORD_FILE",
|
||||||
"Argon2Params",
|
|
||||||
"ConfigError",
|
"ConfigError",
|
||||||
"CredentialStore",
|
"CredentialStore",
|
||||||
"DatabaseNotFoundError",
|
"DatabaseNotFoundError",
|
||||||
"DeviceIdentity",
|
"DeviceIdentity",
|
||||||
"E2eCipher",
|
|
||||||
"E2eDecryptError",
|
|
||||||
"E2eHeaderError",
|
|
||||||
"E2eKey",
|
|
||||||
"E2eLayout",
|
|
||||||
"E2eLockedError",
|
|
||||||
"E2eWrongPassphraseError",
|
|
||||||
"EncryptingStore",
|
|
||||||
"Field",
|
"Field",
|
||||||
"FileCredentialStore",
|
"FileCredentialStore",
|
||||||
"FileSyncStateStore",
|
"FileSyncStateStore",
|
||||||
@ -114,28 +81,18 @@ __all__ = [
|
|||||||
"SyncState",
|
"SyncState",
|
||||||
"SyncStateStore",
|
"SyncStateStore",
|
||||||
"SyncTarget",
|
"SyncTarget",
|
||||||
"clear_plaintext_prefix",
|
|
||||||
"copy_to_encrypted",
|
|
||||||
"credential_store_for",
|
"credential_store_for",
|
||||||
"default_e2e_path",
|
|
||||||
"default_revs_path",
|
"default_revs_path",
|
||||||
"dump_log",
|
"dump_log",
|
||||||
"firebase_client_for",
|
"firebase_client_for",
|
||||||
"is_e2e_envelope",
|
|
||||||
"load_device_identity",
|
"load_device_identity",
|
||||||
"load_log",
|
"load_log",
|
||||||
"merge_field",
|
"merge_field",
|
||||||
"merge_logs",
|
"merge_logs",
|
||||||
"merge_record",
|
"merge_record",
|
||||||
"mirror_client_for",
|
"mirror_client_for",
|
||||||
"open_encrypted_client",
|
|
||||||
"open_log_text",
|
|
||||||
"read_log",
|
"read_log",
|
||||||
"reset_e2e_copy_memo",
|
|
||||||
"revision_of",
|
"revision_of",
|
||||||
"seal_log_text",
|
|
||||||
"sync_log",
|
"sync_log",
|
||||||
"unlock_e2e",
|
|
||||||
"unverified_blobs",
|
|
||||||
"write_log",
|
"write_log",
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,32 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Read every text blob under an old (plaintext) prefix, for the e2e copy."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from crdt_sync._sync import default_revs_path
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from crdt_sync._remote import RemoteStore
|
|
||||||
|
|
||||||
|
|
||||||
def blobs(store: RemoteStore, root: str) -> dict[str, str]:
|
|
||||||
"""Every text blob under ``root`` (flat leaves and ``<dir>/<file>``)."""
|
|
||||||
skip = {default_revs_path(root), f"{root}/e2e", f"{root}/revs"}
|
|
||||||
out: dict[str, str] = {}
|
|
||||||
for name in store.list_directory(root):
|
|
||||||
full = f"{root}/{name}"
|
|
||||||
if full in skip:
|
|
||||||
continue
|
|
||||||
children = store.list_directory(full)
|
|
||||||
if not children:
|
|
||||||
text = store.get_file_text(full)
|
|
||||||
if text is not None:
|
|
||||||
out[name] = text
|
|
||||||
continue
|
|
||||||
for child in children:
|
|
||||||
text = store.get_file_text(f"{full}/{child}")
|
|
||||||
if text is not None:
|
|
||||||
out[f"{name}/{child}"] = text
|
|
||||||
return out
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""On-disk E2E state for short-lived daemons (one process per tick).
|
|
||||||
|
|
||||||
The derived key is cached ``0600`` beside the app's other state, so Argon2id
|
|
||||||
runs once per machine rather than once a minute; it is no more sensitive
|
|
||||||
than ``~/.config/crdt-sync/password``, which it is derived from. The copy
|
|
||||||
memo records the old prefix's revisions last copied, so an unchanged old
|
|
||||||
prefix is not re-scanned every tick.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import hashlib
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
_MASTER = 32
|
|
||||||
|
|
||||||
|
|
||||||
def _slug(old_prefix: str) -> str:
|
|
||||||
return hashlib.sha256(old_prefix.encode()).hexdigest()[:16]
|
|
||||||
|
|
||||||
|
|
||||||
def read_cached_key(state_dir: Path, old_prefix: str) -> bytes | None:
|
|
||||||
"""Return the cached 32-byte master key, or None."""
|
|
||||||
path = state_dir / f"e2e-{_slug(old_prefix)}.key"
|
|
||||||
if not path.exists():
|
|
||||||
return None
|
|
||||||
try:
|
|
||||||
master = bytes.fromhex(path.read_text(encoding="utf-8").strip())
|
|
||||||
except ValueError:
|
|
||||||
return None
|
|
||||||
return master if len(master) == _MASTER else None
|
|
||||||
|
|
||||||
|
|
||||||
def write_cached_key(state_dir: Path, old_prefix: str, master: bytes) -> None:
|
|
||||||
"""Store the master key owner-only."""
|
|
||||||
state_dir.mkdir(parents=True, exist_ok=True)
|
|
||||||
path = state_dir / f"e2e-{_slug(old_prefix)}.key"
|
|
||||||
path.touch(mode=0o600, exist_ok=True)
|
|
||||||
path.chmod(0o600)
|
|
||||||
path.write_text(master.hex(), encoding="utf-8")
|
|
||||||
|
|
||||||
|
|
||||||
def read_copy_memo(state_dir: Path, old_prefix: str) -> str | None:
|
|
||||||
"""Return the old-prefix fingerprint last copied, or None."""
|
|
||||||
path = state_dir / f"e2e-{_slug(old_prefix)}.copied"
|
|
||||||
return path.read_text(encoding="utf-8") if path.exists() else None
|
|
||||||
|
|
||||||
|
|
||||||
def write_copy_memo(state_dir: Path, old_prefix: str, fingerprint: str) -> None:
|
|
||||||
"""Record that the old prefix was copied at ``fingerprint``."""
|
|
||||||
state_dir.mkdir(parents=True, exist_ok=True)
|
|
||||||
path = state_dir / f"e2e-{_slug(old_prefix)}.copied"
|
|
||||||
path.write_text(fingerprint, encoding="utf-8")
|
|
||||||
@ -1,202 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""XChaCha20-Poly1305 blob cipher and per-record envelope.
|
|
||||||
|
|
||||||
Byte-compatible with ``crdt_sync_dart``'s ``E2eCipher`` and
|
|
||||||
``sealLogText``/``openLogText``: a blob is base64 ``[version][nonce][ct][tag]``
|
|
||||||
with ``[version] + utf8(path)`` as AAD; an envelope keeps record ids, the
|
|
||||||
tombstone and the newest HLC clear and seals each record's fields.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import binascii
|
|
||||||
import json
|
|
||||||
import secrets
|
|
||||||
from typing import cast
|
|
||||||
|
|
||||||
from nacl.bindings import (
|
|
||||||
crypto_aead_xchacha20poly1305_ietf_decrypt,
|
|
||||||
crypto_aead_xchacha20poly1305_ietf_encrypt,
|
|
||||||
)
|
|
||||||
from nacl.exceptions import CryptoError
|
|
||||||
|
|
||||||
from crdt_sync._hlc import Hlc
|
|
||||||
|
|
||||||
E2E_FORMAT_VERSION = 1
|
|
||||||
_NONCE = 24
|
|
||||||
_TAG = 16
|
|
||||||
_KEY = 32
|
|
||||||
|
|
||||||
|
|
||||||
class E2eDecryptError(ValueError):
|
|
||||||
"""A blob that is tampered, under another key, or in an unknown format.
|
|
||||||
|
|
||||||
A ``ValueError`` so the pull loop skips the peer instead of aborting.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def is_plaintext(stored: str) -> bool:
|
|
||||||
"""Return whether ``stored`` is legacy JSON rather than a sealed blob."""
|
|
||||||
return stored.lstrip().startswith(("{", "["))
|
|
||||||
|
|
||||||
|
|
||||||
def _aad(version: int, path: str) -> bytes:
|
|
||||||
return bytes([version]) + path.encode()
|
|
||||||
|
|
||||||
|
|
||||||
class E2eCipher:
|
|
||||||
"""Seals and opens blobs bound to their remote path."""
|
|
||||||
|
|
||||||
def __init__(self, key: bytes, *, accept_plaintext: bool = True) -> None:
|
|
||||||
"""Wrap a 32-byte ``key``; ``accept_plaintext`` reads old peers."""
|
|
||||||
if len(key) != _KEY:
|
|
||||||
msg = "key must be 32 bytes"
|
|
||||||
raise ValueError(msg)
|
|
||||||
self._key = bytes(key)
|
|
||||||
self.accept_plaintext = accept_plaintext
|
|
||||||
|
|
||||||
def seal(self, plaintext: str, *, path: str) -> str:
|
|
||||||
"""Return ``plaintext`` sealed for ``path``."""
|
|
||||||
nonce = secrets.token_bytes(_NONCE)
|
|
||||||
box = crypto_aead_xchacha20poly1305_ietf_encrypt(
|
|
||||||
plaintext.encode(), _aad(E2E_FORMAT_VERSION, path), nonce, self._key
|
|
||||||
)
|
|
||||||
return base64.b64encode(bytes([E2E_FORMAT_VERSION]) + nonce + box).decode()
|
|
||||||
|
|
||||||
def open(self, stored: str, *, path: str) -> str:
|
|
||||||
"""Return the plaintext of ``stored``; raise :class:`E2eDecryptError`."""
|
|
||||||
if is_plaintext(stored):
|
|
||||||
if self.accept_plaintext:
|
|
||||||
return stored
|
|
||||||
msg = f"plaintext blob at {path} after migration"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
try:
|
|
||||||
raw = base64.b64decode(stored, validate=True)
|
|
||||||
except binascii.Error as exc:
|
|
||||||
msg = f"blob at {path} is neither JSON nor base64"
|
|
||||||
raise E2eDecryptError(msg) from exc
|
|
||||||
if not raw:
|
|
||||||
msg = f"empty blob at {path}"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
if raw[0] != E2E_FORMAT_VERSION:
|
|
||||||
msg = f"blob at {path} uses format {raw[0]}; update the app"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
if len(raw) < 1 + _NONCE + _TAG:
|
|
||||||
msg = f"blob at {path} is truncated"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
try:
|
|
||||||
clear = crypto_aead_xchacha20poly1305_ietf_decrypt(
|
|
||||||
raw[1 + _NONCE :], _aad(raw[0], path), raw[1 : 1 + _NONCE], self._key
|
|
||||||
)
|
|
||||||
except CryptoError as exc:
|
|
||||||
msg = f"blob at {path} failed authentication"
|
|
||||||
raise E2eDecryptError(msg) from exc
|
|
||||||
return clear.decode()
|
|
||||||
|
|
||||||
|
|
||||||
def is_e2e_envelope(text: str) -> bool:
|
|
||||||
"""Return whether ``text`` is an envelope (integer ``"v"``)."""
|
|
||||||
try:
|
|
||||||
data = json.loads(text)
|
|
||||||
except ValueError:
|
|
||||||
return False
|
|
||||||
version = data.get("v") if isinstance(data, dict) else None
|
|
||||||
return isinstance(version, int) and not isinstance(version, bool)
|
|
||||||
|
|
||||||
|
|
||||||
def _record_aad(
|
|
||||||
path: str, rid: str, deleted: object, deleted_hlc: object, newest: object
|
|
||||||
) -> str:
|
|
||||||
flag = 1 if deleted is True else 0
|
|
||||||
return f"{path}#{rid}#{flag}#{deleted_hlc or ''}#{newest or ''}"
|
|
||||||
|
|
||||||
|
|
||||||
def _as_log(text: str) -> dict[str, dict[str, object]] | None:
|
|
||||||
try:
|
|
||||||
raw = json.loads(text)
|
|
||||||
except ValueError:
|
|
||||||
return None
|
|
||||||
if not isinstance(raw, dict):
|
|
||||||
return None
|
|
||||||
for rid, rec in raw.items():
|
|
||||||
if not isinstance(rec, dict) or rec.get("id") != rid:
|
|
||||||
return None
|
|
||||||
if not isinstance(rec.get("fields"), dict):
|
|
||||||
return None
|
|
||||||
return cast("dict[str, dict[str, object]]", raw)
|
|
||||||
|
|
||||||
|
|
||||||
def _newest(fields: dict[str, list[object]]) -> str | None:
|
|
||||||
clocks = [Hlc.from_str(str(pair[1])) for pair in fields.values()]
|
|
||||||
return max(clocks).to_str() if clocks else None
|
|
||||||
|
|
||||||
|
|
||||||
def seal_log_text(text: str, cipher: E2eCipher, *, path: str) -> str:
|
|
||||||
"""Seal a log (``dump_log`` shape) as an envelope; anything else whole."""
|
|
||||||
log = _as_log(text)
|
|
||||||
if log is None:
|
|
||||||
return json.dumps(
|
|
||||||
{"v": E2E_FORMAT_VERSION, "b": cipher.seal(text, path=path)},
|
|
||||||
separators=(",", ":"),
|
|
||||||
)
|
|
||||||
records: dict[str, object] = {}
|
|
||||||
for rid, rec in log.items():
|
|
||||||
fields = cast("dict[str, list[object]]", rec["fields"])
|
|
||||||
deleted = rec.get("deleted") is True
|
|
||||||
deleted_hlc = rec.get("deleted_hlc")
|
|
||||||
newest = _newest(fields)
|
|
||||||
records[rid] = {
|
|
||||||
"d": deleted,
|
|
||||||
"dh": deleted_hlc,
|
|
||||||
"h": newest,
|
|
||||||
"p": cipher.seal(
|
|
||||||
json.dumps(fields, separators=(",", ":"), ensure_ascii=False),
|
|
||||||
path=_record_aad(path, rid, deleted, deleted_hlc, newest),
|
|
||||||
),
|
|
||||||
}
|
|
||||||
return json.dumps(
|
|
||||||
{"v": E2E_FORMAT_VERSION, "r": records},
|
|
||||||
separators=(",", ":"),
|
|
||||||
ensure_ascii=False,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def open_log_text(text: str, cipher: E2eCipher, *, path: str) -> str:
|
|
||||||
"""Open an envelope back to the ``dump_log`` shape."""
|
|
||||||
if not is_e2e_envelope(text):
|
|
||||||
if cipher.accept_plaintext:
|
|
||||||
return text
|
|
||||||
msg = f"plaintext blob at {path} after migration"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
data = json.loads(text)
|
|
||||||
if data["v"] != E2E_FORMAT_VERSION:
|
|
||||||
msg = f"blob at {path} uses format {data['v']}; update the app"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
whole = data.get("b")
|
|
||||||
if isinstance(whole, str):
|
|
||||||
return cipher.open(whole, path=path)
|
|
||||||
records = data.get("r")
|
|
||||||
if not isinstance(records, dict):
|
|
||||||
msg = f"envelope at {path} is mis-shaped"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
out: dict[str, object] = {}
|
|
||||||
for rid, rec in records.items():
|
|
||||||
if (
|
|
||||||
not isinstance(rec, dict)
|
|
||||||
or not isinstance(rec.get("p"), str)
|
|
||||||
or not isinstance(rec.get("d"), bool)
|
|
||||||
):
|
|
||||||
msg = f"record {rid} at {path} is mis-shaped"
|
|
||||||
raise E2eDecryptError(msg)
|
|
||||||
clear = cipher.open(
|
|
||||||
rec["p"],
|
|
||||||
path=_record_aad(path, rid, rec["d"], rec.get("dh"), rec.get("h")),
|
|
||||||
)
|
|
||||||
out[rid] = {
|
|
||||||
"id": rid,
|
|
||||||
"fields": json.loads(clear),
|
|
||||||
"deleted": rec["d"],
|
|
||||||
"deleted_hlc": rec.get("dh"),
|
|
||||||
}
|
|
||||||
return json.dumps(out, separators=(",", ":"), ensure_ascii=False)
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Clear an app's old plaintext prefix once its encrypted copy is proven.
|
|
||||||
|
|
||||||
The migration never deletes the old prefix by itself: an old build may still
|
|
||||||
write there. Run this once every device runs an encrypting build. It never
|
|
||||||
creates a header (a typo'd passphrase must not lock the app for good) and
|
|
||||||
deletes nothing unless every old blob is contained in the encrypted copy.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import hmac
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from crdt_sync._e2e_blobs import blobs as _blobs
|
|
||||||
from crdt_sync._e2e_key import derive_key, read_header
|
|
||||||
from crdt_sync._e2e_store import E2eLayout, E2eLockedError, EncryptingStore
|
|
||||||
from crdt_sync._log import merge_logs
|
|
||||||
from crdt_sync._store import dump_log, load_log
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from crdt_sync._e2e_key import E2eKey
|
|
||||||
from crdt_sync._remote import RemoteStore
|
|
||||||
|
|
||||||
|
|
||||||
def unverified_blobs(
|
|
||||||
store: RemoteStore, key: E2eKey, old_prefix: str, layout: E2eLayout
|
|
||||||
) -> list[str]:
|
|
||||||
"""Return old blobs (relative paths) not fully contained in the copy."""
|
|
||||||
dest = EncryptingStore(store, key, layout)
|
|
||||||
missing: list[str] = []
|
|
||||||
for rel, text in sorted(_blobs(store, old_prefix).items()):
|
|
||||||
try:
|
|
||||||
source = load_log(text)
|
|
||||||
copied = dest.get_file_text(f"{layout.prefix}/{rel}")
|
|
||||||
current = load_log(copied) if copied is not None else None
|
|
||||||
except ValueError, KeyError, TypeError:
|
|
||||||
missing.append(rel)
|
|
||||||
continue
|
|
||||||
if not source:
|
|
||||||
continue
|
|
||||||
if current is None or dump_log(merge_logs(current, source)) != dump_log(
|
|
||||||
current
|
|
||||||
):
|
|
||||||
missing.append(rel)
|
|
||||||
return missing
|
|
||||||
|
|
||||||
|
|
||||||
def _existing_key(store: RemoteStore, layout: E2eLayout, passphrase: str) -> E2eKey:
|
|
||||||
header = read_header(store, layout.e2e_path)
|
|
||||||
if header is None:
|
|
||||||
msg = f"no e2e header at {layout.e2e_path}: nothing was migrated"
|
|
||||||
raise E2eLockedError(msg)
|
|
||||||
key = derive_key(passphrase, header.salt, header.params)
|
|
||||||
if not hmac.compare_digest(key.check_for(header.salt), header.check):
|
|
||||||
msg = "wrong crdt-sync passphrase"
|
|
||||||
raise E2eLockedError(msg)
|
|
||||||
return key
|
|
||||||
|
|
||||||
|
|
||||||
def clear_plaintext_prefix(
|
|
||||||
store: RemoteStore, old_prefix: str, *, passphrase: str, apply: bool
|
|
||||||
) -> list[str]:
|
|
||||||
"""Return the old paths to delete; delete them only when ``apply``.
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
E2eLockedError: No header, a wrong passphrase, or a copy that does
|
|
||||||
not yet hold every old record.
|
|
||||||
"""
|
|
||||||
layout = E2eLayout.of(old_prefix)
|
|
||||||
key = _existing_key(store, layout, passphrase)
|
|
||||||
missing = unverified_blobs(store, key, old_prefix, layout)
|
|
||||||
if missing:
|
|
||||||
msg = f"copy not verified for {', '.join(missing)}"
|
|
||||||
raise E2eLockedError(msg)
|
|
||||||
paths = [f"{old_prefix}/{rel}" for rel in sorted(_blobs(store, old_prefix))]
|
|
||||||
if apply:
|
|
||||||
for path in paths:
|
|
||||||
store.delete_file(path, message="e2e: clear plaintext prefix")
|
|
||||||
return paths
|
|
||||||
@ -1,193 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Argon2id key from the shared crdt-sync password, plus HKDF subkeys.
|
|
||||||
|
|
||||||
Byte-compatible with ``crdt_sync_dart``'s ``E2eKey``/``unlockE2e``: the clear
|
|
||||||
header at ``e2e_path`` holds salt, Argon2id cost and a check MAC, never a key.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import base64
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import hashlib
|
|
||||||
import hmac
|
|
||||||
import json
|
|
||||||
import secrets
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from argon2.low_level import Type, hash_secret_raw
|
|
||||||
|
|
||||||
from crdt_sync._e2e_cipher import E2eCipher
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from crdt_sync._remote import RemoteStore
|
|
||||||
|
|
||||||
_SALT = 16
|
|
||||||
_MASTER = 32
|
|
||||||
_HEADER_VERSION = 1
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class Argon2Params:
|
|
||||||
"""Argon2id cost, stored in the header so it can be raised later."""
|
|
||||||
|
|
||||||
memory_kib: int = 19456
|
|
||||||
iterations: int = 2
|
|
||||||
parallelism: int = 1
|
|
||||||
|
|
||||||
|
|
||||||
class E2eHeaderError(ValueError):
|
|
||||||
"""The header exists but cannot be parsed; it is never overwritten."""
|
|
||||||
|
|
||||||
|
|
||||||
class E2eWrongPassphraseError(Exception):
|
|
||||||
"""The passphrase does not match the header's check."""
|
|
||||||
|
|
||||||
|
|
||||||
def default_e2e_path(path_prefix: str) -> str:
|
|
||||||
"""Return the header path: a sibling of the device dirs, like ``revs``."""
|
|
||||||
head, sep, _ = path_prefix.rpartition("/")
|
|
||||||
return f"{head}/e2e" if sep else f"{path_prefix}/e2e"
|
|
||||||
|
|
||||||
|
|
||||||
def _hkdf(master: bytes, label: str) -> bytes:
|
|
||||||
prk = hmac.new(b"", master, hashlib.sha256).digest()
|
|
||||||
info = f"crdt_sync e2e {label}".encode()
|
|
||||||
return hmac.new(prk, info + b"\x01", hashlib.sha256).digest()
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class E2eKey:
|
|
||||||
"""A 32-byte master key and its subkeys. Never written to the remote."""
|
|
||||||
|
|
||||||
master: bytes
|
|
||||||
enc: bytes
|
|
||||||
rev: bytes
|
|
||||||
check: bytes
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_bytes(cls, master: bytes) -> E2eKey:
|
|
||||||
"""Expand a cached 32-byte master key."""
|
|
||||||
if len(master) != _MASTER:
|
|
||||||
msg = "master key must be 32 bytes"
|
|
||||||
raise ValueError(msg)
|
|
||||||
return cls(
|
|
||||||
master, _hkdf(master, "enc"), _hkdf(master, "rev"), _hkdf(master, "check")
|
|
||||||
)
|
|
||||||
|
|
||||||
def cipher(self, *, accept_plaintext: bool = True) -> E2eCipher:
|
|
||||||
"""Return the blob cipher for this key."""
|
|
||||||
return E2eCipher(self.enc, accept_plaintext=accept_plaintext)
|
|
||||||
|
|
||||||
def revision(self, text: str) -> str:
|
|
||||||
"""Return the keyed revision (hex HMAC-SHA256) of ``text``."""
|
|
||||||
return hmac.new(self.rev, text.encode(), hashlib.sha256).hexdigest()
|
|
||||||
|
|
||||||
def check_for(self, salt: bytes) -> str:
|
|
||||||
"""Return the header check value for ``salt``."""
|
|
||||||
mac = hmac.new(self.check, salt, hashlib.sha256).digest()
|
|
||||||
return base64.b64encode(mac).decode()
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class _Header:
|
|
||||||
salt: bytes
|
|
||||||
params: Argon2Params
|
|
||||||
check: str
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def parse(cls, text: str) -> _Header:
|
|
||||||
"""Read a header from its JSON text; ``E2eHeaderError`` if it is not one."""
|
|
||||||
try:
|
|
||||||
data = json.loads(text)
|
|
||||||
except ValueError as exc:
|
|
||||||
msg = "e2e header is not JSON"
|
|
||||||
raise E2eHeaderError(msg) from exc
|
|
||||||
if not isinstance(data, dict) or data.get("v") != _HEADER_VERSION:
|
|
||||||
msg = "e2e header is not a known version"
|
|
||||||
raise E2eHeaderError(msg)
|
|
||||||
if data.get("kdf") != "argon2id":
|
|
||||||
msg = "e2e header is malformed"
|
|
||||||
raise E2eHeaderError(msg)
|
|
||||||
try:
|
|
||||||
return cls(
|
|
||||||
base64.b64decode(data["salt"]),
|
|
||||||
Argon2Params(int(data["m"]), int(data["t"]), int(data["p"])),
|
|
||||||
str(data["check"]),
|
|
||||||
)
|
|
||||||
except (KeyError, TypeError, ValueError) as exc:
|
|
||||||
msg = "e2e header is malformed"
|
|
||||||
raise E2eHeaderError(msg) from exc
|
|
||||||
|
|
||||||
def encode(self) -> str:
|
|
||||||
"""The header as the JSON text ``parse`` reads back."""
|
|
||||||
return json.dumps(
|
|
||||||
{
|
|
||||||
"v": _HEADER_VERSION,
|
|
||||||
"kdf": "argon2id",
|
|
||||||
"salt": base64.b64encode(self.salt).decode(),
|
|
||||||
"m": self.params.memory_kib,
|
|
||||||
"t": self.params.iterations,
|
|
||||||
"p": self.params.parallelism,
|
|
||||||
"check": self.check,
|
|
||||||
},
|
|
||||||
separators=(",", ":"),
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def derive_key(passphrase: str, salt: bytes, params: Argon2Params) -> E2eKey:
|
|
||||||
"""Run Argon2id (v1.3) and expand the subkeys."""
|
|
||||||
master = hash_secret_raw(
|
|
||||||
secret=passphrase.encode(),
|
|
||||||
salt=salt,
|
|
||||||
time_cost=params.iterations,
|
|
||||||
memory_cost=params.memory_kib,
|
|
||||||
parallelism=params.parallelism,
|
|
||||||
hash_len=32,
|
|
||||||
type=Type.ID,
|
|
||||||
)
|
|
||||||
return E2eKey.from_bytes(master)
|
|
||||||
|
|
||||||
|
|
||||||
def read_header(store: RemoteStore, path: str) -> _Header | None:
|
|
||||||
"""Return the parsed header at ``path``, or None when absent."""
|
|
||||||
text = store.get_file_text(path)
|
|
||||||
return None if text is None else _Header.parse(text)
|
|
||||||
|
|
||||||
|
|
||||||
def key_matches(key: E2eKey, store: RemoteStore, path: str) -> bool:
|
|
||||||
"""Return whether ``key`` matches the header at ``path``."""
|
|
||||||
header = read_header(store, path)
|
|
||||||
return header is not None and hmac.compare_digest(
|
|
||||||
key.check_for(header.salt), header.check
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def unlock_e2e(
|
|
||||||
store: RemoteStore,
|
|
||||||
*,
|
|
||||||
path_prefix: str,
|
|
||||||
passphrase: str,
|
|
||||||
params: Argon2Params | None = None,
|
|
||||||
e2e_path: str | None = None,
|
|
||||||
) -> E2eKey:
|
|
||||||
"""Derive the key from ``passphrase``, creating the header on first use."""
|
|
||||||
if not passphrase:
|
|
||||||
msg = "passphrase must not be empty"
|
|
||||||
raise ValueError(msg)
|
|
||||||
path = e2e_path or default_e2e_path(path_prefix)
|
|
||||||
header = read_header(store, path)
|
|
||||||
if header is None:
|
|
||||||
salt = secrets.token_bytes(_SALT)
|
|
||||||
cost = params or Argon2Params()
|
|
||||||
key = derive_key(passphrase, salt, cost)
|
|
||||||
encoded = _Header(salt, cost, key.check_for(salt)).encode()
|
|
||||||
store.put_file_text(path, encoded, message=path)
|
|
||||||
stored = store.get_file_text(path) or encoded
|
|
||||||
if stored == encoded:
|
|
||||||
return key
|
|
||||||
header = _Header.parse(stored)
|
|
||||||
key = derive_key(passphrase, header.salt, header.params)
|
|
||||||
if not hmac.compare_digest(key.check_for(header.salt), header.check):
|
|
||||||
raise E2eWrongPassphraseError
|
|
||||||
return key
|
|
||||||
@ -1,247 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Encrypted remote store, ``-e2e`` layout and the one-time copy.
|
|
||||||
|
|
||||||
Mirrors ``crdt_sync_dart``'s ``EncryptingStore``, ``E2eLayout``,
|
|
||||||
``copyToEncrypted`` and ``openEncryptedStore`` so Python daemons and Flutter
|
|
||||||
apps share one encrypted prefix per app.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from dataclasses import dataclass
|
|
||||||
import logging
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from crdt_sync._e2e_blobs import blobs as _blobs
|
|
||||||
from crdt_sync._e2e_cache import (
|
|
||||||
read_cached_key,
|
|
||||||
read_copy_memo,
|
|
||||||
write_cached_key,
|
|
||||||
write_copy_memo,
|
|
||||||
)
|
|
||||||
from crdt_sync._e2e_cipher import E2eDecryptError, open_log_text, seal_log_text
|
|
||||||
from crdt_sync._e2e_key import (
|
|
||||||
Argon2Params,
|
|
||||||
E2eHeaderError,
|
|
||||||
E2eKey,
|
|
||||||
E2eWrongPassphraseError,
|
|
||||||
key_matches,
|
|
||||||
unlock_e2e,
|
|
||||||
)
|
|
||||||
from crdt_sync._log import merge_logs
|
|
||||||
from crdt_sync._store import dump_log, load_log
|
|
||||||
from crdt_sync._sync import default_revs_path
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from crdt_sync._remote import RemoteStore
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class E2eLockedError(Exception):
|
|
||||||
"""No usable key: the caller must not sync at all (fail closed)."""
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class E2eLayout:
|
|
||||||
"""Where an app's encrypted data lives, derived from its old prefix."""
|
|
||||||
|
|
||||||
prefix: str
|
|
||||||
revs_path: str
|
|
||||||
e2e_path: str
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def of(cls, old_prefix: str) -> E2eLayout:
|
|
||||||
"""Return ``<old>-e2e`` with revs and header kept out of old paths."""
|
|
||||||
prefix = f"{old_prefix}-e2e"
|
|
||||||
parent, sep, _ = old_prefix.rpartition("/")
|
|
||||||
if not sep:
|
|
||||||
return cls(prefix, f"{prefix}/revs", f"{prefix}/e2e")
|
|
||||||
return cls(prefix, f"{parent}/revs-e2e", f"{parent}/e2e")
|
|
||||||
|
|
||||||
|
|
||||||
class EncryptingStore:
|
|
||||||
"""Seals log blobs under the layout's prefix and keys its revisions."""
|
|
||||||
|
|
||||||
def __init__(self, inner: RemoteStore, key: E2eKey, layout: E2eLayout) -> None:
|
|
||||||
"""Wrap ``inner``; other paths pass through unchanged."""
|
|
||||||
self._inner = inner
|
|
||||||
self.key = key
|
|
||||||
self._layout = layout
|
|
||||||
self._cipher = key.cipher()
|
|
||||||
|
|
||||||
def _is_rev(self, path: str) -> bool:
|
|
||||||
return path.startswith(f"{self._layout.revs_path}/")
|
|
||||||
|
|
||||||
def _is_log(self, path: str) -> bool:
|
|
||||||
return (
|
|
||||||
not self._is_rev(path)
|
|
||||||
and path != self._layout.e2e_path
|
|
||||||
and path.startswith(f"{self._layout.prefix}/")
|
|
||||||
)
|
|
||||||
|
|
||||||
def list_directory(self, path: str) -> list[str]:
|
|
||||||
"""Delegate."""
|
|
||||||
return self._inner.list_directory(path)
|
|
||||||
|
|
||||||
def get_file_text(self, path: str) -> str | None:
|
|
||||||
"""Read and open a sealed log; other paths pass through."""
|
|
||||||
text = self._inner.get_file_text(path)
|
|
||||||
if text is None or not self._is_log(path):
|
|
||||||
return text
|
|
||||||
return open_log_text(text, self._cipher, path=path)
|
|
||||||
|
|
||||||
def put_file_text(self, path: str, text: str, *, message: str) -> None:
|
|
||||||
"""Seal logs and key revisions before writing."""
|
|
||||||
if self._is_log(path):
|
|
||||||
text = seal_log_text(text, self._cipher, path=path)
|
|
||||||
elif self._is_rev(path):
|
|
||||||
text = self.key.revision(text)
|
|
||||||
self._inner.put_file_text(path, text, message=message)
|
|
||||||
|
|
||||||
def get_string_map(self, path: str) -> dict[str, str]:
|
|
||||||
"""Bulk read; sealed entries come back opened, bad ones dropped."""
|
|
||||||
reader = getattr(self._inner, "get_string_map", None)
|
|
||||||
if reader is None:
|
|
||||||
return {}
|
|
||||||
out: dict[str, str] = {}
|
|
||||||
for name, value in reader(path).items():
|
|
||||||
full = f"{path}/{name}"
|
|
||||||
if not self._is_log(full):
|
|
||||||
out[name] = value
|
|
||||||
continue
|
|
||||||
try:
|
|
||||||
out[name] = open_log_text(value, self._cipher, path=full)
|
|
||||||
except E2eDecryptError:
|
|
||||||
_logger.warning("Undecryptable entry %s dropped", full)
|
|
||||||
return out
|
|
||||||
|
|
||||||
def delete_file(self, path: str, *, message: str = "") -> None:
|
|
||||||
"""Delegate."""
|
|
||||||
self._inner.delete_file(path, message=message)
|
|
||||||
|
|
||||||
def can_access_remote(self) -> bool:
|
|
||||||
"""Delegate."""
|
|
||||||
return self._inner.can_access_remote()
|
|
||||||
|
|
||||||
|
|
||||||
def copy_to_encrypted(
|
|
||||||
store: RemoteStore, key: E2eKey, old_prefix: str, layout: E2eLayout
|
|
||||||
) -> int:
|
|
||||||
"""Merge every readable old log into its encrypted twin; return writes."""
|
|
||||||
dest = EncryptingStore(store, key, layout)
|
|
||||||
copied = 0
|
|
||||||
for rel, text in _blobs(store, old_prefix).items():
|
|
||||||
try:
|
|
||||||
source = load_log(text)
|
|
||||||
except ValueError, KeyError, TypeError:
|
|
||||||
_logger.warning("Unreadable old log %s/%s not copied", old_prefix, rel)
|
|
||||||
continue
|
|
||||||
if not source:
|
|
||||||
continue
|
|
||||||
path = f"{layout.prefix}/{rel}"
|
|
||||||
existing = dest.get_file_text(path)
|
|
||||||
try:
|
|
||||||
current = load_log(existing) if existing is not None else {}
|
|
||||||
except ValueError, KeyError, TypeError:
|
|
||||||
# Not a sync log (an app's own blob): never overwrite it.
|
|
||||||
_logger.warning("Non-log blob at %s left as is", path)
|
|
||||||
continue
|
|
||||||
merged = merge_logs(current, source)
|
|
||||||
if existing is not None and dump_log(merged) == dump_log(current):
|
|
||||||
continue
|
|
||||||
dest.put_file_text(path, dump_log(merged), message="e2e copy")
|
|
||||||
copied += 1
|
|
||||||
return copied
|
|
||||||
|
|
||||||
|
|
||||||
_copied: dict[str, str] = {}
|
|
||||||
|
|
||||||
|
|
||||||
def reset_e2e_copy_memo() -> None:
|
|
||||||
"""Forget which old prefixes were copied; for tests."""
|
|
||||||
_copied.clear()
|
|
||||||
|
|
||||||
|
|
||||||
def _fingerprint(store: RemoteStore, old_prefix: str) -> str:
|
|
||||||
reader = getattr(store, "get_string_map", None)
|
|
||||||
if reader is None:
|
|
||||||
return ""
|
|
||||||
revs = reader(default_revs_path(old_prefix))
|
|
||||||
return ";".join(f"{k}={revs[k]}" for k in sorted(revs))
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
|
||||||
class _OpenRequest:
|
|
||||||
old_prefix: str
|
|
||||||
layout: E2eLayout
|
|
||||||
passphrase: str
|
|
||||||
params: Argon2Params | None
|
|
||||||
state_dir: Path | None
|
|
||||||
|
|
||||||
|
|
||||||
def _unlock(store: RemoteStore, req: _OpenRequest) -> E2eKey:
|
|
||||||
old_prefix, layout, state_dir = req.old_prefix, req.layout, req.state_dir
|
|
||||||
if state_dir is not None:
|
|
||||||
cached = read_cached_key(state_dir, old_prefix)
|
|
||||||
if cached is not None:
|
|
||||||
key = E2eKey.from_bytes(cached)
|
|
||||||
if key_matches(key, store, layout.e2e_path):
|
|
||||||
return key
|
|
||||||
if not req.passphrase:
|
|
||||||
msg = "no crdt-sync passphrase on this device"
|
|
||||||
raise E2eLockedError(msg)
|
|
||||||
try:
|
|
||||||
key = unlock_e2e(
|
|
||||||
store,
|
|
||||||
path_prefix=layout.prefix,
|
|
||||||
passphrase=req.passphrase,
|
|
||||||
params=req.params,
|
|
||||||
e2e_path=layout.e2e_path,
|
|
||||||
)
|
|
||||||
except (E2eWrongPassphraseError, E2eHeaderError) as exc:
|
|
||||||
raise E2eLockedError(str(exc) or type(exc).__name__) from exc
|
|
||||||
if state_dir is not None:
|
|
||||||
write_cached_key(state_dir, old_prefix, key.master)
|
|
||||||
return key
|
|
||||||
|
|
||||||
|
|
||||||
def open_encrypted_client(
|
|
||||||
store: RemoteStore,
|
|
||||||
old_prefix: str,
|
|
||||||
*,
|
|
||||||
passphrase: str,
|
|
||||||
params: Argon2Params | None = None,
|
|
||||||
state_dir: Path | None = None,
|
|
||||||
) -> tuple[EncryptingStore, E2eLayout]:
|
|
||||||
"""Unlock, copy the old prefix when it changed, and return the store.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
store: The outermost remote (above any mirror).
|
|
||||||
old_prefix: The app's former plaintext prefix.
|
|
||||||
passphrase: The shared crdt-sync password.
|
|
||||||
params: Argon2id cost for a header created now; tests lower it.
|
|
||||||
state_dir: Where a short-lived daemon keeps its derived key (0600)
|
|
||||||
and copy memo between runs; None keeps both in memory only.
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
E2eLockedError: No passphrase, a wrong one, or an unreadable header.
|
|
||||||
"""
|
|
||||||
layout = E2eLayout.of(old_prefix)
|
|
||||||
key = _unlock(
|
|
||||||
store, _OpenRequest(old_prefix, layout, passphrase, params, state_dir)
|
|
||||||
)
|
|
||||||
fingerprint = _fingerprint(store, old_prefix)
|
|
||||||
last = (
|
|
||||||
read_copy_memo(state_dir, old_prefix)
|
|
||||||
if state_dir is not None
|
|
||||||
else _copied.get(old_prefix)
|
|
||||||
)
|
|
||||||
if last != fingerprint:
|
|
||||||
copy_to_encrypted(store, key, old_prefix, layout)
|
|
||||||
_copied[old_prefix] = fingerprint
|
|
||||||
if state_dir is not None:
|
|
||||||
write_copy_memo(state_dir, old_prefix, fingerprint)
|
|
||||||
return EncryptingStore(store, key, layout), layout
|
|
||||||
@ -13,7 +13,6 @@ from dataclasses import dataclass
|
|||||||
import logging
|
import logging
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from crdt_sync._e2e_cipher import E2eDecryptError
|
|
||||||
from crdt_sync._revisions import revision_of
|
from crdt_sync._revisions import revision_of
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@ -91,16 +90,9 @@ def _pull_remote_logs(
|
|||||||
# skipped next tick.
|
# skipped next tick.
|
||||||
seen_revs[other_device_id] = remote_rev
|
seen_revs[other_device_id] = remote_rev
|
||||||
continue
|
continue
|
||||||
try:
|
text = ctx.client.get_file_text(
|
||||||
text = ctx.client.get_file_text(
|
f"{ctx.path_prefix}/{other_device_id}/{ctx.filename}"
|
||||||
f"{ctx.path_prefix}/{other_device_id}/{ctx.filename}"
|
)
|
||||||
)
|
|
||||||
except E2eDecryptError:
|
|
||||||
_logger.warning(
|
|
||||||
"Undecryptable log from device %r (wrong key or newer app)",
|
|
||||||
other_device_id,
|
|
||||||
)
|
|
||||||
continue
|
|
||||||
if text is None:
|
if text is None:
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"passphrase": "correct horse ✓",
|
|
||||||
"header": "{\"v\":1,\"kdf\":\"argon2id\",\"salt\":\"HGW+FZJe6hd71He22BrlUA==\",\"m\":64,\"t\":2,\"p\":1,\"check\":\"okKnATkNoZKvjSGfrgQGOjdRw5NORh2lC32zuBq7V6I=\"}",
|
|
||||||
"master_hex": "cad5afe8ddc6e21d2f39eb196de454db6b6d1f60629619ce8539f03a4bb0b086",
|
|
||||||
"revision_of_abc": "e7f845e1b0a7ea2b571fd3e3bdfb60641e650d63171bf73b6356c7909d2748c8",
|
|
||||||
"path": "vec/notes-e2e/phone/log.json",
|
|
||||||
"log": "{\"n1\":{\"id\":\"n1\",\"fields\":{\"title\":[\"buy milk\",\"1970-01-01T00:00:01.000Z-0000-node-a\"]},\"deleted\":false,\"deleted_hlc\":null},\"n2\":{\"id\":\"n2\",\"fields\":{\"title\":[\"zażółć\",\"1970-01-01T00:00:01.000Z-0000-node-a\"]},\"deleted\":false,\"deleted_hlc\":null}}",
|
|
||||||
"envelope": "{\"v\":1,\"r\":{\"n1\":{\"d\":false,\"dh\":null,\"h\":\"1970-01-01T00:00:01.000Z-0000-node-a\",\"p\":\"AR1zODx4TD67X3TGa0N7EV/V4FcZAaqc41jxZVtskFu3Pqb/pNlqm6db66rQUaMyNLtTPa4HMOJzZomBRyaSHjaPb4oNxgVPkMeIF5IbuI/GA30gR0sz/MSvYmfZ5wSnlBo1+fpH\"},\"n2\":{\"d\":false,\"dh\":null,\"h\":\"1970-01-01T00:00:01.000Z-0000-node-a\",\"p\":\"Aa0omlBGnmlsItzq7A21G0A1tqT8xMOJE0wgxcxJ1c3hVpRmNt4kq2IPNNGuW8v4A7fvs2FrnGX4A+NVtXPpu41ckKSShTqk8Ml6zTuxyrT85g50sgzbM7PKFczeEaS+ITWDj0N04u0=\"}}}",
|
|
||||||
"whole": "{\"v\":1,\"b\":\"AYdAwPehG84oHBRhRr5dP5VmleBGzQC1ryV5QHTCqBZE9ZsOZMMkJiP40+KzpnfIc2g=\"}"
|
|
||||||
}
|
|
||||||
@ -1,146 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""E2eCipher blob errors and the per-record envelope's edge shapes."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import json
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
E2eCipher,
|
|
||||||
E2eDecryptError,
|
|
||||||
is_e2e_envelope,
|
|
||||||
open_log_text,
|
|
||||||
seal_log_text,
|
|
||||||
)
|
|
||||||
|
|
||||||
PATH = "app/devices-e2e/pc/log.json"
|
|
||||||
CLOCK = "2026-01-01T00:00:00.000Z-0000-pc"
|
|
||||||
|
|
||||||
|
|
||||||
def _cipher(*, accept_plaintext: bool = True) -> E2eCipher:
|
|
||||||
return E2eCipher(bytes(range(32)), accept_plaintext=accept_plaintext)
|
|
||||||
|
|
||||||
|
|
||||||
def _blob(raw: bytes) -> str:
|
|
||||||
return base64.b64encode(raw).decode()
|
|
||||||
|
|
||||||
|
|
||||||
def _log(**records: object) -> str:
|
|
||||||
return json.dumps(records)
|
|
||||||
|
|
||||||
|
|
||||||
def _record(rid: str = "a", **extra: object) -> dict[str, object]:
|
|
||||||
return {
|
|
||||||
"id": rid,
|
|
||||||
"fields": {"title": ["x", CLOCK]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
**extra,
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def test_key_must_be_32_bytes() -> None:
|
|
||||||
with pytest.raises(ValueError, match="32 bytes"):
|
|
||||||
E2eCipher(b"short")
|
|
||||||
|
|
||||||
|
|
||||||
def test_blob_round_trips() -> None:
|
|
||||||
cipher = _cipher()
|
|
||||||
assert cipher.open(cipher.seal("héllo", path=PATH), path=PATH) == "héllo"
|
|
||||||
|
|
||||||
|
|
||||||
def test_plaintext_is_read_only_while_accepted() -> None:
|
|
||||||
assert _cipher().open('{"a": 1}', path=PATH) == '{"a": 1}'
|
|
||||||
with pytest.raises(E2eDecryptError, match="after migration"):
|
|
||||||
_cipher(accept_plaintext=False).open("[1]", path=PATH)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
("stored", "message"),
|
|
||||||
[
|
|
||||||
("!!not base64!!", "neither JSON nor base64"),
|
|
||||||
("", "empty blob"),
|
|
||||||
(_blob(b"\x02" + bytes(60)), "uses format 2"),
|
|
||||||
(_blob(b"\x01" + bytes(10)), "truncated"),
|
|
||||||
(_blob(b"\x01" + bytes(60)), "failed authentication"),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_bad_blobs_are_refused(stored: str, message: str) -> None:
|
|
||||||
with pytest.raises(E2eDecryptError, match=message):
|
|
||||||
_cipher().open(stored, path=PATH)
|
|
||||||
|
|
||||||
|
|
||||||
def test_blob_is_bound_to_its_path() -> None:
|
|
||||||
sealed = _cipher().seal("secret", path=PATH)
|
|
||||||
with pytest.raises(E2eDecryptError, match="failed authentication"):
|
|
||||||
_cipher().open(sealed, path="other")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("text", ["not json", "[1]", '{"v": true}', '{"v": "1"}', "{}"])
|
|
||||||
def test_non_envelopes_are_detected(text: str) -> None:
|
|
||||||
assert not is_e2e_envelope(text)
|
|
||||||
|
|
||||||
|
|
||||||
def test_envelope_is_detected() -> None:
|
|
||||||
assert is_e2e_envelope('{"v": 1}')
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"text",
|
|
||||||
[
|
|
||||||
"not json",
|
|
||||||
"[1]",
|
|
||||||
_log(a=[1]),
|
|
||||||
_log(a=_record("b")),
|
|
||||||
_log(a={"id": "a", "fields": []}),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_non_log_text_is_sealed_whole(text: str) -> None:
|
|
||||||
sealed = seal_log_text(text, _cipher(), path=PATH)
|
|
||||||
assert "b" in json.loads(sealed)
|
|
||||||
assert open_log_text(sealed, _cipher(), path=PATH) == text
|
|
||||||
|
|
||||||
|
|
||||||
def test_record_without_fields_has_no_newest_clock() -> None:
|
|
||||||
empty = {"id": "a", "fields": {}, "deleted": True, "deleted_hlc": CLOCK}
|
|
||||||
sealed = seal_log_text(_log(a=empty), _cipher(), path=PATH)
|
|
||||||
assert json.loads(sealed)["r"]["a"]["h"] is None
|
|
||||||
opened = json.loads(open_log_text(sealed, _cipher(), path=PATH))
|
|
||||||
assert opened == {"a": empty}
|
|
||||||
|
|
||||||
|
|
||||||
def test_plaintext_log_passes_or_fails_by_policy() -> None:
|
|
||||||
text = _log(a=_record())
|
|
||||||
assert open_log_text(text, _cipher(), path=PATH) == text
|
|
||||||
with pytest.raises(E2eDecryptError, match="after migration"):
|
|
||||||
open_log_text(text, _cipher(accept_plaintext=False), path=PATH)
|
|
||||||
|
|
||||||
|
|
||||||
def test_unknown_envelope_version_is_refused() -> None:
|
|
||||||
with pytest.raises(E2eDecryptError, match="uses format 2"):
|
|
||||||
open_log_text('{"v": 2, "r": {}}', _cipher(), path=PATH)
|
|
||||||
|
|
||||||
|
|
||||||
def test_envelope_without_records_is_misshaped() -> None:
|
|
||||||
with pytest.raises(E2eDecryptError, match="mis-shaped"):
|
|
||||||
open_log_text('{"v": 1, "b": 5, "r": []}', _cipher(), path=PATH)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"record",
|
|
||||||
[[], {"p": "x", "d": 1}, {"d": False}, {"p": 3, "d": False}],
|
|
||||||
)
|
|
||||||
def test_misshaped_record_is_refused(record: object) -> None:
|
|
||||||
text = json.dumps({"v": 1, "r": {"a": record}})
|
|
||||||
with pytest.raises(E2eDecryptError, match="record a"):
|
|
||||||
open_log_text(text, _cipher(), path=PATH)
|
|
||||||
|
|
||||||
|
|
||||||
def test_tampered_record_metadata_fails_authentication() -> None:
|
|
||||||
sealed = json.loads(seal_log_text(_log(a=_record()), _cipher(), path=PATH))
|
|
||||||
sealed["r"]["a"]["d"] = True
|
|
||||||
with pytest.raises(E2eDecryptError, match="failed authentication"):
|
|
||||||
open_log_text(json.dumps(sealed), _cipher(), path=PATH)
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Clearing an old plaintext prefix only after the encrypted copy is proven."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import io
|
|
||||||
import json
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
Argon2Params,
|
|
||||||
E2eLayout,
|
|
||||||
E2eLockedError,
|
|
||||||
clear_plaintext_prefix,
|
|
||||||
copy_to_encrypted,
|
|
||||||
unlock_e2e,
|
|
||||||
unverified_blobs,
|
|
||||||
)
|
|
||||||
from crdt_sync.tests.conftest import FakeStore
|
|
||||||
from tool import e2e_cleanup
|
|
||||||
|
|
||||||
CHEAP = Argon2Params(8, 1, 1)
|
|
||||||
PHRASE = "pw"
|
|
||||||
WRONG = PHRASE + "x"
|
|
||||||
OLD = "app/devices"
|
|
||||||
LAYOUT = E2eLayout.of(OLD)
|
|
||||||
|
|
||||||
|
|
||||||
def _log(title: str, stamp: str = "2026-01-01T00:00:00.000Z") -> str:
|
|
||||||
return json.dumps(
|
|
||||||
{
|
|
||||||
"n": {
|
|
||||||
"id": "n",
|
|
||||||
"fields": {"t": [title, f"{stamp}-0000-a"]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _seeded() -> FakeStore:
|
|
||||||
remote = FakeStore({f"{OLD}/pc/log.json": _log("x"), "app/revs/pc": "r"})
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix=LAYOUT.prefix,
|
|
||||||
passphrase=PHRASE,
|
|
||||||
params=CHEAP,
|
|
||||||
e2e_path=LAYOUT.e2e_path,
|
|
||||||
)
|
|
||||||
copy_to_encrypted(remote, key, OLD, LAYOUT)
|
|
||||||
return remote
|
|
||||||
|
|
||||||
|
|
||||||
def test_dry_run_lists_and_deletes_nothing() -> None:
|
|
||||||
remote = _seeded()
|
|
||||||
paths = clear_plaintext_prefix(remote, OLD, passphrase=PHRASE, apply=False)
|
|
||||||
assert paths == [f"{OLD}/pc/log.json"]
|
|
||||||
assert f"{OLD}/pc/log.json" in remote.files
|
|
||||||
|
|
||||||
|
|
||||||
def test_apply_deletes_only_after_verification() -> None:
|
|
||||||
remote = _seeded()
|
|
||||||
clear_plaintext_prefix(remote, OLD, passphrase=PHRASE, apply=True)
|
|
||||||
assert f"{OLD}/pc/log.json" not in remote.files
|
|
||||||
assert f"{LAYOUT.prefix}/pc/log.json" in remote.files
|
|
||||||
|
|
||||||
|
|
||||||
def test_unverified_copy_refuses() -> None:
|
|
||||||
remote = _seeded()
|
|
||||||
remote.files[f"{OLD}/pc/log.json"] = _log("newer", "2026-02-01T00:00:00.000Z")
|
|
||||||
remote.files[f"{OLD}/bad/log.json"] = "{oops"
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote, path_prefix=LAYOUT.prefix, passphrase=PHRASE, e2e_path=LAYOUT.e2e_path
|
|
||||||
)
|
|
||||||
assert unverified_blobs(remote, key, OLD, LAYOUT) == ["bad/log.json", "pc/log.json"]
|
|
||||||
with pytest.raises(E2eLockedError, match="not verified"):
|
|
||||||
clear_plaintext_prefix(remote, OLD, passphrase=PHRASE, apply=True)
|
|
||||||
assert f"{OLD}/pc/log.json" in remote.files
|
|
||||||
|
|
||||||
|
|
||||||
def test_empty_logs_need_no_copy() -> None:
|
|
||||||
remote = _seeded()
|
|
||||||
remote.files[f"{OLD}/tab/log.json"] = "{}"
|
|
||||||
paths = clear_plaintext_prefix(remote, OLD, passphrase=PHRASE, apply=False)
|
|
||||||
assert f"{OLD}/tab/log.json" in paths
|
|
||||||
|
|
||||||
|
|
||||||
def test_never_creates_a_header_and_wrong_passphrase_locks() -> None:
|
|
||||||
remote = FakeStore({f"{OLD}/pc/log.json": _log("x")})
|
|
||||||
with pytest.raises(E2eLockedError, match="no e2e header"):
|
|
||||||
clear_plaintext_prefix(remote, OLD, passphrase=PHRASE, apply=False)
|
|
||||||
assert LAYOUT.e2e_path not in remote.files
|
|
||||||
seeded = _seeded()
|
|
||||||
with pytest.raises(E2eLockedError):
|
|
||||||
clear_plaintext_prefix(seeded, OLD, passphrase=WRONG, apply=False)
|
|
||||||
|
|
||||||
|
|
||||||
def test_tool_main(monkeypatch: pytest.MonkeyPatch) -> None:
|
|
||||||
remote = _seeded()
|
|
||||||
out = io.StringIO()
|
|
||||||
monkeypatch.setattr("sys.stdout", out)
|
|
||||||
assert e2e_cleanup.run(remote, OLD, PHRASE, apply=False) == 0
|
|
||||||
assert "would delete 1" in out.getvalue()
|
|
||||||
assert e2e_cleanup.run(remote, OLD, PHRASE, apply=True) == 0
|
|
||||||
assert "deleted 1" in out.getvalue()
|
|
||||||
assert e2e_cleanup.run(FakeStore(), OLD, PHRASE, apply=True) == 1
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Cross-language golden vectors: Python opens what Dart sealed."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
E2eDecryptError,
|
|
||||||
E2eKey,
|
|
||||||
E2eWrongPassphraseError,
|
|
||||||
open_log_text,
|
|
||||||
seal_log_text,
|
|
||||||
unlock_e2e,
|
|
||||||
)
|
|
||||||
from crdt_sync.tests.conftest import FakeStore as MemoryRemote
|
|
||||||
|
|
||||||
WRONG = "nope"
|
|
||||||
VECTORS = json.loads(
|
|
||||||
(Path(__file__).parent / "fixtures" / "e2e_dart_vectors.json").read_text(
|
|
||||||
encoding="utf-8"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _key() -> E2eKey:
|
|
||||||
remote = MemoryRemote({"vec/e2e": VECTORS["header"]})
|
|
||||||
return unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix="vec/notes-e2e",
|
|
||||||
passphrase=str(VECTORS["passphrase"]),
|
|
||||||
e2e_path="vec/e2e",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_argon2id_and_hkdf_match_dart() -> None:
|
|
||||||
assert _key().master.hex() == VECTORS["master_hex"]
|
|
||||||
|
|
||||||
|
|
||||||
def test_keyed_revision_matches_dart() -> None:
|
|
||||||
assert _key().revision("abc") == VECTORS["revision_of_abc"]
|
|
||||||
|
|
||||||
|
|
||||||
def test_opens_a_dart_envelope() -> None:
|
|
||||||
opened = open_log_text(VECTORS["envelope"], _key().cipher(), path=VECTORS["path"])
|
|
||||||
assert json.loads(opened) == json.loads(VECTORS["log"])
|
|
||||||
|
|
||||||
|
|
||||||
def test_opens_a_dart_whole_blob() -> None:
|
|
||||||
opened = open_log_text(VECTORS["whole"], _key().cipher(), path=VECTORS["path"])
|
|
||||||
assert opened == "not a log"
|
|
||||||
|
|
||||||
|
|
||||||
def test_wrong_passphrase_is_refused() -> None:
|
|
||||||
remote = MemoryRemote({"vec/e2e": VECTORS["header"]})
|
|
||||||
with pytest.raises(E2eWrongPassphraseError):
|
|
||||||
unlock_e2e(remote, path_prefix="x", passphrase=WRONG, e2e_path="vec/e2e")
|
|
||||||
|
|
||||||
|
|
||||||
def test_a_moved_envelope_is_refused() -> None:
|
|
||||||
with pytest.raises(E2eDecryptError):
|
|
||||||
open_log_text(VECTORS["envelope"], _key().cipher(), path="vec/other")
|
|
||||||
|
|
||||||
|
|
||||||
def test_python_round_trip() -> None:
|
|
||||||
cipher = _key().cipher()
|
|
||||||
sealed = seal_log_text(VECTORS["log"], cipher, path=VECTORS["path"])
|
|
||||||
assert "buy milk" not in sealed
|
|
||||||
assert json.loads(open_log_text(sealed, cipher, path=VECTORS["path"])) == (
|
|
||||||
json.loads(VECTORS["log"])
|
|
||||||
)
|
|
||||||
@ -1,123 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Argon2id key, header parsing and unlock edge cases."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
Argon2Params,
|
|
||||||
E2eHeaderError,
|
|
||||||
E2eKey,
|
|
||||||
E2eWrongPassphraseError,
|
|
||||||
default_e2e_path,
|
|
||||||
unlock_e2e,
|
|
||||||
)
|
|
||||||
from crdt_sync._e2e_key import key_matches, read_header
|
|
||||||
from crdt_sync.tests.conftest import FakeStore
|
|
||||||
|
|
||||||
CHEAP = Argon2Params(8, 1, 1)
|
|
||||||
HEADER = {
|
|
||||||
"v": 1,
|
|
||||||
"kdf": "argon2id",
|
|
||||||
"salt": "AAAAAAAAAAAAAAAAAAAAAA==",
|
|
||||||
"m": 8,
|
|
||||||
"t": 1,
|
|
||||||
"p": 1,
|
|
||||||
"check": "c",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def _unlock(remote: FakeStore, phrase: str = "pw") -> E2eKey:
|
|
||||||
return unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix="app/devices-e2e",
|
|
||||||
passphrase=phrase,
|
|
||||||
params=CHEAP,
|
|
||||||
e2e_path="app/e2e",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class RacedStore(FakeStore):
|
|
||||||
"""Another device's header wins the first write."""
|
|
||||||
|
|
||||||
def __init__(self, winner: str) -> None:
|
|
||||||
super().__init__()
|
|
||||||
self._winner = winner
|
|
||||||
|
|
||||||
def put_file_text(self, path: str, text: str, *, message: str) -> None:
|
|
||||||
super().put_file_text(path, self._winner, message=message)
|
|
||||||
|
|
||||||
|
|
||||||
def test_default_path_is_a_sibling_or_nested() -> None:
|
|
||||||
assert default_e2e_path("app/devices-e2e") == "app/e2e"
|
|
||||||
assert default_e2e_path("flat") == "flat/e2e"
|
|
||||||
|
|
||||||
|
|
||||||
def test_master_key_must_be_32_bytes() -> None:
|
|
||||||
with pytest.raises(ValueError, match="32 bytes"):
|
|
||||||
E2eKey.from_bytes(b"short")
|
|
||||||
|
|
||||||
|
|
||||||
def test_unlock_refuses_an_empty_passphrase() -> None:
|
|
||||||
with pytest.raises(ValueError, match="empty"):
|
|
||||||
_unlock(FakeStore(), "")
|
|
||||||
|
|
||||||
|
|
||||||
def test_unlock_creates_then_reuses_the_header() -> None:
|
|
||||||
remote = FakeStore()
|
|
||||||
first = _unlock(remote)
|
|
||||||
assert _unlock(remote).master == first.master
|
|
||||||
assert key_matches(first, remote, "app/e2e")
|
|
||||||
assert not key_matches(_unlock(FakeStore(), "other"), remote, "app/e2e")
|
|
||||||
|
|
||||||
|
|
||||||
def test_missing_header_matches_nothing() -> None:
|
|
||||||
key = E2eKey.from_bytes(bytes(32))
|
|
||||||
assert read_header(FakeStore(), "app/e2e") is None
|
|
||||||
assert not key_matches(key, FakeStore(), "app/e2e")
|
|
||||||
|
|
||||||
|
|
||||||
def test_wrong_passphrase_is_refused() -> None:
|
|
||||||
remote = FakeStore()
|
|
||||||
_unlock(remote)
|
|
||||||
with pytest.raises(E2eWrongPassphraseError):
|
|
||||||
_unlock(remote, "nope")
|
|
||||||
|
|
||||||
|
|
||||||
def test_losing_the_header_race_adopts_the_winner() -> None:
|
|
||||||
winner = FakeStore()
|
|
||||||
key = _unlock(winner)
|
|
||||||
raced = RacedStore(winner.files["app/e2e"])
|
|
||||||
assert _unlock(raced).master == key.master
|
|
||||||
with pytest.raises(E2eWrongPassphraseError):
|
|
||||||
_unlock(RacedStore(winner.files["app/e2e"]), "nope")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
("text", "message"),
|
|
||||||
[
|
|
||||||
("not json", "not JSON"),
|
|
||||||
("[1]", "known version"),
|
|
||||||
(json.dumps({**HEADER, "v": 2}), "known version"),
|
|
||||||
(json.dumps({**HEADER, "kdf": "scrypt"}), "malformed"),
|
|
||||||
(json.dumps({k: v for k, v in HEADER.items() if k != "m"}), "malformed"),
|
|
||||||
(json.dumps({**HEADER, "m": "x"}), "malformed"),
|
|
||||||
(json.dumps({**HEADER, "salt": "A"}), "malformed"),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
def test_bad_headers_are_refused(text: str, message: str) -> None:
|
|
||||||
remote = FakeStore({"app/e2e": text})
|
|
||||||
with pytest.raises(E2eHeaderError, match=message):
|
|
||||||
read_header(remote, "app/e2e")
|
|
||||||
with pytest.raises(E2eHeaderError, match=message):
|
|
||||||
_unlock(remote)
|
|
||||||
|
|
||||||
|
|
||||||
def test_a_good_header_parses() -> None:
|
|
||||||
header = read_header(FakeStore({"app/e2e": json.dumps(HEADER)}), "app/e2e")
|
|
||||||
assert header is not None
|
|
||||||
assert header.params == CHEAP
|
|
||||||
assert header.check == "c"
|
|
||||||
@ -1,101 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""A per-minute daemon must not pay Argon2id or a full copy every tick."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import Argon2Params, E2eLockedError, open_encrypted_client
|
|
||||||
from crdt_sync import _e2e_key as key_mod
|
|
||||||
from crdt_sync import _e2e_store as store_mod
|
|
||||||
from crdt_sync.tests.conftest import FakeStore
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from crdt_sync import E2eKey, RemoteStore
|
|
||||||
|
|
||||||
CHEAP = Argon2Params(8, 1, 1)
|
|
||||||
PHRASE = "pw"
|
|
||||||
WRONG = PHRASE + "x"
|
|
||||||
LOG = json.dumps(
|
|
||||||
{
|
|
||||||
"a": {
|
|
||||||
"id": "a",
|
|
||||||
"fields": {"t": ["x", "2026-01-01T00:00:00.000Z-0000-a"]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_state_dir_caches_key_and_copy_across_processes(
|
|
||||||
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
||||||
) -> None:
|
|
||||||
remote = FakeStore({"app/devices/pc/log.json": LOG, "app/revs/pc": "r1"})
|
|
||||||
derives: list[int] = []
|
|
||||||
real = key_mod.unlock_e2e
|
|
||||||
|
|
||||||
def counting(
|
|
||||||
remote: RemoteStore,
|
|
||||||
*,
|
|
||||||
path_prefix: str,
|
|
||||||
passphrase: str,
|
|
||||||
params: Argon2Params | None = None,
|
|
||||||
e2e_path: str | None = None,
|
|
||||||
) -> E2eKey:
|
|
||||||
derives.append(1)
|
|
||||||
return real(
|
|
||||||
remote,
|
|
||||||
path_prefix=path_prefix,
|
|
||||||
passphrase=passphrase,
|
|
||||||
params=params,
|
|
||||||
e2e_path=e2e_path,
|
|
||||||
)
|
|
||||||
|
|
||||||
monkeypatch.setattr(store_mod, "unlock_e2e", counting)
|
|
||||||
for _ in range(3):
|
|
||||||
store_mod.reset_e2e_copy_memo() # a fresh process each tick
|
|
||||||
remote.writes.clear()
|
|
||||||
open_encrypted_client(
|
|
||||||
remote, "app/devices", passphrase=PHRASE, params=CHEAP, state_dir=tmp_path
|
|
||||||
)
|
|
||||||
assert derives == [1]
|
|
||||||
assert remote.writes == []
|
|
||||||
key_files = list(tmp_path.glob("e2e-*.key"))
|
|
||||||
assert len(key_files) == 1
|
|
||||||
assert key_files[0].stat().st_mode & 0o777 == 0o600
|
|
||||||
|
|
||||||
|
|
||||||
def test_stale_cached_key_rederives(tmp_path: Path) -> None:
|
|
||||||
remote = FakeStore()
|
|
||||||
open_encrypted_client(
|
|
||||||
remote, "app/devices", passphrase=PHRASE, params=CHEAP, state_dir=tmp_path
|
|
||||||
)
|
|
||||||
for key_file in tmp_path.glob("e2e-*.key"):
|
|
||||||
key_file.write_text("00" * 32, encoding="utf-8")
|
|
||||||
store, _ = open_encrypted_client(
|
|
||||||
remote, "app/devices", passphrase=PHRASE, params=CHEAP, state_dir=tmp_path
|
|
||||||
)
|
|
||||||
assert next(tmp_path.glob("e2e-*.key")).read_text(encoding="utf-8") == (
|
|
||||||
store.key.master.hex()
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_garbage_cached_key_is_ignored_and_wrong_passphrase_locks(
|
|
||||||
tmp_path: Path,
|
|
||||||
) -> None:
|
|
||||||
remote = FakeStore()
|
|
||||||
open_encrypted_client(
|
|
||||||
remote, "app/devices", passphrase=PHRASE, params=CHEAP, state_dir=tmp_path
|
|
||||||
)
|
|
||||||
for key_file in tmp_path.glob("e2e-*.key"):
|
|
||||||
key_file.write_text("not hex", encoding="utf-8")
|
|
||||||
with pytest.raises(E2eLockedError):
|
|
||||||
open_encrypted_client(
|
|
||||||
remote, "app/devices", passphrase=WRONG, params=CHEAP, state_dir=tmp_path
|
|
||||||
)
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""EncryptingStore, layout, one-time copy and open, mirroring the Dart side."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
Argon2Params,
|
|
||||||
E2eLayout,
|
|
||||||
E2eLockedError,
|
|
||||||
EncryptingStore,
|
|
||||||
LogCodec,
|
|
||||||
SyncTarget,
|
|
||||||
copy_to_encrypted,
|
|
||||||
dump_log,
|
|
||||||
load_log,
|
|
||||||
open_encrypted_client,
|
|
||||||
reset_e2e_copy_memo,
|
|
||||||
sync_log,
|
|
||||||
unlock_e2e,
|
|
||||||
)
|
|
||||||
from crdt_sync.tests.conftest import FakeStore
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Callable
|
|
||||||
|
|
||||||
from crdt_sync import Hlc
|
|
||||||
|
|
||||||
PHRASE = "pw"
|
|
||||||
WRONG = "bad"
|
|
||||||
CHEAP = Argon2Params(8, 1, 1)
|
|
||||||
OLD = "app/devices"
|
|
||||||
|
|
||||||
|
|
||||||
def _log_text(make_hlc: Callable[..., Hlc], **titles: str) -> str:
|
|
||||||
return json.dumps(
|
|
||||||
{
|
|
||||||
rid: {
|
|
||||||
"id": rid,
|
|
||||||
"fields": {"title": [t, make_hlc(1000).to_str()]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
for rid, t in titles.items()
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def _memo() -> None:
|
|
||||||
reset_e2e_copy_memo()
|
|
||||||
|
|
||||||
|
|
||||||
def test_layouts() -> None:
|
|
||||||
assert E2eLayout.of("app/devices") == E2eLayout(
|
|
||||||
"app/devices-e2e", "app/revs-e2e", "app/e2e"
|
|
||||||
)
|
|
||||||
assert E2eLayout.of("settings-sync") == E2eLayout(
|
|
||||||
"settings-sync-e2e", "settings-sync-e2e/revs", "settings-sync-e2e/e2e"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_sync_through_store_is_ciphertext_and_merges(
|
|
||||||
make_hlc: Callable[..., Hlc],
|
|
||||||
) -> None:
|
|
||||||
remote = FakeStore()
|
|
||||||
layout = E2eLayout.of(OLD)
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix=layout.prefix,
|
|
||||||
passphrase=PHRASE,
|
|
||||||
params=CHEAP,
|
|
||||||
e2e_path=layout.e2e_path,
|
|
||||||
)
|
|
||||||
store = EncryptingStore(remote, key, layout)
|
|
||||||
codec = LogCodec(encode=dump_log, decode=load_log, filename="log.json")
|
|
||||||
phone = load_log(_log_text(make_hlc, n1="buy milk"))
|
|
||||||
sync_log(SyncTarget(store, "phone", layout.prefix), phone, codec)
|
|
||||||
blob = remote.files[f"{layout.prefix}/phone/log.json"]
|
|
||||||
assert "buy milk" not in blob
|
|
||||||
assert '"title"' not in blob
|
|
||||||
merged = sync_log(SyncTarget(store, "pc", layout.prefix), {}, codec)
|
|
||||||
assert set(merged) == {"n1"}
|
|
||||||
|
|
||||||
|
|
||||||
def test_open_copies_old_prefix_once_and_locks_without_password(
|
|
||||||
make_hlc: Callable[..., Hlc],
|
|
||||||
) -> None:
|
|
||||||
remote = FakeStore({f"{OLD}/pc/log.json": _log_text(make_hlc, a="x")})
|
|
||||||
with pytest.raises(E2eLockedError):
|
|
||||||
open_encrypted_client(remote, OLD, passphrase="", params=CHEAP)
|
|
||||||
store, layout = open_encrypted_client(remote, OLD, passphrase=PHRASE, params=CHEAP)
|
|
||||||
text = store.get_file_text(f"{layout.prefix}/pc/log.json")
|
|
||||||
assert text is not None
|
|
||||||
assert set(load_log(text)) == {"a"}
|
|
||||||
assert "x" in remote.files[f"{OLD}/pc/log.json"]
|
|
||||||
with pytest.raises(E2eLockedError):
|
|
||||||
open_encrypted_client(remote, OLD, passphrase=WRONG, params=CHEAP)
|
|
||||||
|
|
||||||
|
|
||||||
def test_copy_is_idempotent(make_hlc: Callable[..., Hlc]) -> None:
|
|
||||||
remote = FakeStore({f"{OLD}/pc/log.json": _log_text(make_hlc, a="x")})
|
|
||||||
layout = E2eLayout.of(OLD)
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix=layout.prefix,
|
|
||||||
passphrase=PHRASE,
|
|
||||||
params=CHEAP,
|
|
||||||
e2e_path=layout.e2e_path,
|
|
||||||
)
|
|
||||||
assert copy_to_encrypted(remote, key, OLD, layout) == 1
|
|
||||||
remote.writes.clear()
|
|
||||||
assert copy_to_encrypted(remote, key, OLD, layout) == 0
|
|
||||||
assert remote.writes == []
|
|
||||||
@ -1,218 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""EncryptingStore passthroughs, bulk reads and copy/open edge cases."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
import logging
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
Argon2Params,
|
|
||||||
E2eLayout,
|
|
||||||
E2eLockedError,
|
|
||||||
EncryptingStore,
|
|
||||||
copy_to_encrypted,
|
|
||||||
load_log,
|
|
||||||
open_encrypted_client,
|
|
||||||
reset_e2e_copy_memo,
|
|
||||||
unlock_e2e,
|
|
||||||
)
|
|
||||||
from crdt_sync._e2e_blobs import blobs as _blobs
|
|
||||||
from crdt_sync._e2e_store import _fingerprint
|
|
||||||
from crdt_sync.tests.conftest import FakeStore, FakeStoreWithoutBulkRead
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from collections.abc import Callable
|
|
||||||
|
|
||||||
from crdt_sync import E2eKey, Hlc
|
|
||||||
|
|
||||||
PHRASE = "pw"
|
|
||||||
CHEAP = Argon2Params(8, 1, 1)
|
|
||||||
OLD = "app/devices"
|
|
||||||
LAYOUT = E2eLayout.of(OLD)
|
|
||||||
CLOCK = "2026-01-01T00:00:00.000Z-0000-pc"
|
|
||||||
|
|
||||||
|
|
||||||
def _log(title: str = "x", rid: str = "a") -> str:
|
|
||||||
return json.dumps(
|
|
||||||
{
|
|
||||||
rid: {
|
|
||||||
"id": rid,
|
|
||||||
"fields": {"title": [title, CLOCK]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _key(remote: FakeStore) -> E2eKey:
|
|
||||||
return unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix=LAYOUT.prefix,
|
|
||||||
passphrase=PHRASE,
|
|
||||||
params=CHEAP,
|
|
||||||
e2e_path=LAYOUT.e2e_path,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class HidingStore(FakeStore):
|
|
||||||
"""Lists every file but reads ``hidden`` paths as absent."""
|
|
||||||
|
|
||||||
def __init__(self, files: dict[str, str], hidden: set[str]) -> None:
|
|
||||||
super().__init__(files)
|
|
||||||
self._hidden = hidden
|
|
||||||
|
|
||||||
def get_file_text(self, path: str) -> str | None:
|
|
||||||
if path in self._hidden:
|
|
||||||
return None
|
|
||||||
return super().get_file_text(path)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
|
||||||
def _memo() -> None:
|
|
||||||
reset_e2e_copy_memo()
|
|
||||||
|
|
||||||
|
|
||||||
def test_passthroughs_and_keyed_revisions() -> None:
|
|
||||||
remote = FakeStore({"other/file": "raw"})
|
|
||||||
store = EncryptingStore(remote, _key(remote), LAYOUT)
|
|
||||||
assert store.list_directory("other") == ["file"]
|
|
||||||
assert store.get_file_text("other/file") == "raw"
|
|
||||||
assert store.get_file_text(f"{LAYOUT.prefix}/pc/log.json") is None
|
|
||||||
assert store.can_access_remote()
|
|
||||||
store.put_file_text(f"{LAYOUT.revs_path}/pc", "text", message="m")
|
|
||||||
assert remote.files[f"{LAYOUT.revs_path}/pc"] == store.key.revision("text")
|
|
||||||
store.put_file_text("other/file", "plain", message="m")
|
|
||||||
assert remote.files["other/file"] == "plain"
|
|
||||||
store.delete_file("other/file")
|
|
||||||
assert "other/file" not in remote.files
|
|
||||||
|
|
||||||
|
|
||||||
def test_bulk_read_opens_sealed_and_drops_bad(
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
) -> None:
|
|
||||||
remote = FakeStore()
|
|
||||||
store = EncryptingStore(remote, _key(remote), LAYOUT)
|
|
||||||
store.put_file_text(f"{LAYOUT.prefix}/pc", _log(), message="m")
|
|
||||||
remote.files[f"{LAYOUT.prefix}/bad"] = '{"v": 2, "r": {}}'
|
|
||||||
remote.files[f"{LAYOUT.revs_path}/pc"] = "rev"
|
|
||||||
with caplog.at_level(logging.WARNING):
|
|
||||||
out = store.get_string_map(LAYOUT.prefix)
|
|
||||||
assert set(out) == {"pc"}
|
|
||||||
assert set(load_log(out["pc"])) == {"a"}
|
|
||||||
assert "Undecryptable entry" in caplog.text
|
|
||||||
assert store.get_string_map(LAYOUT.revs_path) == {"pc": "rev"}
|
|
||||||
|
|
||||||
|
|
||||||
def test_bulk_read_is_empty_without_inner_support() -> None:
|
|
||||||
remote = FakeStoreWithoutBulkRead()
|
|
||||||
store = EncryptingStore(remote, _key(FakeStore()), LAYOUT)
|
|
||||||
assert store.get_string_map(LAYOUT.prefix) == {}
|
|
||||||
assert _fingerprint(remote, OLD) == ""
|
|
||||||
|
|
||||||
|
|
||||||
def test_blobs_cover_flat_nested_and_skipped_paths() -> None:
|
|
||||||
remote = HidingStore(
|
|
||||||
{
|
|
||||||
f"{OLD}/flat": "f",
|
|
||||||
f"{OLD}/gone": "g",
|
|
||||||
f"{OLD}/pc/log.json": "n",
|
|
||||||
f"{OLD}/pc/hidden.json": "h",
|
|
||||||
"app/revs/pc": "r",
|
|
||||||
f"{OLD}/e2e": "h",
|
|
||||||
f"{OLD}/revs": "r",
|
|
||||||
},
|
|
||||||
{f"{OLD}/gone", f"{OLD}/pc/hidden.json"},
|
|
||||||
)
|
|
||||||
assert _blobs(remote, OLD) == {"flat": "f", "pc/log.json": "n"}
|
|
||||||
|
|
||||||
|
|
||||||
def test_copy_skips_unreadable_and_flat_logs(
|
|
||||||
caplog: pytest.LogCaptureFixture,
|
|
||||||
) -> None:
|
|
||||||
remote = FakeStore({f"{OLD}/flat": _log(), f"{OLD}/pc/log.json": "not json"})
|
|
||||||
with caplog.at_level(logging.WARNING):
|
|
||||||
copied = copy_to_encrypted(remote, _key(remote), OLD, LAYOUT)
|
|
||||||
assert copied == 1
|
|
||||||
assert "Unreadable old log" in caplog.text
|
|
||||||
assert f"{LAYOUT.prefix}/flat" in remote.files
|
|
||||||
assert f"{LAYOUT.prefix}/pc/log.json" not in remote.files
|
|
||||||
|
|
||||||
|
|
||||||
def test_changed_old_prefix_is_copied_again() -> None:
|
|
||||||
remote = FakeStore({f"{OLD}/pc/log.json": _log("one")})
|
|
||||||
open_encrypted_client(remote, OLD, passphrase=PHRASE, params=CHEAP)
|
|
||||||
remote.files[f"{OLD}/pc/log.json"] = _log("two", rid="b")
|
|
||||||
remote.files["app/revs/pc"] = "newer"
|
|
||||||
store, layout = open_encrypted_client(remote, OLD, passphrase=PHRASE, params=CHEAP)
|
|
||||||
text = store.get_file_text(f"{layout.prefix}/pc/log.json")
|
|
||||||
assert text is not None
|
|
||||||
assert set(load_log(text)) == {"a", "b"}
|
|
||||||
|
|
||||||
|
|
||||||
def test_unchanged_prefix_is_not_copied_twice() -> None:
|
|
||||||
remote = FakeStore({f"{OLD}/pc/log.json": _log()})
|
|
||||||
open_encrypted_client(remote, OLD, passphrase=PHRASE, params=CHEAP)
|
|
||||||
remote.writes.clear()
|
|
||||||
open_encrypted_client(remote, OLD, passphrase=PHRASE, params=CHEAP)
|
|
||||||
assert remote.writes == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_unreadable_header_locks_the_client() -> None:
|
|
||||||
remote = FakeStore({LAYOUT.e2e_path: "not json"})
|
|
||||||
with pytest.raises(E2eLockedError, match="not JSON"):
|
|
||||||
open_encrypted_client(remote, OLD, passphrase=PHRASE, params=CHEAP)
|
|
||||||
|
|
||||||
|
|
||||||
def test_copy_never_overwrites_non_log_and_skips_empty() -> None:
|
|
||||||
layout = E2eLayout.of("app/devices")
|
|
||||||
remote = FakeStore(
|
|
||||||
{
|
|
||||||
"app/devices/pc/current.json": "{}",
|
|
||||||
"app/devices-e2e/pc/current.json": '{"photos":["a"]}',
|
|
||||||
"app/devices/tab/current.json": "{}",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix=layout.prefix,
|
|
||||||
passphrase="x" * 8,
|
|
||||||
params=Argon2Params(8, 1, 1),
|
|
||||||
e2e_path=layout.e2e_path,
|
|
||||||
)
|
|
||||||
assert copy_to_encrypted(remote, key, "app/devices", layout) == 0
|
|
||||||
assert remote.files["app/devices-e2e/pc/current.json"] == '{"photos":["a"]}'
|
|
||||||
assert "app/devices-e2e/tab/current.json" not in remote.files
|
|
||||||
|
|
||||||
|
|
||||||
def test_copy_leaves_a_non_log_destination_alone(
|
|
||||||
make_hlc: Callable[..., Hlc],
|
|
||||||
) -> None:
|
|
||||||
layout = E2eLayout.of("app/devices")
|
|
||||||
log = {
|
|
||||||
"n": {
|
|
||||||
"id": "n",
|
|
||||||
"fields": {"t": ["x", make_hlc(1).to_str()]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
remote = FakeStore(
|
|
||||||
{
|
|
||||||
"app/devices/pc/current.json": json.dumps(log),
|
|
||||||
"app/devices-e2e/pc/current.json": '{"photos":["a"]}',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix=layout.prefix,
|
|
||||||
passphrase="x" * 8,
|
|
||||||
params=Argon2Params(8, 1, 1),
|
|
||||||
e2e_path=layout.e2e_path,
|
|
||||||
)
|
|
||||||
assert copy_to_encrypted(remote, key, "app/devices", layout) == 0
|
|
||||||
assert remote.files["app/devices-e2e/pc/current.json"] == '{"photos":["a"]}'
|
|
||||||
@ -1,32 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""A peer whose log cannot be decrypted is skipped, not fatal."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
from unittest.mock import MagicMock
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
E2eDecryptError,
|
|
||||||
GitHubSyncClient,
|
|
||||||
LogCodec,
|
|
||||||
SyncTarget,
|
|
||||||
dump_log,
|
|
||||||
load_log,
|
|
||||||
sync_log,
|
|
||||||
)
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
|
|
||||||
def test_undecryptable_peer_is_skipped(caplog: pytest.LogCaptureFixture) -> None:
|
|
||||||
client = MagicMock(spec=GitHubSyncClient)
|
|
||||||
client.list_directory.return_value = ["phone"]
|
|
||||||
client.get_file_text.side_effect = E2eDecryptError("wrong key")
|
|
||||||
codec = LogCodec(encode=dump_log, decode=load_log, filename="log.json")
|
|
||||||
with caplog.at_level(logging.WARNING):
|
|
||||||
merged = sync_log(SyncTarget(client, "pc", "devices"), {}, codec)
|
|
||||||
assert merged == {}
|
|
||||||
assert "Undecryptable log from device 'phone'" in caplog.text
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""The RTDB plaintext audit behind the E2E done check."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import io
|
|
||||||
import json
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from crdt_sync import E2eCipher, seal_log_text
|
|
||||||
from tool import e2e_audit
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
LOG = json.dumps(
|
|
||||||
{
|
|
||||||
"n": {
|
|
||||||
"id": "n",
|
|
||||||
"fields": {"title": ["x", "2026-01-01T00:00:00.000Z-0000-a"]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _sealed() -> str:
|
|
||||||
return seal_log_text(LOG, E2eCipher(bytes(32)), path="a/devices-e2e/p/log.json")
|
|
||||||
|
|
||||||
|
|
||||||
def test_sealed_tree_is_clean() -> None:
|
|
||||||
tree = {
|
|
||||||
"devices-e2e": {"p": {"log~2Ejson": _sealed()}},
|
|
||||||
"revs-e2e": {"p": "ab" * 32},
|
|
||||||
"e2e": '{"v":1,"kdf":"argon2id"}',
|
|
||||||
}
|
|
||||||
assert e2e_audit.plaintext_paths(tree) == []
|
|
||||||
|
|
||||||
|
|
||||||
def test_plaintext_leaf_is_reported_with_decoded_key() -> None:
|
|
||||||
tree = {"devices": {"p": {"log~2Ejson": LOG}}, "settings": {"k": '{"a":1}'}}
|
|
||||||
assert e2e_audit.plaintext_paths(tree) == [
|
|
||||||
"devices/p/log.json",
|
|
||||||
"settings/k",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def test_raw_json_scalars_count_as_plaintext() -> None:
|
|
||||||
assert e2e_audit.plaintext_paths({"a": 5, "b": True, "c": None}) == ["a", "b"]
|
|
||||||
|
|
||||||
|
|
||||||
def test_main_reads_stdin_and_sets_exit_code(
|
|
||||||
monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
|
||||||
) -> None:
|
|
||||||
monkeypatch.setattr("sys.stdin", io.StringIO(json.dumps({"x": LOG})))
|
|
||||||
assert e2e_audit.main(["todo-sync"]) == 1
|
|
||||||
assert "todo-sync/x" in capsys.readouterr().out
|
|
||||||
monkeypatch.setattr("sys.stdin", io.StringIO("null"))
|
|
||||||
assert e2e_audit.main(["todo-sync"]) == 0
|
|
||||||
monkeypatch.setattr("sys.stdin", io.StringIO(json.dumps({"x": _sealed()})))
|
|
||||||
assert e2e_audit.main([]) == 0
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""tool/e2e_vectors writes vectors that Python itself can open."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
import runpy
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
|
|
||||||
from crdt_sync import open_log_text, unlock_e2e
|
|
||||||
from crdt_sync.tests.conftest import FakeStore
|
|
||||||
from tool import e2e_vectors
|
|
||||||
|
|
||||||
|
|
||||||
def test_vectors_open_with_the_stated_passphrase() -> None:
|
|
||||||
vec = e2e_vectors.vectors()
|
|
||||||
key = unlock_e2e(
|
|
||||||
FakeStore({"vec/e2e": str(vec["header"])}),
|
|
||||||
path_prefix="vec/notes-e2e",
|
|
||||||
passphrase=str(vec["passphrase"]),
|
|
||||||
e2e_path="vec/e2e",
|
|
||||||
)
|
|
||||||
assert key.master.hex() == vec["master_hex"]
|
|
||||||
path = str(vec["path"])
|
|
||||||
opened = open_log_text(str(vec["envelope"]), key.cipher(), path=path)
|
|
||||||
assert json.loads(opened) == json.loads(str(vec["log"]))
|
|
||||||
assert open_log_text(str(vec["whole"]), key.cipher(), path=path) == "not a log"
|
|
||||||
|
|
||||||
|
|
||||||
def test_main_prints_json(capsys: pytest.CaptureFixture[str]) -> None:
|
|
||||||
assert e2e_vectors.main() == 0
|
|
||||||
assert "master_hex" in json.loads(capsys.readouterr().out)
|
|
||||||
|
|
||||||
|
|
||||||
def test_module_entry_point(capsys: pytest.CaptureFixture[str]) -> None:
|
|
||||||
with pytest.raises(SystemExit) as exc:
|
|
||||||
runpy.run_path(str(Path(e2e_vectors.__file__)), run_name="__main__")
|
|
||||||
assert exc.value.code == 0
|
|
||||||
assert "envelope" in capsys.readouterr().out
|
|
||||||
@ -1,13 +1,9 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "crdt-sync"
|
name = "crdt-sync"
|
||||||
version = "0.11.1"
|
version = "0.9.2"
|
||||||
description = "Shared CRDT merge scheme + GitHub-Contents-API sync transport for cross-device apps"
|
description = "Shared CRDT merge scheme + GitHub-Contents-API sync transport for cross-device apps"
|
||||||
requires-python = ">=3.14"
|
requires-python = ">=3.14"
|
||||||
dependencies = [
|
dependencies = ["requests==2.34.2"]
|
||||||
"argon2-cffi==25.1.0",
|
|
||||||
"pynacl==1.6.2",
|
|
||||||
"requests==2.34.2",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Ship only the library. `tool/` is a package too (it has an __init__.py so
|
# Ship only the library. `tool/` is a package too (it has an __init__.py so
|
||||||
# its scripts import cleanly), and setuptools' flat-layout auto-discovery
|
# its scripts import cleanly), and setuptools' flat-layout auto-discovery
|
||||||
@ -108,9 +104,8 @@ ignore-patterns = [".*\\.pyi$"]
|
|||||||
[tool.pylint.basic]
|
[tool.pylint.basic]
|
||||||
# snake_case, plus the ``do_<METHOD>`` names http.server dispatches on: the
|
# snake_case, plus the ``do_<METHOD>`` names http.server dispatches on: the
|
||||||
# stdlib looks handlers up as ``"do_" + command``, so ``do_GET`` is the only
|
# stdlib looks handlers up as ``"do_" + command``, so ``do_GET`` is the only
|
||||||
# spelling that works and cannot be renamed to satisfy the style. ``of`` is
|
# spelling that works and cannot be renamed to satisfy the style.
|
||||||
# ``E2eLayout.of``, public API that daily-limits and diet-guard call by name.
|
method-rgx = "([^\\W\\dA-Z][^\\WA-Z]{2,}|_[^\\WA-Z]*|__[^\\W\\dA-Z][^\\WA-Z]+__|do_[A-Z]+)$"
|
||||||
method-rgx = "([^\\W\\dA-Z][^\\WA-Z]{2,}|_[^\\WA-Z]*|__[^\\W\\dA-Z][^\\WA-Z]+__|do_[A-Z]+|of)$"
|
|
||||||
|
|
||||||
[tool.pylint.messages_control]
|
[tool.pylint.messages_control]
|
||||||
enable = "all"
|
enable = "all"
|
||||||
|
|||||||
@ -1,14 +1,12 @@
|
|||||||
# Exact pins, enforced by the shared dependency-freshness gate: a `>=`
|
# Exact pins, enforced by the shared dependency-freshness gate: a `>=`
|
||||||
# floor is satisfied by anything newer, so it tells a checker nothing
|
# floor is satisfied by anything newer, so it tells a checker nothing
|
||||||
# about whether this repo is actually current.
|
# about whether this repo is actually current.
|
||||||
argon2-cffi==25.1.0
|
|
||||||
bandit[toml]==1.9.4
|
bandit[toml]==1.9.4
|
||||||
mypy==2.4.1
|
mypy==2.4.0
|
||||||
pre-commit==4.7.0
|
pre-commit==4.7.0
|
||||||
pylint==4.1.4
|
pylint==4.1.3
|
||||||
pynacl==1.6.2
|
pytest==9.1.1
|
||||||
pytest==9.2.0
|
|
||||||
pytest-cov==7.1.0
|
pytest-cov==7.1.0
|
||||||
requests==2.34.2
|
requests==2.34.2
|
||||||
ruff==0.17.5
|
ruff==0.17.2
|
||||||
types-requests==2.33.0.20261030
|
types-requests==2.33.0.20261006
|
||||||
|
|||||||
@ -1,63 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Read-only E2E done check: list plaintext leaves in an RTDB JSON dump.
|
|
||||||
|
|
||||||
Feed it ``firebase database:get /<root>`` on stdin::
|
|
||||||
|
|
||||||
firebase database:get /todo-sync | python3 -m tool.e2e_audit todo-sync
|
|
||||||
|
|
||||||
Exit 0 when every leaf is sealed (or is the clear Argon2id header or a keyed
|
|
||||||
revision), 1 when any leaf is plaintext. A plain ``grep '"title"'`` misses
|
|
||||||
plaintext because RTDB serves each blob as an escaped JSON string; this
|
|
||||||
decodes the tree instead.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from crdt_sync import is_e2e_envelope
|
|
||||||
|
|
||||||
_HEX64 = re.compile(r"[0-9a-f]{64}")
|
|
||||||
|
|
||||||
|
|
||||||
def _decode_key(key: str) -> str:
|
|
||||||
return re.sub(r"~([0-9A-F]{2})", lambda m: chr(int(m.group(1), 16)), key)
|
|
||||||
|
|
||||||
|
|
||||||
def _is_clear_leaf(value: str) -> bool:
|
|
||||||
# Envelopes and the Argon2id header both carry an integer "v"; keyed
|
|
||||||
# revisions are 64 hex chars; a bare E2eCipher blob is base64, not JSON.
|
|
||||||
if is_e2e_envelope(value) or _HEX64.fullmatch(value):
|
|
||||||
return True
|
|
||||||
return not value.lstrip().startswith(("{", "["))
|
|
||||||
|
|
||||||
|
|
||||||
def plaintext_paths(tree: object, prefix: str = "") -> list[str]:
|
|
||||||
"""Return the decoded paths of every plaintext leaf under ``tree``."""
|
|
||||||
found: list[str] = []
|
|
||||||
if isinstance(tree, dict):
|
|
||||||
for key, value in tree.items():
|
|
||||||
path = f"{prefix}/{_decode_key(key)}" if prefix else _decode_key(key)
|
|
||||||
found.extend(plaintext_paths(value, path))
|
|
||||||
elif isinstance(tree, str):
|
|
||||||
if not _is_clear_leaf(tree):
|
|
||||||
found.append(prefix)
|
|
||||||
elif tree is not None:
|
|
||||||
found.append(prefix)
|
|
||||||
return found
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv: list[str]) -> int:
|
|
||||||
"""Audit the dump on stdin; ``argv[0]`` names the root for the report."""
|
|
||||||
root = argv[0] if argv else ""
|
|
||||||
paths = plaintext_paths(json.load(sys.stdin), root)
|
|
||||||
sys.stdout.write(f"plaintext leaves under /{root}: {len(paths)}\n")
|
|
||||||
for path in paths:
|
|
||||||
sys.stdout.write(f" {path}\n")
|
|
||||||
return 1 if paths else 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
raise SystemExit(main(sys.argv[1:]))
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Clear an app's old plaintext RTDB prefix after the E2E copy is verified.
|
|
||||||
|
|
||||||
Dry run by default; ``--apply`` deletes. Run only once every device runs an
|
|
||||||
encrypting build::
|
|
||||||
|
|
||||||
python3 -m tool.e2e_cleanup todo-sync/notes --app todo
|
|
||||||
python3 -m tool.e2e_cleanup todo-sync/notes --app todo --apply
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import sys
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
|
|
||||||
from crdt_sync import (
|
|
||||||
PASSWORD_FILE,
|
|
||||||
E2eLockedError,
|
|
||||||
FirebaseConfig,
|
|
||||||
clear_plaintext_prefix,
|
|
||||||
firebase_client_for,
|
|
||||||
)
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
|
||||||
from crdt_sync import RemoteStore
|
|
||||||
|
|
||||||
|
|
||||||
def run(store: RemoteStore, old_prefix: str, passphrase: str, *, apply: bool) -> int:
|
|
||||||
"""Clear (or list) ``old_prefix``; return a process exit code."""
|
|
||||||
try:
|
|
||||||
paths = clear_plaintext_prefix(
|
|
||||||
store, old_prefix, passphrase=passphrase, apply=apply
|
|
||||||
)
|
|
||||||
except E2eLockedError as exc:
|
|
||||||
sys.stdout.write(f"refused: {exc}\n")
|
|
||||||
return 1
|
|
||||||
verb = "deleted" if apply else "would delete"
|
|
||||||
sys.stdout.write(f"{verb} {len(paths)} plaintext blob(s) under /{old_prefix}\n")
|
|
||||||
for path in paths:
|
|
||||||
sys.stdout.write(f" {path}\n")
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv: list[str]) -> int: # pragma: no cover - live database entry
|
|
||||||
"""Parse args and run against the live database."""
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
|
||||||
parser.add_argument("old_prefix")
|
|
||||||
parser.add_argument("--app", required=True, help="seeded session name")
|
|
||||||
parser.add_argument("--apply", action="store_true")
|
|
||||||
args = parser.parse_args(argv)
|
|
||||||
client = firebase_client_for(args.app, config=FirebaseConfig.load())
|
|
||||||
passphrase = PASSWORD_FILE.read_text(encoding="utf-8").strip()
|
|
||||||
return run(client, args.old_prefix, passphrase, apply=args.apply)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__": # pragma: no cover
|
|
||||||
raise SystemExit(main(sys.argv[1:]))
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
# Copyright (c) 2026 Krzysztof Rudnicki
|
|
||||||
"""Write golden vectors sealed by Python for the Dart side to open.
|
|
||||||
|
|
||||||
Run from ``crdt-sync``::
|
|
||||||
|
|
||||||
python -m tool.e2e_vectors > e2e_py_vectors.json
|
|
||||||
|
|
||||||
then move the file to ``crdt_sync_dart/test/fixtures/``.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import json
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from crdt_sync import Argon2Params, seal_log_text, unlock_e2e
|
|
||||||
from crdt_sync.tests.conftest import FakeStore
|
|
||||||
|
|
||||||
# A public test-vector passphrase, not a secret.
|
|
||||||
PHRASE = "correct horse \u2713"
|
|
||||||
|
|
||||||
|
|
||||||
def vectors() -> dict[str, object]:
|
|
||||||
"""Return a fresh vector set (random salt and nonces)."""
|
|
||||||
remote = FakeStore()
|
|
||||||
key = unlock_e2e(
|
|
||||||
remote,
|
|
||||||
path_prefix="vec/notes-e2e",
|
|
||||||
passphrase=PHRASE,
|
|
||||||
params=Argon2Params(64, 2, 1),
|
|
||||||
e2e_path="vec/e2e",
|
|
||||||
)
|
|
||||||
path = "vec/notes-e2e/pc/log.json"
|
|
||||||
log = json.dumps(
|
|
||||||
{
|
|
||||||
"n9": {
|
|
||||||
"id": "n9",
|
|
||||||
"fields": {"title": ["zażółć", "2026-01-01T00:00:00.000Z-0000-pc"]},
|
|
||||||
"deleted": False,
|
|
||||||
"deleted_hlc": None,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
ensure_ascii=False,
|
|
||||||
)
|
|
||||||
cipher = key.cipher()
|
|
||||||
return {
|
|
||||||
"passphrase": PHRASE,
|
|
||||||
"header": remote.files["vec/e2e"],
|
|
||||||
"master_hex": key.master.hex(),
|
|
||||||
"path": path,
|
|
||||||
"log": log,
|
|
||||||
"envelope": seal_log_text(log, cipher, path=path),
|
|
||||||
"whole": seal_log_text("not a log", cipher, path=path),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
|
||||||
"""Print the vectors as JSON."""
|
|
||||||
sys.stdout.write(json.dumps(vectors(), indent=2, ensure_ascii=False) + "\n")
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
raise SystemExit(main())
|
|
||||||
@ -2,13 +2,6 @@
|
|||||||
library;
|
library;
|
||||||
|
|
||||||
export 'src/device.dart';
|
export 'src/device.dart';
|
||||||
export 'src/e2e_audit.dart';
|
|
||||||
export 'src/e2e_cipher.dart';
|
|
||||||
export 'src/e2e_envelope.dart';
|
|
||||||
export 'src/e2e_key.dart';
|
|
||||||
export 'src/e2e_migration.dart';
|
|
||||||
export 'src/e2e_open.dart';
|
|
||||||
export 'src/encrypting_store.dart';
|
|
||||||
export 'src/firebase_account_provisioning.dart';
|
export 'src/firebase_account_provisioning.dart';
|
||||||
export 'src/firebase_auth_error.dart';
|
export 'src/firebase_auth_error.dart';
|
||||||
export 'src/firebase_auth_rest.dart';
|
export 'src/firebase_auth_rest.dart';
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
import 'e2e_cipher.dart';
|
|
||||||
import 'e2e_envelope.dart';
|
|
||||||
import 'firebase_keys.dart';
|
|
||||||
|
|
||||||
/// Plaintext leaves in a decoded RTDB dump; empty once an app is migrated.
|
|
||||||
/// Decodes because RTDB serves blobs as escaped strings that defeat grep.
|
|
||||||
List<String> plaintextBlobPaths(Object? tree) {
|
|
||||||
final found = <String>[];
|
|
||||||
void walk(Object? node, String path) {
|
|
||||||
if (node is String) {
|
|
||||||
if (E2eCipher.isPlaintext(node) && !isE2eEnvelope(node)) found.add(path);
|
|
||||||
} else if (node is Map) {
|
|
||||||
for (final MapEntry(:key, :value) in node.entries) {
|
|
||||||
if (key == 'e2e' && value is String) continue;
|
|
||||||
final segment = decodeKey(key as String);
|
|
||||||
walk(value, path.isEmpty ? segment : '$path/$segment');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
walk(tree, '');
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
@ -1,97 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:cryptography/cryptography.dart';
|
|
||||||
|
|
||||||
const int e2eFormatVersion = 1;
|
|
||||||
|
|
||||||
const _nonceLength = 24;
|
|
||||||
const _tagLength = 16;
|
|
||||||
|
|
||||||
/// A FormatException so `syncLog` skips the peer instead of aborting the tick.
|
|
||||||
class E2eDecryptError extends FormatException {
|
|
||||||
E2eDecryptError(super.message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'E2eDecryptError: $message';
|
|
||||||
}
|
|
||||||
|
|
||||||
/// XChaCha20-Poly1305 per blob: base64 `[version][nonce][ct][tag]`, with the
|
|
||||||
/// version byte and remote path as AAD so blobs cannot be swapped.
|
|
||||||
///
|
|
||||||
/// [acceptPlaintext] reads un-migrated peers; turn it off after migration.
|
|
||||||
class E2eCipher {
|
|
||||||
E2eCipher(List<int> key, {this.acceptPlaintext = true})
|
|
||||||
: _key = SecretKey(List<int>.unmodifiable(key)) {
|
|
||||||
if (key.length != 32) {
|
|
||||||
throw ArgumentError.value(key.length, 'key', 'must be 32 bytes');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final SecretKey _key;
|
|
||||||
final bool acceptPlaintext;
|
|
||||||
|
|
||||||
static final _aead = Xchacha20.poly1305Aead();
|
|
||||||
|
|
||||||
static bool isPlaintext(String stored) {
|
|
||||||
final trimmed = stored.trimLeft();
|
|
||||||
return trimmed.startsWith('{') || trimmed.startsWith('[');
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> seal(String plaintext, {required String path}) async {
|
|
||||||
final box = await _aead.encrypt(
|
|
||||||
utf8.encode(plaintext),
|
|
||||||
secretKey: _key,
|
|
||||||
nonce: _aead.newNonce(),
|
|
||||||
aad: _aad(e2eFormatVersion, path),
|
|
||||||
);
|
|
||||||
return base64.encode([
|
|
||||||
e2eFormatVersion,
|
|
||||||
...box.nonce,
|
|
||||||
...box.cipherText,
|
|
||||||
...box.mac.bytes,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> open(String stored, {required String path}) async {
|
|
||||||
if (isPlaintext(stored)) {
|
|
||||||
if (acceptPlaintext) return stored;
|
|
||||||
throw E2eDecryptError('plaintext blob at $path after migration');
|
|
||||||
}
|
|
||||||
final List<int> bytes;
|
|
||||||
try {
|
|
||||||
bytes = base64.decode(stored);
|
|
||||||
} on FormatException {
|
|
||||||
throw E2eDecryptError('blob at $path is neither JSON nor base64');
|
|
||||||
}
|
|
||||||
if (bytes.isEmpty) throw E2eDecryptError('empty blob at $path');
|
|
||||||
final version = bytes.first;
|
|
||||||
if (version != e2eFormatVersion) {
|
|
||||||
throw E2eDecryptError(
|
|
||||||
'blob at $path uses format $version; update the app to read it',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (bytes.length < 1 + _nonceLength + _tagLength) {
|
|
||||||
throw E2eDecryptError('blob at $path is truncated');
|
|
||||||
}
|
|
||||||
final box = SecretBox(
|
|
||||||
bytes.sublist(1 + _nonceLength, bytes.length - _tagLength),
|
|
||||||
nonce: bytes.sublist(1, 1 + _nonceLength),
|
|
||||||
mac: Mac(bytes.sublist(bytes.length - _tagLength)),
|
|
||||||
);
|
|
||||||
try {
|
|
||||||
final clear = await _aead.decrypt(
|
|
||||||
box,
|
|
||||||
secretKey: _key,
|
|
||||||
aad: _aad(version, path),
|
|
||||||
);
|
|
||||||
return utf8.decode(clear);
|
|
||||||
} on SecretBoxAuthenticationError {
|
|
||||||
throw E2eDecryptError('blob at $path failed authentication');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static List<int> _aad(int version, String path) => [
|
|
||||||
version,
|
|
||||||
...utf8.encode(path),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@ -1,123 +0,0 @@
|
|||||||
/// The per-record wire envelope: record ids, the tombstone and the newest HLC
|
|
||||||
/// stay in clear so the relay can order and inspect; every field name and
|
|
||||||
/// value is sealed. Merge still runs on the decrypted [Log].
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'e2e_cipher.dart';
|
|
||||||
import 'hlc.dart';
|
|
||||||
|
|
||||||
const int _envelopeVersion = 1;
|
|
||||||
|
|
||||||
/// Whether [text] is an envelope (explicit `"v"` integer), not legacy plaintext.
|
|
||||||
///
|
|
||||||
/// A legacy log maps record ids to objects, so an id named `v` still maps to
|
|
||||||
/// a map, never an int.
|
|
||||||
bool isE2eEnvelope(String text) {
|
|
||||||
try {
|
|
||||||
final json = jsonDecode(text);
|
|
||||||
return json is Map && json['v'] is int;
|
|
||||||
} on FormatException {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String _aad(
|
|
||||||
String path,
|
|
||||||
String id,
|
|
||||||
bool deleted,
|
|
||||||
String? deletedHlc,
|
|
||||||
String? h,
|
|
||||||
) => '$path#$id#${deleted ? 1 : 0}#${deletedHlc ?? ''}#${h ?? ''}';
|
|
||||||
|
|
||||||
/// Seals a log (the `logToJson` shape) into an envelope. Text that is not
|
|
||||||
/// log-shaped is sealed whole, so nothing is ever pushed in clear.
|
|
||||||
Future<String> sealLogText(
|
|
||||||
String text,
|
|
||||||
E2eCipher cipher, {
|
|
||||||
required String path,
|
|
||||||
}) async {
|
|
||||||
final Map<String, dynamic> raw;
|
|
||||||
try {
|
|
||||||
raw = (jsonDecode(text) as Map).cast<String, dynamic>();
|
|
||||||
for (final entry in raw.entries) {
|
|
||||||
final rec = entry.value as Map;
|
|
||||||
if (rec['id'] != entry.key || rec['fields'] is! Map) {
|
|
||||||
throw const FormatException('not a log');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} on Object {
|
|
||||||
return jsonEncode({
|
|
||||||
'v': _envelopeVersion,
|
|
||||||
'b': await cipher.seal(text, path: path),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
final records = <String, Object?>{};
|
|
||||||
for (final entry in raw.entries) {
|
|
||||||
final rec = (entry.value as Map).cast<String, dynamic>();
|
|
||||||
final fields = (rec['fields'] as Map).cast<String, dynamic>();
|
|
||||||
Hlc? newest;
|
|
||||||
for (final field in fields.values) {
|
|
||||||
final hlc = Hlc.fromStr((field as List)[1] as String);
|
|
||||||
if (newest == null || hlc > newest) newest = hlc;
|
|
||||||
}
|
|
||||||
final deleted = rec['deleted'] as bool? ?? false;
|
|
||||||
final deletedHlc = rec['deleted_hlc'] as String?;
|
|
||||||
final h = newest?.toStr();
|
|
||||||
records[entry.key] = {
|
|
||||||
'd': deleted,
|
|
||||||
'dh': deletedHlc,
|
|
||||||
'h': h,
|
|
||||||
'p': await cipher.seal(
|
|
||||||
jsonEncode(fields),
|
|
||||||
path: _aad(path, entry.key, deleted, deletedHlc, h),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return jsonEncode({'v': _envelopeVersion, 'r': records});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Opens an envelope back to the `logToJson` shape. Legacy plaintext is
|
|
||||||
/// returned as-is while the cipher accepts it.
|
|
||||||
Future<String> openLogText(
|
|
||||||
String text,
|
|
||||||
E2eCipher cipher, {
|
|
||||||
required String path,
|
|
||||||
}) async {
|
|
||||||
if (!isE2eEnvelope(text)) {
|
|
||||||
if (cipher.acceptPlaintext) return text;
|
|
||||||
throw E2eDecryptError('plaintext blob at $path after migration');
|
|
||||||
}
|
|
||||||
final json = (jsonDecode(text) as Map).cast<String, dynamic>();
|
|
||||||
if (json['v'] != _envelopeVersion) {
|
|
||||||
throw E2eDecryptError(
|
|
||||||
'blob at $path uses format ${json['v']}; update the app to read it',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final whole = json['b'];
|
|
||||||
if (whole is String) return cipher.open(whole, path: path);
|
|
||||||
final records = json['r'];
|
|
||||||
if (records is! Map) throw E2eDecryptError('envelope at $path is mis-shaped');
|
|
||||||
final out = <String, Object?>{};
|
|
||||||
for (final entry in records.entries) {
|
|
||||||
final id = entry.key as String;
|
|
||||||
final rec = entry.value;
|
|
||||||
if (rec is! Map || rec['p'] is! String || rec['d'] is! bool) {
|
|
||||||
throw E2eDecryptError('record $id at $path is mis-shaped');
|
|
||||||
}
|
|
||||||
final deletedHlc = rec['dh'] as String?;
|
|
||||||
final h = rec['h'] as String?;
|
|
||||||
final clear = await cipher.open(
|
|
||||||
rec['p'] as String,
|
|
||||||
path: _aad(path, id, rec['d'] as bool, deletedHlc, h),
|
|
||||||
);
|
|
||||||
out[id] = {
|
|
||||||
'id': id,
|
|
||||||
'fields': jsonDecode(clear),
|
|
||||||
'deleted': rec['d'],
|
|
||||||
'deleted_hlc': deletedHlc,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return jsonEncode(out);
|
|
||||||
}
|
|
||||||
@ -1,225 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:cryptography/cryptography.dart';
|
|
||||||
|
|
||||||
import 'e2e_cipher.dart';
|
|
||||||
import 'e2e_params.dart';
|
|
||||||
import 'encrypting_store.dart';
|
|
||||||
import 'remote_store.dart';
|
|
||||||
|
|
||||||
export 'e2e_params.dart';
|
|
||||||
|
|
||||||
const _saltLength = 16;
|
|
||||||
const _headerVersion = 1;
|
|
||||||
|
|
||||||
/// The clear header's path: a sibling of the device dirs, like `revs`.
|
|
||||||
String defaultE2ePath(String pathPrefix) {
|
|
||||||
final cut = pathPrefix.lastIndexOf('/');
|
|
||||||
return cut < 0 ? '$pathPrefix/e2e' : '${pathPrefix.substring(0, cut)}/e2e';
|
|
||||||
}
|
|
||||||
|
|
||||||
class _Header {
|
|
||||||
_Header(this.salt, this.params, this.check);
|
|
||||||
|
|
||||||
factory _Header.parse(String text) {
|
|
||||||
final Object? json;
|
|
||||||
try {
|
|
||||||
json = jsonDecode(text);
|
|
||||||
} on FormatException {
|
|
||||||
throw E2eHeaderError('e2e header is not JSON');
|
|
||||||
}
|
|
||||||
if (json is! Map<String, dynamic>) {
|
|
||||||
throw E2eHeaderError('e2e header is not an object');
|
|
||||||
}
|
|
||||||
if (json['v'] != _headerVersion) {
|
|
||||||
throw E2eHeaderError('e2e header v${json['v']}; update the app');
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (json['kdf'] != 'argon2id') throw const FormatException();
|
|
||||||
return _Header(
|
|
||||||
base64.decode(json['salt'] as String),
|
|
||||||
Argon2Params(
|
|
||||||
memoryKiB: json['m'] as int,
|
|
||||||
iterations: json['t'] as int,
|
|
||||||
parallelism: json['p'] as int,
|
|
||||||
),
|
|
||||||
json['check'] as String,
|
|
||||||
);
|
|
||||||
} on Object {
|
|
||||||
throw E2eHeaderError('e2e header is malformed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<int> salt;
|
|
||||||
final Argon2Params params;
|
|
||||||
final String check;
|
|
||||||
|
|
||||||
String encode() => jsonEncode({
|
|
||||||
'v': _headerVersion,
|
|
||||||
'kdf': 'argon2id',
|
|
||||||
'salt': base64.encode(salt),
|
|
||||||
'm': params.memoryKiB,
|
|
||||||
't': params.iterations,
|
|
||||||
'p': params.parallelism,
|
|
||||||
'check': check,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A 32-byte master key plus its HKDF subkeys for sealing, revisions and the
|
|
||||||
/// passphrase check. Cache [bytes] in the OS keystore, never in RTDB.
|
|
||||||
class E2eKey {
|
|
||||||
E2eKey._(this.bytes, this._enc, this._rev, this._check);
|
|
||||||
|
|
||||||
static Future<E2eKey> fromBytes(List<int> bytes) {
|
|
||||||
if (bytes.length != 32) {
|
|
||||||
throw ArgumentError.value(bytes.length, 'bytes', 'must be 32 bytes');
|
|
||||||
}
|
|
||||||
return _expand(List<int>.unmodifiable(bytes));
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<E2eKey> _expand(List<int> master) async {
|
|
||||||
Future<List<int>> sub(String label) async {
|
|
||||||
final key = await Hkdf(hmac: Hmac.sha256(), outputLength: 32).deriveKey(
|
|
||||||
secretKey: SecretKey(master),
|
|
||||||
info: utf8.encode('crdt_sync e2e $label'),
|
|
||||||
);
|
|
||||||
return key.bytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return E2eKey._(
|
|
||||||
master,
|
|
||||||
await sub('enc'),
|
|
||||||
SecretKey(await sub('rev')),
|
|
||||||
SecretKey(await sub('check')),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<int> bytes;
|
|
||||||
final List<int> _enc;
|
|
||||||
final SecretKey _rev;
|
|
||||||
final SecretKey _check;
|
|
||||||
|
|
||||||
E2eCipher cipher({bool acceptPlaintext = true}) =>
|
|
||||||
E2eCipher(_enc, acceptPlaintext: acceptPlaintext);
|
|
||||||
|
|
||||||
/// Keyed `revisionOf`: a published revision cannot confirm a guessed log.
|
|
||||||
Future<String> revision(String text) async {
|
|
||||||
final mac = await Hmac.sha256().calculateMac(
|
|
||||||
utf8.encode(text),
|
|
||||||
secretKey: _rev,
|
|
||||||
);
|
|
||||||
return mac.bytes.map((b) => b.toRadixString(16).padLeft(2, '0')).join();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> _checkFor(List<int> salt) async {
|
|
||||||
final mac = await Hmac.sha256().calculateMac(salt, secretKey: _check);
|
|
||||||
return base64.encode(mac.bytes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<E2eKey> _derive(
|
|
||||||
String passphrase,
|
|
||||||
List<int> salt,
|
|
||||||
Argon2Params params,
|
|
||||||
) async {
|
|
||||||
final key = await Argon2id(
|
|
||||||
parallelism: params.parallelism,
|
|
||||||
memory: params.memoryKiB,
|
|
||||||
iterations: params.iterations,
|
|
||||||
hashLength: 32,
|
|
||||||
).deriveKeyFromPassword(password: passphrase, nonce: salt);
|
|
||||||
return E2eKey._expand(await key.extractBytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<_Header?> _readHeader(RemoteStore store, String path) async {
|
|
||||||
final text = await store.getFileText(path);
|
|
||||||
return text == null ? null : _Header.parse(text);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Derives this app's key from [passphrase], creating the header on first use.
|
|
||||||
///
|
|
||||||
/// Throws [E2eWrongPassphraseError] on a failed check and [E2eHeaderError]
|
|
||||||
/// for an unreadable header, which is never overwritten.
|
|
||||||
Future<E2eKey> unlockE2e({
|
|
||||||
required RemoteStore store,
|
|
||||||
required String pathPrefix,
|
|
||||||
required String passphrase,
|
|
||||||
Argon2Params params = Argon2Params.recommended,
|
|
||||||
Random? random,
|
|
||||||
String? e2ePath,
|
|
||||||
}) async {
|
|
||||||
if (passphrase.isEmpty) {
|
|
||||||
throw ArgumentError.value('', 'passphrase', 'must not be empty');
|
|
||||||
}
|
|
||||||
final path = e2ePath ?? defaultE2ePath(pathPrefix);
|
|
||||||
var header = await _readHeader(store, path);
|
|
||||||
if (header == null) {
|
|
||||||
final rng = random ?? Random.secure();
|
|
||||||
final salt = List<int>.generate(_saltLength, (_) => rng.nextInt(256));
|
|
||||||
final key = await _derive(passphrase, salt, params);
|
|
||||||
final encoded = _Header(salt, params, await key._checkFor(salt)).encode();
|
|
||||||
await store.putFileText(path, encoded, message: path);
|
|
||||||
// Two devices setting up at once: the last write wins, so re-read.
|
|
||||||
final stored = await store.getFileText(path) ?? encoded;
|
|
||||||
if (stored == encoded) return key;
|
|
||||||
header = _Header.parse(stored);
|
|
||||||
}
|
|
||||||
final key = await _derive(passphrase, header.salt, header.params);
|
|
||||||
if (await key._checkFor(header.salt) != header.check) {
|
|
||||||
throw E2eWrongPassphraseError();
|
|
||||||
}
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
sealed class E2eState {}
|
|
||||||
|
|
||||||
/// No header and no key: this app has never been encrypted.
|
|
||||||
final class E2eOff extends E2eState {}
|
|
||||||
|
|
||||||
enum E2eLockReason { needsPassphrase, wrongKey, badHeader }
|
|
||||||
|
|
||||||
/// Encryption is on, but this device must not sync until it has the key.
|
|
||||||
final class E2eLocked extends E2eState {
|
|
||||||
E2eLocked(this.reason);
|
|
||||||
|
|
||||||
final E2eLockReason reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
final class E2eReady extends E2eState {
|
|
||||||
E2eReady(this.store);
|
|
||||||
|
|
||||||
final EncryptingStore store;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<E2eState> openE2e({
|
|
||||||
required RemoteStore store,
|
|
||||||
required String pathPrefix,
|
|
||||||
E2eKey? key,
|
|
||||||
String? e2ePath,
|
|
||||||
String? revsPath,
|
|
||||||
bool acceptPlaintext = true,
|
|
||||||
}) async {
|
|
||||||
final _Header? header;
|
|
||||||
try {
|
|
||||||
header = await _readHeader(store, e2ePath ?? defaultE2ePath(pathPrefix));
|
|
||||||
} on E2eHeaderError {
|
|
||||||
return E2eLocked(E2eLockReason.badHeader);
|
|
||||||
}
|
|
||||||
if (key == null) {
|
|
||||||
return header == null ? E2eOff() : E2eLocked(E2eLockReason.needsPassphrase);
|
|
||||||
}
|
|
||||||
if (header == null || await key._checkFor(header.salt) != header.check) {
|
|
||||||
return E2eLocked(E2eLockReason.wrongKey);
|
|
||||||
}
|
|
||||||
return E2eReady(
|
|
||||||
EncryptingStore(
|
|
||||||
store,
|
|
||||||
key,
|
|
||||||
pathPrefix: pathPrefix,
|
|
||||||
revsPath: revsPath,
|
|
||||||
e2ePath: e2ePath,
|
|
||||||
acceptPlaintext: acceptPlaintext,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,217 +0,0 @@
|
|||||||
/// The one-time copy from a plaintext prefix to `<prefix>-e2e`.
|
|
||||||
///
|
|
||||||
/// Re-encrypting in place is rejected: an old build still writing the old
|
|
||||||
/// prefix would be broken mid-migration. Instead the old prefix stays
|
|
||||||
/// untouched until [deletePlaintextPrefix] verifies the copy.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'e2e_key.dart';
|
|
||||||
import 'encrypting_store.dart';
|
|
||||||
import 'log.dart';
|
|
||||||
import 'record.dart';
|
|
||||||
import 'remote_store.dart';
|
|
||||||
import 'store.dart';
|
|
||||||
import 'sync.dart';
|
|
||||||
|
|
||||||
/// Where an app's encrypted data lives, derived from its old plaintext prefix.
|
|
||||||
class E2eLayout {
|
|
||||||
const E2eLayout._(this.prefix, this.revsPath, this.e2ePath);
|
|
||||||
|
|
||||||
/// `<oldPrefix>-e2e`, with revisions and header apart from the old ones so
|
|
||||||
/// old builds neither see nor clobber them.
|
|
||||||
///
|
|
||||||
/// A slashless prefix (`settings-sync`) keeps revisions and header inside
|
|
||||||
/// its own node, as `defaultRevsPath` does, never at the database root.
|
|
||||||
factory E2eLayout.of(String oldPrefix) {
|
|
||||||
final prefix = '$oldPrefix-e2e';
|
|
||||||
final cut = oldPrefix.lastIndexOf('/');
|
|
||||||
if (cut < 0) {
|
|
||||||
return E2eLayout._(prefix, '$prefix/revs', '$prefix/e2e');
|
|
||||||
}
|
|
||||||
final parent = oldPrefix.substring(0, cut);
|
|
||||||
return E2eLayout._(prefix, '$parent/revs-e2e', defaultE2ePath(prefix));
|
|
||||||
}
|
|
||||||
|
|
||||||
final String prefix;
|
|
||||||
final String revsPath;
|
|
||||||
final String e2ePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
class MigrationReport {
|
|
||||||
const MigrationReport(this.copied, this.skipped);
|
|
||||||
|
|
||||||
/// Blobs written (new or changed) this run.
|
|
||||||
final int copied;
|
|
||||||
|
|
||||||
/// Source blobs unreadable as a log, relative path.
|
|
||||||
final List<String> skipped;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Every text blob under [root], keyed by path relative to it: flat
|
|
||||||
/// `<node>.json` leaves and nested `<device>/<file>` blobs. Real RTDB bulk
|
|
||||||
/// reads return direct string children only, so dirs are walked.
|
|
||||||
Future<Map<String, String>> _listBlobs(RemoteStore store, String root) async {
|
|
||||||
final out = <String, String>{};
|
|
||||||
if (store is BulkMapReader) {
|
|
||||||
out.addAll(await (store as BulkMapReader).getStringMap(root));
|
|
||||||
}
|
|
||||||
final revs = defaultRevsPath(root);
|
|
||||||
final header = defaultE2ePath(root);
|
|
||||||
for (final name in await store.listDirectory(root)) {
|
|
||||||
if (out.containsKey(name)) continue;
|
|
||||||
final full = '$root/$name';
|
|
||||||
if (full == header || full == revs) continue;
|
|
||||||
final children = await _safeList(store, full);
|
|
||||||
if (children.isEmpty) {
|
|
||||||
final text = await _safeRead(store, full);
|
|
||||||
if (text != null) out[name] = text;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
for (final child in children) {
|
|
||||||
final text = await _safeRead(store, '$full/$child');
|
|
||||||
if (text != null) out['$name/$child'] = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
out.removeWhere(
|
|
||||||
(rel, _) => '$root/$rel' == header || '$root/$rel'.startsWith('$revs/'),
|
|
||||||
);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<List<String>> _safeList(RemoteStore store, String path) async {
|
|
||||||
try {
|
|
||||||
return await store.listDirectory(path);
|
|
||||||
} on Object {
|
|
||||||
return const [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String?> _safeRead(RemoteStore store, String path) async {
|
|
||||||
try {
|
|
||||||
return await store.getFileText(path);
|
|
||||||
} on Object {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EncryptingStore _dest(RemoteStore store, E2eKey key, E2eLayout layout) =>
|
|
||||||
EncryptingStore(
|
|
||||||
store,
|
|
||||||
key,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
revsPath: layout.revsPath,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// Order-independent signature of a log, to tell "same records" cheaply.
|
|
||||||
String _signature(Log log) {
|
|
||||||
final ids = log.keys.toList()..sort();
|
|
||||||
return jsonEncode([
|
|
||||||
for (final id in ids)
|
|
||||||
[
|
|
||||||
id,
|
|
||||||
log[id]!.deleted,
|
|
||||||
log[id]!.deletedHlc?.toStr(),
|
|
||||||
[
|
|
||||||
for (final name in (log[id]!.fields.keys.toList()..sort()))
|
|
||||||
[
|
|
||||||
name,
|
|
||||||
jsonEncode(log[id]!.fields[name]!.$1),
|
|
||||||
log[id]!.fields[name]!.$2.toStr(),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Log? _parse(String text) {
|
|
||||||
try {
|
|
||||||
return logFromJson(text);
|
|
||||||
} on FormatException {
|
|
||||||
return null;
|
|
||||||
} on TypeError {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Copies every readable plaintext log under [fromPrefix] into the encrypted
|
|
||||||
/// prefix, merging into what is already there. Idempotent: an unchanged
|
|
||||||
/// destination is not rewritten. Never touches [fromPrefix].
|
|
||||||
Future<MigrationReport> copyToEncrypted({
|
|
||||||
required RemoteStore store,
|
|
||||||
required E2eKey key,
|
|
||||||
required String fromPrefix,
|
|
||||||
required E2eLayout layout,
|
|
||||||
}) async {
|
|
||||||
final dest = _dest(store, key, layout);
|
|
||||||
var copied = 0;
|
|
||||||
final skipped = <String>[];
|
|
||||||
final blobs = await _listBlobs(store, fromPrefix);
|
|
||||||
for (final MapEntry(key: rel, value: text) in blobs.entries) {
|
|
||||||
final source = _parse(text);
|
|
||||||
if (source == null) {
|
|
||||||
skipped.add(rel);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (source.isEmpty) continue;
|
|
||||||
final path = '${layout.prefix}/$rel';
|
|
||||||
final existing = await dest.getFileText(path);
|
|
||||||
final current = existing == null ? null : _parse(existing);
|
|
||||||
// Not a sync log (an app's own blob): never overwrite it.
|
|
||||||
if (existing != null && current == null) continue;
|
|
||||||
final merged = mergeLogs(current ?? <String, Record>{}, source);
|
|
||||||
if (current != null && _signature(merged) == _signature(current)) continue;
|
|
||||||
await dest.putFileText(path, logToJson(merged), message: 'e2e copy');
|
|
||||||
copied++;
|
|
||||||
}
|
|
||||||
return MigrationReport(copied, skipped);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// True when every readable plaintext blob is contained in the encrypted copy
|
|
||||||
/// and none is unreadable.
|
|
||||||
Future<bool> verifyCopy({
|
|
||||||
required RemoteStore store,
|
|
||||||
required E2eKey key,
|
|
||||||
required String fromPrefix,
|
|
||||||
required E2eLayout layout,
|
|
||||||
}) async {
|
|
||||||
final dest = _dest(store, key, layout);
|
|
||||||
for (final MapEntry(key: rel, value: text) in (await _listBlobs(
|
|
||||||
store,
|
|
||||||
fromPrefix,
|
|
||||||
)).entries) {
|
|
||||||
final source = _parse(text);
|
|
||||||
if (source == null) return false;
|
|
||||||
final existing = await dest.getFileText('${layout.prefix}/$rel');
|
|
||||||
final current = existing == null ? null : _parse(existing);
|
|
||||||
if (current == null) return false;
|
|
||||||
if (_signature(mergeLogs(current, source)) != _signature(current)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deletes the plaintext prefix, only after [verifyCopy] passes. Returns
|
|
||||||
/// whether it deleted.
|
|
||||||
Future<bool> deletePlaintextPrefix({
|
|
||||||
required RemoteStore store,
|
|
||||||
required E2eKey key,
|
|
||||||
required String fromPrefix,
|
|
||||||
required E2eLayout layout,
|
|
||||||
}) async {
|
|
||||||
if (!await verifyCopy(
|
|
||||||
store: store,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: fromPrefix,
|
|
||||||
layout: layout,
|
|
||||||
)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (final rel in (await _listBlobs(store, fromPrefix)).keys) {
|
|
||||||
await store.deleteFile('$fromPrefix/$rel', message: 'e2e cleanup');
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
@ -1,142 +0,0 @@
|
|||||||
/// Opens the encrypted store for an app whose old plaintext prefix is
|
|
||||||
/// [oldPrefix]; data lives on `E2eLayout.of(oldPrefix)`.
|
|
||||||
///
|
|
||||||
/// [readPassphrase] supplies the shared crdt-sync passphrase from the OS
|
|
||||||
/// keystore, so the open is prompt-free. Fail closed: a missing or wrong
|
|
||||||
/// passphrase, or an unreadable header, returns [E2eLocked] and the caller
|
|
||||||
/// must not sync. On success the old plaintext prefix is copied over
|
|
||||||
/// (idempotent; picks up writes from builds not yet migrated) and is never
|
|
||||||
/// deleted here.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'e2e_key.dart';
|
|
||||||
import 'e2e_migration.dart';
|
|
||||||
import 'remote_store.dart';
|
|
||||||
import 'sync.dart';
|
|
||||||
|
|
||||||
/// Keystore entry name apps store the shared passphrase under.
|
|
||||||
const String kE2ePassphraseStorageKey = 'crdt_sync_e2e_passphrase';
|
|
||||||
|
|
||||||
/// Where a device keeps its derived 32-byte key, so Argon2id runs once per
|
|
||||||
/// device rather than once per sync tick. Back it with the OS keystore.
|
|
||||||
class E2eKeyCache {
|
|
||||||
/// Creates a cache from [read] and [write] closures.
|
|
||||||
const E2eKeyCache({required this.read, required this.write});
|
|
||||||
|
|
||||||
/// Returns the cached key bytes, or null.
|
|
||||||
final Future<List<int>?> Function() read;
|
|
||||||
|
|
||||||
/// Stores freshly derived key bytes.
|
|
||||||
final Future<void> Function(List<int> bytes) write;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Old-prefix revision fingerprints already copied, per old prefix.
|
|
||||||
final Map<String, String> _copied = {};
|
|
||||||
|
|
||||||
/// Forgets which old prefixes were copied; for tests.
|
|
||||||
void resetE2eCopyMemo() => _copied.clear();
|
|
||||||
|
|
||||||
Future<String> _oldFingerprint(RemoteStore store, String oldPrefix) async {
|
|
||||||
if (store is! BulkMapReader) return '';
|
|
||||||
try {
|
|
||||||
final revs = await (store as BulkMapReader).getStringMap(
|
|
||||||
defaultRevsPath(oldPrefix),
|
|
||||||
);
|
|
||||||
final keys = revs.keys.toList()..sort();
|
|
||||||
return [for (final k in keys) '$k=${revs[k]}'].join(';');
|
|
||||||
} on Object {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<E2eReady?> _tryCached(
|
|
||||||
RemoteStore store,
|
|
||||||
E2eLayout layout,
|
|
||||||
E2eKeyCache? cache,
|
|
||||||
) async {
|
|
||||||
final bytes = await cache?.read();
|
|
||||||
if (bytes == null || bytes.length != 32) return null;
|
|
||||||
final state = await openE2e(
|
|
||||||
store: store,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
key: await E2eKey.fromBytes(bytes),
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
revsPath: layout.revsPath,
|
|
||||||
);
|
|
||||||
return state is E2eReady ? state : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Opens the encrypted store; see the library doc.
|
|
||||||
///
|
|
||||||
/// [keyCache] skips Argon2id when it holds the key for the current header.
|
|
||||||
/// The one-time copy reruns only when the old prefix's published revisions
|
|
||||||
/// change (or once per process where the backend cannot bulk-read them).
|
|
||||||
/// [onDerive] is called each time Argon2id actually runs; for tests.
|
|
||||||
Future<E2eState> openEncryptedStore({
|
|
||||||
required RemoteStore store,
|
|
||||||
required String oldPrefix,
|
|
||||||
required Future<String?> Function() readPassphrase,
|
|
||||||
Argon2Params params = Argon2Params.recommended,
|
|
||||||
E2eKeyCache? keyCache,
|
|
||||||
void Function()? onDerive,
|
|
||||||
}) async {
|
|
||||||
final layout = E2eLayout.of(oldPrefix);
|
|
||||||
final E2eReady ready;
|
|
||||||
final E2eReady? cached;
|
|
||||||
try {
|
|
||||||
cached = await _tryCached(store, layout, keyCache);
|
|
||||||
} on E2eHeaderError {
|
|
||||||
return E2eLocked(E2eLockReason.badHeader);
|
|
||||||
}
|
|
||||||
if (cached != null) {
|
|
||||||
ready = cached;
|
|
||||||
} else {
|
|
||||||
final passphrase = await readPassphrase();
|
|
||||||
if (passphrase == null || passphrase.isEmpty) {
|
|
||||||
return E2eLocked(E2eLockReason.needsPassphrase);
|
|
||||||
}
|
|
||||||
final E2eKey key;
|
|
||||||
try {
|
|
||||||
onDerive?.call();
|
|
||||||
key = await unlockE2e(
|
|
||||||
store: store,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
passphrase: passphrase,
|
|
||||||
params: params,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
);
|
|
||||||
} on E2eWrongPassphraseError {
|
|
||||||
return E2eLocked(E2eLockReason.wrongKey);
|
|
||||||
} on E2eHeaderError {
|
|
||||||
return E2eLocked(E2eLockReason.badHeader);
|
|
||||||
}
|
|
||||||
await keyCache?.write(key.bytes);
|
|
||||||
final state = await openE2e(
|
|
||||||
store: store,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
key: key,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
revsPath: layout.revsPath,
|
|
||||||
);
|
|
||||||
if (state is! E2eReady) return state;
|
|
||||||
ready = state;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
final print = await _oldFingerprint(store, oldPrefix);
|
|
||||||
if (_copied[oldPrefix] != print) {
|
|
||||||
await copyToEncrypted(
|
|
||||||
store: store,
|
|
||||||
key: ready.store.key,
|
|
||||||
fromPrefix: oldPrefix,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
_copied[oldPrefix] = print;
|
|
||||||
}
|
|
||||||
} on Object catch (error, stackTrace) {
|
|
||||||
// The copy is retried next open; sync itself must not stop for it.
|
|
||||||
log('e2e copy failed', level: 900, error: error, stackTrace: stackTrace);
|
|
||||||
}
|
|
||||||
return ready;
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
/// The e2e header's Argon2id cost and the errors unlocking it can raise.
|
|
||||||
library;
|
|
||||||
|
|
||||||
/// Argon2id cost, stored in the header so it can be raised later.
|
|
||||||
class Argon2Params {
|
|
||||||
const Argon2Params({
|
|
||||||
required this.memoryKiB,
|
|
||||||
required this.iterations,
|
|
||||||
required this.parallelism,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// OWASP's floor (19 MiB, t=2); higher stalls the Flutter-web desktop build.
|
|
||||||
static const recommended = Argon2Params(
|
|
||||||
memoryKiB: 19456,
|
|
||||||
iterations: 2,
|
|
||||||
parallelism: 1,
|
|
||||||
);
|
|
||||||
|
|
||||||
final int memoryKiB;
|
|
||||||
final int iterations;
|
|
||||||
final int parallelism;
|
|
||||||
}
|
|
||||||
|
|
||||||
class E2eHeaderError extends FormatException {
|
|
||||||
E2eHeaderError(super.message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() => 'E2eHeaderError: $message';
|
|
||||||
}
|
|
||||||
|
|
||||||
class E2eWrongPassphraseError implements Exception {
|
|
||||||
@override
|
|
||||||
String toString() => 'E2eWrongPassphraseError: wrong sync passphrase';
|
|
||||||
}
|
|
||||||
@ -1,98 +0,0 @@
|
|||||||
import 'e2e_cipher.dart';
|
|
||||||
import 'e2e_envelope.dart';
|
|
||||||
import 'e2e_key.dart';
|
|
||||||
import 'remote_store.dart';
|
|
||||||
import 'sync.dart';
|
|
||||||
|
|
||||||
/// A [RemoteStore] that seals every blob under `pathPrefix` (nested
|
|
||||||
/// `<device>/<file>` or flat `<node>.json`) except the header, as a
|
|
||||||
/// per-record envelope (ids and HLCs clear, names and values opaque), and
|
|
||||||
/// keys every revision under `revsPath`, so the remote is a blind relay.
|
|
||||||
///
|
|
||||||
/// Wrap the outermost store (above a `MirrorStore`) so every backend gets
|
|
||||||
/// ciphertext. Other paths pass through unchanged.
|
|
||||||
class EncryptingStore implements RemoteStore, BulkMapReader {
|
|
||||||
EncryptingStore(
|
|
||||||
this._inner,
|
|
||||||
this._key, {
|
|
||||||
required String pathPrefix,
|
|
||||||
String? revsPath,
|
|
||||||
String? e2ePath,
|
|
||||||
bool acceptPlaintext = true,
|
|
||||||
}) : _cipher = _key.cipher(acceptPlaintext: acceptPlaintext),
|
|
||||||
_prefix = pathPrefix,
|
|
||||||
_revs = revsPath ?? defaultRevsPath(pathPrefix),
|
|
||||||
_header = e2ePath ?? defaultE2ePath(pathPrefix);
|
|
||||||
|
|
||||||
final RemoteStore _inner;
|
|
||||||
final E2eKey _key;
|
|
||||||
|
|
||||||
/// The key this store seals with.
|
|
||||||
E2eKey get key => _key;
|
|
||||||
final E2eCipher _cipher;
|
|
||||||
final String _prefix;
|
|
||||||
final String _revs;
|
|
||||||
final String _header;
|
|
||||||
|
|
||||||
bool _isRev(String path) => path.startsWith('$_revs/');
|
|
||||||
|
|
||||||
bool _isLog(String path) =>
|
|
||||||
!_isRev(path) && path != _header && path.startsWith('$_prefix/');
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getFileText(String path) async {
|
|
||||||
final text = await _inner.getFileText(path);
|
|
||||||
if (text == null || !_isLog(path)) return text;
|
|
||||||
return openLogText(text, _cipher, path: path);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> putFileText(
|
|
||||||
String path,
|
|
||||||
String text, {
|
|
||||||
required String message,
|
|
||||||
}) async {
|
|
||||||
final stored = _isLog(path)
|
|
||||||
? await sealLogText(text, _cipher, path: path)
|
|
||||||
: _isRev(path)
|
|
||||||
? await _key.revision(text)
|
|
||||||
: text;
|
|
||||||
await _inner.putFileText(path, stored, message: message);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Map<String, String>> getStringMap(String path) async {
|
|
||||||
if (_inner case final BulkMapReader reader) {
|
|
||||||
final map = await reader.getStringMap(path);
|
|
||||||
if (!_isLog('$path/x')) return map;
|
|
||||||
final out = <String, String>{};
|
|
||||||
for (final MapEntry(:key, :value) in map.entries) {
|
|
||||||
final full = '$path/$key';
|
|
||||||
if (!_isLog(full)) {
|
|
||||||
out[key] = value;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
out[key] = await openLogText(value, _cipher, path: full);
|
|
||||||
} on E2eDecryptError {
|
|
||||||
// Unreadable entries are dropped, as a corrupt value would be.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
return const {};
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<String>> listDirectory(String path) => _inner.listDirectory(path);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteFile(String path, {String message = ''}) =>
|
|
||||||
_inner.deleteFile(path, message: message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> canAccessRemote() => _inner.canAccessRemote();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void close() => _inner.close();
|
|
||||||
}
|
|
||||||
@ -2,7 +2,6 @@ import 'dart:convert';
|
|||||||
|
|
||||||
import 'package:crypto/crypto.dart';
|
import 'package:crypto/crypto.dart';
|
||||||
|
|
||||||
import 'e2e_cipher.dart';
|
|
||||||
import 'log.dart';
|
import 'log.dart';
|
||||||
import 'record.dart';
|
import 'record.dart';
|
||||||
import 'remote_store.dart';
|
import 'remote_store.dart';
|
||||||
@ -45,9 +44,6 @@ String revisionOf(String encodedLog) =>
|
|||||||
/// treated as this device's own rather than as a peer's, so its
|
/// treated as this device's own rather than as a peer's, so its
|
||||||
/// pre-migration log is not pulled back and re-merged every tick. Pass null
|
/// pre-migration log is not pulled back and re-merged every tick. Pass null
|
||||||
/// once that path has been reclaimed.
|
/// once that path has been reclaimed.
|
||||||
///
|
|
||||||
/// [onPeerSkipped] reports each peer skipped as unreadable, e.g. an
|
|
||||||
/// [E2eDecryptError] from a wrong key or an app that needs updating.
|
|
||||||
Future<Log> syncLog({
|
Future<Log> syncLog({
|
||||||
required RemoteStore client,
|
required RemoteStore client,
|
||||||
required String deviceId,
|
required String deviceId,
|
||||||
@ -60,7 +56,6 @@ Future<Log> syncLog({
|
|||||||
SyncStateStore? stateStore,
|
SyncStateStore? stateStore,
|
||||||
String? revsPath,
|
String? revsPath,
|
||||||
String? legacyDeviceId,
|
String? legacyDeviceId,
|
||||||
void Function(String deviceId, Object error)? onPeerSkipped,
|
|
||||||
}) async {
|
}) async {
|
||||||
final revs = revsPath ?? defaultRevsPath(pathPrefix);
|
final revs = revsPath ?? defaultRevsPath(pathPrefix);
|
||||||
final state = await stateStore?.load() ?? const SyncState();
|
final state = await stateStore?.load() ?? const SyncState();
|
||||||
@ -85,21 +80,15 @@ Future<Log> syncLog({
|
|||||||
seenRevs[otherDeviceId] = remoteRev;
|
seenRevs[otherDeviceId] = remoteRev;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final String? text;
|
final text = await client.getFileText(
|
||||||
try {
|
'$pathPrefix/$otherDeviceId/$filename',
|
||||||
text = await client.getFileText('$pathPrefix/$otherDeviceId/$filename');
|
);
|
||||||
} on E2eDecryptError catch (error) {
|
|
||||||
onPeerSkipped?.call(otherDeviceId, error);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (text == null) continue;
|
if (text == null) continue;
|
||||||
try {
|
try {
|
||||||
mergedLog = mergeLogs(mergedLog, decode(text));
|
mergedLog = mergeLogs(mergedLog, decode(text));
|
||||||
} on FormatException catch (error) {
|
} on FormatException {
|
||||||
onPeerSkipped?.call(otherDeviceId, error);
|
|
||||||
continue;
|
continue;
|
||||||
} on TypeError catch (error) {
|
} on TypeError {
|
||||||
onPeerSkipped?.call(otherDeviceId, error);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Only remembered once the merge succeeded: a corrupt push must be
|
// Only remembered once the merge succeeded: a corrupt push must be
|
||||||
|
|||||||
@ -41,14 +41,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.2"
|
version: "2.1.2"
|
||||||
characters:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: characters
|
|
||||||
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.4.1"
|
|
||||||
cli_config:
|
cli_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -89,22 +81,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.0.8"
|
version: "3.0.8"
|
||||||
cryptography:
|
|
||||||
dependency: "direct main"
|
|
||||||
description:
|
|
||||||
name: cryptography
|
|
||||||
sha256: "3eda3029d34ec9095a27a198ac9785630fe525c0eb6a49f3d575272f8e792ef0"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.9.0"
|
|
||||||
ffi:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: ffi
|
|
||||||
sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "2.2.0"
|
|
||||||
file:
|
file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@ -121,14 +97,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0"
|
version: "4.0.0"
|
||||||
glados:
|
|
||||||
dependency: "direct dev"
|
|
||||||
description:
|
|
||||||
name: glados
|
|
||||||
sha256: c39446c0c4fe83a6ee6ee4fdee5a1afa27050619c7df390bf4c3b77b6f1acb33
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.7"
|
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -2,7 +2,7 @@ name: crdt_sync
|
|||||||
description: >-
|
description: >-
|
||||||
Shared CRDT merge scheme + GitHub-Contents-API sync transport for
|
Shared CRDT merge scheme + GitHub-Contents-API sync transport for
|
||||||
cross-device apps. Pure Dart, no Flutter dependency.
|
cross-device apps. Pure Dart, no Flutter dependency.
|
||||||
version: 0.14.1
|
version: 0.12.1
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
@ -10,10 +10,8 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
crypto: 3.0.8
|
crypto: 3.0.8
|
||||||
cryptography: 2.9.0
|
|
||||||
http: 1.6.0
|
http: 1.6.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
glados: 1.1.7
|
|
||||||
lints: 6.1.0
|
lints: 6.1.0
|
||||||
test: 1.33.0
|
test: 1.33.0
|
||||||
|
|||||||
@ -40,7 +40,9 @@ void main() {
|
|||||||
// Nothing listens on this port, so the GET throws and the `on Exception`
|
// Nothing listens on this port, so the GET throws and the `on Exception`
|
||||||
// path returns null -- while the `finally` still closes the client the
|
// path returns null -- while the `finally` still closes the client the
|
||||||
// function created for itself.
|
// function created for itself.
|
||||||
final account = await accountFromWrapper(Uri.parse('http://127.0.0.1:1'));
|
final account = await accountFromWrapper(
|
||||||
|
Uri.parse('http://127.0.0.1:1'),
|
||||||
|
);
|
||||||
expect(account, isNull);
|
expect(account, isNull);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -48,10 +50,8 @@ void main() {
|
|||||||
final mock = http_testing.MockClient(
|
final mock = http_testing.MockClient(
|
||||||
(_) async => http.Response(jsonEncode({}), 404),
|
(_) async => http.Response(jsonEncode({}), 404),
|
||||||
);
|
);
|
||||||
expect(
|
expect(await accountFromWrapper(Uri.parse('http://x'), client: mock),
|
||||||
await accountFromWrapper(Uri.parse('http://x'), client: mock),
|
isNull);
|
||||||
isNull,
|
|
||||||
);
|
|
||||||
// Still usable: the function must not close a client it did not create.
|
// Still usable: the function must not close a client it did not create.
|
||||||
expect((await mock.get(Uri.parse('http://x'))).statusCode, 404);
|
expect((await mock.get(Uri.parse('http://x'))).statusCode, 404);
|
||||||
});
|
});
|
||||||
@ -106,26 +106,22 @@ void main() {
|
|||||||
expect(await store.read(), isNull);
|
expect(await store.read(), isNull);
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
test('read returns null when the file cannot be read', () async {
|
||||||
'read returns null when the file cannot be read',
|
// A mode-000 file still passes existsSync, so the guard does not fire
|
||||||
() async {
|
// and readAsString throws PathAccessException (a FileSystemException).
|
||||||
// A mode-000 file still passes existsSync, so the guard does not fire
|
// A directory would NOT work here: File.existsSync() is false for one,
|
||||||
// and readAsString throws PathAccessException (a FileSystemException).
|
// so read() would return early down the guard path instead.
|
||||||
// A directory would NOT work here: File.existsSync() is false for one,
|
final file = File('${dir.path}/unreadable.json')..writeAsStringSync('{}');
|
||||||
// so read() would return early down the guard path instead.
|
final chmod = Process.runSync('chmod', ['000', file.path]);
|
||||||
final file = File('${dir.path}/unreadable.json')
|
expect(chmod.exitCode, 0);
|
||||||
..writeAsStringSync('{}');
|
addTearDown(() => Process.runSync('chmod', ['644', file.path]));
|
||||||
final chmod = Process.runSync('chmod', ['000', file.path]);
|
|
||||||
expect(chmod.exitCode, 0);
|
|
||||||
addTearDown(() => Process.runSync('chmod', ['644', file.path]));
|
|
||||||
|
|
||||||
expect(await FileLogPersistence(file).read(), isNull);
|
expect(await FileLogPersistence(file).read(), isNull);
|
||||||
},
|
},
|
||||||
// root ignores the permission bits, so the exception never fires.
|
// root ignores the permission bits, so the exception never fires.
|
||||||
skip: Platform.environment['USER'] == 'root'
|
skip: Platform.environment['USER'] == 'root'
|
||||||
? 'permission bits do not apply to root'
|
? 'permission bits do not apply to root'
|
||||||
: null,
|
: null);
|
||||||
);
|
|
||||||
|
|
||||||
test('round-trips what it wrote', () async {
|
test('round-trips what it wrote', () async {
|
||||||
final store = FileLogPersistence(File('${dir.path}/log.json'));
|
final store = FileLogPersistence(File('${dir.path}/log.json'));
|
||||||
@ -133,38 +129,31 @@ void main() {
|
|||||||
expect(await store.read(), '{"hello":"world"}');
|
expect(await store.read(), '{"hello":"world"}');
|
||||||
});
|
});
|
||||||
|
|
||||||
test(
|
test('50 overlapping writes all succeed and the last issued wins',
|
||||||
'50 overlapping writes all succeed and the last issued wins',
|
() async {
|
||||||
() async {
|
// Regression: every call shared one `<file>.<pid>.tmp`, so the first
|
||||||
// Regression: every call shared one `<file>.<pid>.tmp`, so the first
|
// rename moved it away and a later rename threw PathNotFoundException.
|
||||||
// rename moved it away and a later rename threw PathNotFoundException.
|
final store = FileLogPersistence(File('${dir.path}/log.json'));
|
||||||
final store = FileLogPersistence(File('${dir.path}/log.json'));
|
await Future.wait([
|
||||||
await Future.wait([
|
for (var i = 0; i < 50; i++) store.write('{"n":$i}'),
|
||||||
for (var i = 0; i < 50; i++) store.write('{"n":$i}'),
|
]);
|
||||||
]);
|
expect(await store.read(), '{"n":49}');
|
||||||
expect(await store.read(), '{"n":49}');
|
expect(dir.listSync().map((e) => e.uri.pathSegments.last),
|
||||||
expect(dir.listSync().map((e) => e.uri.pathSegments.last), [
|
['log.json']);
|
||||||
'log.json',
|
});
|
||||||
]);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
test(
|
test('a failed write rejects its caller but does not block later writes',
|
||||||
'a failed write rejects its caller but does not block later writes',
|
() async {
|
||||||
() async {
|
final target = File('${dir.path}/log.json');
|
||||||
final target = File('${dir.path}/log.json');
|
// A directory at the target path makes the rename fail.
|
||||||
// A directory at the target path makes the rename fail.
|
Directory(target.path).createSync();
|
||||||
Directory(target.path).createSync();
|
final store = FileLogPersistence(target);
|
||||||
final store = FileLogPersistence(target);
|
await expectLater(
|
||||||
await expectLater(
|
store.write('{"n":0}'), throwsA(isA<FileSystemException>()));
|
||||||
store.write('{"n":0}'),
|
|
||||||
throwsA(isA<FileSystemException>()),
|
|
||||||
);
|
|
||||||
|
|
||||||
Directory(target.path).deleteSync();
|
Directory(target.path).deleteSync();
|
||||||
await store.write('{"n":1}');
|
await store.write('{"n":1}');
|
||||||
expect(await store.read(), '{"n":1}');
|
expect(await store.read(), '{"n":1}');
|
||||||
},
|
});
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,56 +0,0 @@
|
|||||||
/// The done check: find plaintext blobs in a raw RTDB dump.
|
|
||||||
///
|
|
||||||
/// RTDB returns each blob as a JSON string, so its quotes arrive escaped and
|
|
||||||
/// `grep -c '"title"'` prints 0 even on plaintext. The audit decodes instead.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
// Shape copied from a live `GET /<root>.json` (scratch data).
|
|
||||||
const _livePlaintextDump =
|
|
||||||
r'{"notes":{"pc":{"log~2Ejson":"{\"n2\":{\"id\":\"n2\",\"fields\":'
|
|
||||||
r'{\"title\":[\"call mum\",\"1970-01-01T00:00:01.001Z-0000-pc\"]},'
|
|
||||||
r'\"deleted\":false,\"deleted_hlc\":null}}"}},"revs":{"pc":"ab12"}}';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
test('the grep done check misses live plaintext; the audit does not', () {
|
|
||||||
expect('"title"'.allMatches(_livePlaintextDump), isEmpty);
|
|
||||||
expect(plaintextBlobPaths(jsonDecode(_livePlaintextDump)), [
|
|
||||||
'notes/pc/log.json',
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('sealed blobs, revs and the clear e2e header pass', () async {
|
|
||||||
final sealed = await E2eCipher(
|
|
||||||
List<int>.filled(32, 1),
|
|
||||||
).seal('{"title":"x"}', path: 'notes/pc/log.json');
|
|
||||||
final dump = {
|
|
||||||
'e2e': '{"v":1,"kdf":"argon2id"}',
|
|
||||||
'notes': {
|
|
||||||
'pc': {'log~2Ejson': sealed},
|
|
||||||
},
|
|
||||||
'revs': {'pc': 'ab12'},
|
|
||||||
};
|
|
||||||
expect(plaintextBlobPaths(dump), isEmpty);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('every plaintext leaf is reported, with keys unescaped', () {
|
|
||||||
final dump = {
|
|
||||||
'a': {
|
|
||||||
'x~2Ey': '[1]',
|
|
||||||
'b': {'c': ' {"k":1}'},
|
|
||||||
},
|
|
||||||
'n': 3,
|
|
||||||
'nil': null,
|
|
||||||
};
|
|
||||||
expect(plaintextBlobPaths(dump), unorderedEquals(['a/x.y', 'a/b/c']));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a root that is itself plaintext, or empty, is handled', () {
|
|
||||||
expect(plaintextBlobPaths('{"a":1}'), ['']);
|
|
||||||
expect(plaintextBlobPaths(null), isEmpty);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
/// The record-blob AEAD: what makes the remote a blind relay.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:glados/glados.dart' hide expect, group, test, setUp;
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
const _path = 'todo-sync/notes/phone/log.json';
|
|
||||||
|
|
||||||
E2eCipher _cipher([int fill = 7, bool acceptPlaintext = true]) =>
|
|
||||||
E2eCipher(List<int>.filled(32, fill), acceptPlaintext: acceptPlaintext);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
Glados(any.letterOrDigits, ExploreConfig(numRuns: 60)).test(
|
|
||||||
'open(seal(x)) == x for any text',
|
|
||||||
(text) async {
|
|
||||||
final cipher = _cipher();
|
|
||||||
final sealed = await cipher.seal('{"t":"$text"}', path: _path);
|
|
||||||
expect(await cipher.open(sealed, path: _path), '{"t":"$text"}');
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
test('sealed text contains no plaintext and is not JSON', () async {
|
|
||||||
final sealed = await _cipher().seal('{"title":"secret"}', path: _path);
|
|
||||||
expect(sealed, isNot(contains('title')));
|
|
||||||
expect(sealed, isNot(contains('secret')));
|
|
||||||
expect(() => jsonDecode(sealed), throwsFormatException);
|
|
||||||
expect(E2eCipher.isPlaintext(sealed), isFalse);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('two seals of the same text differ (random nonce)', () async {
|
|
||||||
final cipher = _cipher();
|
|
||||||
expect(
|
|
||||||
await cipher.seal('{}', path: _path),
|
|
||||||
isNot(await cipher.seal('{}', path: _path)),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('wire format starts with the version byte', () async {
|
|
||||||
final bytes = base64.decode(await _cipher().seal('{}', path: _path));
|
|
||||||
expect(bytes.first, e2eFormatVersion);
|
|
||||||
expect(bytes.length, 1 + 24 + 2 + 16);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('plaintext JSON passes through during migration', () async {
|
|
||||||
expect(await _cipher().open(' {"a":1}', path: _path), ' {"a":1}');
|
|
||||||
expect(await _cipher().open('[1]', path: _path), '[1]');
|
|
||||||
expect(E2eCipher.isPlaintext('\n{'), isTrue);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('plaintext is refused once migration is over', () async {
|
|
||||||
expect(
|
|
||||||
() => _cipher(7, false).open('{"a":1}', path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('rejects, as a FormatException so syncLog skips the peer', () {
|
|
||||||
test('a wrong key', () async {
|
|
||||||
final sealed = await _cipher(1).seal('{}', path: _path);
|
|
||||||
expect(
|
|
||||||
() => _cipher(2).open(sealed, path: _path),
|
|
||||||
throwsA(isA<FormatException>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a blob moved to another path', () async {
|
|
||||||
final sealed = await _cipher().seal('{}', path: _path);
|
|
||||||
expect(
|
|
||||||
() => _cipher().open(sealed, path: 'todo-sync/notes/pc/log.json'),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a flipped ciphertext byte', () async {
|
|
||||||
final bytes = base64.decode(await _cipher().seal('{}', path: _path));
|
|
||||||
bytes[30] ^= 1;
|
|
||||||
expect(
|
|
||||||
() => _cipher().open(base64.encode(bytes), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('an unknown version byte', () async {
|
|
||||||
final bytes = base64.decode(await _cipher().seal('{}', path: _path));
|
|
||||||
bytes[0] = 9;
|
|
||||||
expect(
|
|
||||||
() => _cipher().open(base64.encode(bytes), path: _path),
|
|
||||||
throwsA(
|
|
||||||
isA<E2eDecryptError>().having(
|
|
||||||
(e) => e.message,
|
|
||||||
'message',
|
|
||||||
contains('update the app'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('text that is not base64', () {
|
|
||||||
expect(
|
|
||||||
() => _cipher().open('not base64 !!', path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a blob too short to hold nonce and tag', () {
|
|
||||||
expect(
|
|
||||||
() => _cipher().open(base64.encode([1, 2, 3]), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('an empty blob', () {
|
|
||||||
expect(
|
|
||||||
() => _cipher().open('', path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a key that is not 32 bytes is a programming error', () {
|
|
||||||
expect(() => E2eCipher(const [1, 2]), throwsArgumentError);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('E2eDecryptError reads as itself', () {
|
|
||||||
expect(E2eDecryptError('x').toString(), 'E2eDecryptError: x');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,175 +0,0 @@
|
|||||||
/// Per-record envelope: ids and HLCs stay clear, field names and values are
|
|
||||||
/// opaque, and merge results are identical with and without encryption.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:glados/glados.dart' hide expect, group, test, setUp;
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _path = 'app/notes-e2e/phone/log.json';
|
|
||||||
|
|
||||||
E2eCipher _cipher([int fill = 7, bool acceptPlaintext = true]) =>
|
|
||||||
E2eCipher(List<int>.filled(32, fill), acceptPlaintext: acceptPlaintext);
|
|
||||||
|
|
||||||
Hlc _hlc(int ms, int counter, String node) =>
|
|
||||||
Hlc(wallTimeMs: ms, counter: counter, nodeId: node);
|
|
||||||
|
|
||||||
Log _logFrom(List<(int, int, String)> rows) {
|
|
||||||
final log = <String, Record>{};
|
|
||||||
for (final (id, field, value) in rows) {
|
|
||||||
final key = 'r$id';
|
|
||||||
final old = log[key];
|
|
||||||
log[key] = Record(
|
|
||||||
id: key,
|
|
||||||
fields: {
|
|
||||||
...?old?.fields,
|
|
||||||
'f$field': (value, _hlc(1000 + id * 7 + field, field, 'n$id')),
|
|
||||||
},
|
|
||||||
deleted: id % 4 == 0,
|
|
||||||
deletedHlc: id % 4 == 0 ? _hlc(5000, 0, 'n$id') : null,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return log;
|
|
||||||
}
|
|
||||||
|
|
||||||
final _rows = any.list(
|
|
||||||
any.combine3(
|
|
||||||
any.intInRange(0, 6),
|
|
||||||
any.intInRange(0, 4),
|
|
||||||
any.letterOrDigits,
|
|
||||||
(a, b, c) => (a, b, c),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
Glados(_rows, ExploreConfig(numRuns: 40)).test(
|
|
||||||
'decode(open(seal(encode(log)))) == log',
|
|
||||||
(rows) async {
|
|
||||||
final log = _logFrom(rows);
|
|
||||||
final cipher = _cipher();
|
|
||||||
final sealed = await sealLogText(encodeLog(log), cipher, path: _path);
|
|
||||||
final opened = await openLogText(sealed, cipher, path: _path);
|
|
||||||
expect(encodeLog(decodeLog(opened)), encodeLog(log));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
Glados2(_rows, _rows, ExploreConfig(numRuns: 40)).test(
|
|
||||||
'merge through the envelope == merge without it',
|
|
||||||
(a, b) async {
|
|
||||||
final cipher = _cipher();
|
|
||||||
Future<Log> viaCipher(Log log) async => decodeLog(
|
|
||||||
await openLogText(
|
|
||||||
await sealLogText(encodeLog(log), cipher, path: _path),
|
|
||||||
cipher,
|
|
||||||
path: _path,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
final la = _logFrom(a);
|
|
||||||
final lb = _logFrom(b);
|
|
||||||
final plain = mergeLogs(la, lb);
|
|
||||||
final sealed = mergeLogs(await viaCipher(la), await viaCipher(lb));
|
|
||||||
expect(encodeLog(sealed), encodeLog(plain));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
test('ids and HLCs are clear, names and values are not', () async {
|
|
||||||
final log = logOf({'n1': 'buy milk'});
|
|
||||||
final sealed = await sealLogText(encodeLog(log), _cipher(), path: _path);
|
|
||||||
final json = jsonDecode(sealed) as Map<String, dynamic>;
|
|
||||||
expect(json['v'], 1);
|
|
||||||
final rec = (json['r'] as Map<String, dynamic>)['n1'] as Map;
|
|
||||||
expect(rec['h'], log['n1']!.fields['title']!.$2.toStr());
|
|
||||||
expect(rec['d'], false);
|
|
||||||
expect(sealed, isNot(contains('title')));
|
|
||||||
expect(sealed, isNot(contains('buy milk')));
|
|
||||||
expect(isE2eEnvelope(sealed), isTrue);
|
|
||||||
expect(isE2eEnvelope(encodeLog(log)), isFalse);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('legacy plaintext passes only while acceptPlaintext', () async {
|
|
||||||
final text = encodeLog(logOf({'n1': 'x'}));
|
|
||||||
expect(await openLogText(text, _cipher(), path: _path), text);
|
|
||||||
expect(
|
|
||||||
() => openLogText(text, _cipher(7, false), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a record id named v is still legacy plaintext', () async {
|
|
||||||
final text = encodeLog(logOf({'v': 'x'}));
|
|
||||||
expect(isE2eEnvelope(text), isFalse);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('tamper and wrong key are E2eDecryptError', () {
|
|
||||||
Future<String> sealed() async =>
|
|
||||||
sealLogText(encodeLog(logOf({'n1': 'x'})), _cipher(), path: _path);
|
|
||||||
|
|
||||||
test('wrong key', () async {
|
|
||||||
final text = await sealed();
|
|
||||||
expect(
|
|
||||||
() => openLogText(text, _cipher(8), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
test('moved path', () async {
|
|
||||||
final text = await sealed();
|
|
||||||
expect(
|
|
||||||
() => openLogText(text, _cipher(), path: '$_path-x'),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
test('flipped clear deleted flag', () async {
|
|
||||||
final json = jsonDecode(await sealed()) as Map<String, dynamic>;
|
|
||||||
((json['r'] as Map)['n1'] as Map)['d'] = true;
|
|
||||||
expect(
|
|
||||||
() => openLogText(jsonEncode(json), _cipher(), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
test('record swapped to another id', () async {
|
|
||||||
final json = jsonDecode(await sealed()) as Map<String, dynamic>;
|
|
||||||
final r = json['r'] as Map;
|
|
||||||
r['n2'] = r.remove('n1');
|
|
||||||
expect(
|
|
||||||
() => openLogText(jsonEncode(json), _cipher(), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
test('mis-shaped envelope', () async {
|
|
||||||
expect(
|
|
||||||
() => openLogText('{"v":1,"r":5}', _cipher(), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
test('unknown envelope version asks for an app update', () async {
|
|
||||||
expect(
|
|
||||||
() => openLogText('{"v":99,"r":{}}', _cipher(), path: _path),
|
|
||||||
throwsA(
|
|
||||||
isA<E2eDecryptError>().having(
|
|
||||||
(e) => e.toString(),
|
|
||||||
'message',
|
|
||||||
contains('format 99'),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
test('mis-shaped record', () async {
|
|
||||||
expect(
|
|
||||||
() =>
|
|
||||||
openLogText('{"v":1,"r":{"n1":{"p":"x"}}}', _cipher(), path: _path),
|
|
||||||
throwsA(isA<E2eDecryptError>()),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('text that is not a log is sealed whole and opens back', () async {
|
|
||||||
final cipher = _cipher();
|
|
||||||
final sealed = await sealLogText('{"n":{"id":1}}', cipher, path: _path);
|
|
||||||
expect(sealed, isNot(contains('"id"')));
|
|
||||||
expect(await openLogText(sealed, cipher, path: _path), '{"n":{"id":1}}');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,111 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
|
|
||||||
const cheapArgon = Argon2Params(memoryKiB: 8, iterations: 1, parallelism: 1);
|
|
||||||
|
|
||||||
Log logOf(Map<String, String> titles, {String nodeId = 'node-a'}) => {
|
|
||||||
for (final entry in titles.entries)
|
|
||||||
entry.key: Record(
|
|
||||||
id: entry.key,
|
|
||||||
fields: {
|
|
||||||
'title': (
|
|
||||||
entry.value,
|
|
||||||
Hlc(wallTimeMs: 1000, counter: 0, nodeId: nodeId),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
String encodeLog(Log log) =>
|
|
||||||
jsonEncode(log.map((id, record) => MapEntry(id, record.toJson())));
|
|
||||||
|
|
||||||
Log decodeLog(String text) => (jsonDecode(text) as Map<String, dynamic>).map(
|
|
||||||
(id, data) => MapEntry(id, Record.fromJson(data as Map<String, dynamic>)),
|
|
||||||
);
|
|
||||||
|
|
||||||
/// In-memory remote; [bulk] toggles the [BulkMapReader] capability.
|
|
||||||
class MemoryRemote implements RemoteStore, BulkMapReader {
|
|
||||||
MemoryRemote([Map<String, String>? files]) : files = files ?? {};
|
|
||||||
|
|
||||||
final Map<String, String> files;
|
|
||||||
final List<String> writes = [];
|
|
||||||
final List<String> reads = [];
|
|
||||||
bool closed = false;
|
|
||||||
|
|
||||||
/// Overrides the next reads of a path, oldest first, to fake a race.
|
|
||||||
final Map<String, List<String?>> scriptedReads = {};
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<String>> listDirectory(String path) async => files.keys
|
|
||||||
.where((key) => key.startsWith('$path/'))
|
|
||||||
.map((key) => key.substring(path.length + 1).split('/').first)
|
|
||||||
.toSet()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getFileText(String path) async {
|
|
||||||
reads.add(path);
|
|
||||||
final script = scriptedReads[path];
|
|
||||||
if (script != null && script.isNotEmpty) return script.removeAt(0);
|
|
||||||
return files[path];
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> putFileText(
|
|
||||||
String path,
|
|
||||||
String text, {
|
|
||||||
required String message,
|
|
||||||
}) async {
|
|
||||||
writes.add(path);
|
|
||||||
files[path] = text;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<Map<String, String>> getStringMap(String path) async => {
|
|
||||||
for (final entry in files.entries)
|
|
||||||
if (entry.key.startsWith('$path/') &&
|
|
||||||
!entry.key.substring(path.length + 1).contains('/'))
|
|
||||||
entry.key.substring(path.length + 1): entry.value,
|
|
||||||
};
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteFile(String path, {String message = ''}) async =>
|
|
||||||
files.remove(path);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> canAccessRemote() async => true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void close() => closed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Same storage without the bulk capability, like `GitHubClient`.
|
|
||||||
class PlainRemote implements RemoteStore {
|
|
||||||
PlainRemote(this.inner);
|
|
||||||
|
|
||||||
final MemoryRemote inner;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<List<String>> listDirectory(String path) => inner.listDirectory(path);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<String?> getFileText(String path) => inner.getFileText(path);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> putFileText(
|
|
||||||
String path,
|
|
||||||
String text, {
|
|
||||||
required String message,
|
|
||||||
}) => inner.putFileText(path, text, message: message);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<void> deleteFile(String path, {String message = ''}) =>
|
|
||||||
inner.deleteFile(path);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Future<bool> canAccessRemote() => inner.canAccessRemote();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void close() => inner.close();
|
|
||||||
}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
/// Cross-language golden vectors: Dart opens what the Python port sealed.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
final vec =
|
|
||||||
jsonDecode(File('test/fixtures/e2e_py_vectors.json').readAsStringSync())
|
|
||||||
as Map<String, dynamic>;
|
|
||||||
|
|
||||||
Future<E2eKey> key() => unlockE2e(
|
|
||||||
store: MemoryRemote({'vec/e2e': vec['header'] as String}),
|
|
||||||
pathPrefix: 'vec/notes-e2e',
|
|
||||||
passphrase: vec['passphrase'] as String,
|
|
||||||
e2ePath: 'vec/e2e',
|
|
||||||
);
|
|
||||||
|
|
||||||
test('Argon2id and HKDF match Python', () async {
|
|
||||||
final hex = (await key()).bytes
|
|
||||||
.map((b) => b.toRadixString(16).padLeft(2, '0'))
|
|
||||||
.join();
|
|
||||||
expect(hex, vec['master_hex']);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('opens a Python envelope and whole blob', () async {
|
|
||||||
final cipher = (await key()).cipher();
|
|
||||||
final path = vec['path'] as String;
|
|
||||||
final opened = await openLogText(
|
|
||||||
vec['envelope'] as String,
|
|
||||||
cipher,
|
|
||||||
path: path,
|
|
||||||
);
|
|
||||||
expect(jsonDecode(opened), jsonDecode(vec['log'] as String));
|
|
||||||
expect(
|
|
||||||
await openLogText(vec['whole'] as String, cipher, path: path),
|
|
||||||
'not a log',
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,181 +0,0 @@
|
|||||||
/// Passphrase -> key, the clear header beside the data, and the open gate.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _prefix = 'todo-sync/notes';
|
|
||||||
const _headerPath = 'todo-sync/e2e';
|
|
||||||
|
|
||||||
Future<E2eKey> _unlock(MemoryRemote remote, String passphrase) => unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
passphrase: passphrase,
|
|
||||||
params: cheapArgon,
|
|
||||||
random: Random(1),
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
test('the header sits beside the device dirs, not among them', () {
|
|
||||||
expect(defaultE2ePath(_prefix), _headerPath);
|
|
||||||
expect(defaultE2ePath('wake-alarm'), 'wake-alarm/e2e');
|
|
||||||
});
|
|
||||||
|
|
||||||
test(
|
|
||||||
'first unlock writes a clear header with salt, params and check',
|
|
||||||
() async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
await _unlock(remote, 'correct horse');
|
|
||||||
final header = jsonDecode(remote.files[_headerPath]!) as Map;
|
|
||||||
expect(header['v'], 1);
|
|
||||||
expect(header['kdf'], 'argon2id');
|
|
||||||
expect(base64.decode(header['salt'] as String), hasLength(16));
|
|
||||||
expect(header['m'], 8);
|
|
||||||
expect(header['t'], 1);
|
|
||||||
expect(header['p'], 1);
|
|
||||||
expect(header['check'], isA<String>());
|
|
||||||
expect(remote.files[_headerPath], isNot(contains('correct horse')));
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
test('the same passphrase on another device yields the same key', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final a = await _unlock(remote, 'pw');
|
|
||||||
final b = await unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
passphrase: 'pw',
|
|
||||||
random: Random(99),
|
|
||||||
);
|
|
||||||
expect(b.bytes, a.bytes);
|
|
||||||
expect(remote.writes, [_headerPath]);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a wrong passphrase is refused before anything is written', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
await _unlock(remote, 'pw');
|
|
||||||
remote.writes.clear();
|
|
||||||
await expectLater(
|
|
||||||
_unlock(remote, 'not pw'),
|
|
||||||
throwsA(isA<E2eWrongPassphraseError>()),
|
|
||||||
);
|
|
||||||
expect(remote.writes, isEmpty);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a setup race derives from the header that won', () async {
|
|
||||||
final winner = MemoryRemote();
|
|
||||||
await unlockE2e(
|
|
||||||
store: winner,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
passphrase: 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
random: Random(5),
|
|
||||||
);
|
|
||||||
final remote = MemoryRemote()
|
|
||||||
..scriptedReads[_headerPath] = [null, winner.files[_headerPath]];
|
|
||||||
final key = await _unlock(remote, 'pw');
|
|
||||||
final expected = await _unlock(winner, 'pw');
|
|
||||||
expect(key.bytes, expected.bytes);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('an empty passphrase is refused', () {
|
|
||||||
expect(() => _unlock(MemoryRemote(), ''), throwsArgumentError);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a corrupt or newer header is refused, never overwritten', () async {
|
|
||||||
for (final bad in ['nope', '[]', '{"v":2}', '{"v":1,"kdf":"scrypt"}']) {
|
|
||||||
final remote = MemoryRemote({_headerPath: bad});
|
|
||||||
await expectLater(
|
|
||||||
_unlock(remote, 'pw'),
|
|
||||||
throwsA(isA<E2eHeaderError>()),
|
|
||||||
reason: bad,
|
|
||||||
);
|
|
||||||
expect(remote.files[_headerPath], bad);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('E2eKey.fromBytes round-trips a cached key', () async {
|
|
||||||
final key = await _unlock(MemoryRemote(), 'pw');
|
|
||||||
final cached = await E2eKey.fromBytes(
|
|
||||||
base64.decode(base64.encode(key.bytes)),
|
|
||||||
);
|
|
||||||
expect(cached.bytes, key.bytes);
|
|
||||||
expect(await cached.revision('x'), await key.revision('x'));
|
|
||||||
expect(() => E2eKey.fromBytes(const [1]), throwsArgumentError);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('revision is keyed: not sha256, and differs across keys', () async {
|
|
||||||
final a = await _unlock(MemoryRemote(), 'a');
|
|
||||||
final b = await _unlock(MemoryRemote(), 'b');
|
|
||||||
expect(await a.revision('{}'), isNot(revisionOf('{}')));
|
|
||||||
expect(await a.revision('{}'), isNot(await b.revision('{}')));
|
|
||||||
expect(await a.revision('{}'), await a.revision('{}'));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('errors read as themselves', () {
|
|
||||||
expect(E2eWrongPassphraseError().toString(), contains('passphrase'));
|
|
||||||
expect(E2eHeaderError('x').toString(), 'E2eHeaderError: x');
|
|
||||||
});
|
|
||||||
|
|
||||||
group('openE2e', () {
|
|
||||||
test('no header and no key: off, plaintext sync allowed', () async {
|
|
||||||
final state = await openE2e(store: MemoryRemote(), pathPrefix: _prefix);
|
|
||||||
expect(state, isA<E2eOff>());
|
|
||||||
});
|
|
||||||
|
|
||||||
test('header but no key: locked, needs the passphrase', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
await _unlock(remote, 'pw');
|
|
||||||
final state = await openE2e(store: remote, pathPrefix: _prefix);
|
|
||||||
expect(state, isA<E2eLocked>());
|
|
||||||
expect((state as E2eLocked).reason, E2eLockReason.needsPassphrase);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a cached key the header rejects: locked, wrong key', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
await _unlock(remote, 'pw');
|
|
||||||
final stale = await _unlock(MemoryRemote(), 'old');
|
|
||||||
final state = await openE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
key: stale,
|
|
||||||
);
|
|
||||||
expect((state as E2eLocked).reason, E2eLockReason.wrongKey);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a cached key with the header gone: locked, wrong key', () async {
|
|
||||||
final key = await _unlock(MemoryRemote(), 'pw');
|
|
||||||
final state = await openE2e(
|
|
||||||
store: MemoryRemote(),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
key: key,
|
|
||||||
);
|
|
||||||
expect((state as E2eLocked).reason, E2eLockReason.wrongKey);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a corrupt header: locked, unreadable header', () async {
|
|
||||||
final state = await openE2e(
|
|
||||||
store: MemoryRemote({_headerPath: 'garbage'}),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
expect((state as E2eLocked).reason, E2eLockReason.badHeader);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a matching key: ready with an encrypting store', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final key = await _unlock(remote, 'pw');
|
|
||||||
final state = await openE2e(store: remote, pathPrefix: _prefix, key: key);
|
|
||||||
expect((state as E2eReady).store, isA<EncryptingStore>());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('recommended params meet the OWASP Argon2id floor', () {
|
|
||||||
expect(Argon2Params.recommended.memoryKiB, greaterThanOrEqualTo(19456));
|
|
||||||
expect(Argon2Params.recommended.iterations, greaterThanOrEqualTo(2));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
/// Migration over flat `<node>.json` leaves and non-log source blobs.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _old = 'app/notes';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
final layout = E2eLayout.of(_old);
|
|
||||||
|
|
||||||
Future<E2eKey> key(RemoteStore remote) => unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
passphrase: 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
);
|
|
||||||
|
|
||||||
test('a flat leaf is read one by one when the backend has no bulk', () async {
|
|
||||||
final inner = MemoryRemote({
|
|
||||||
'$_old/node.json': encodeLog(logOf({'a': 'milk'})),
|
|
||||||
});
|
|
||||||
final remote = PlainRemote(inner);
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: await key(remote),
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(report.copied, 1);
|
|
||||||
final blob = inner.files['${layout.prefix}/node.json']!;
|
|
||||||
expect(blob, isNot(contains('milk')));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a source blob that is not a JSON object is skipped', () async {
|
|
||||||
final remote = MemoryRemote({
|
|
||||||
'$_old/list/log.json': '[1,2]',
|
|
||||||
'$_old/shape/log.json': '{"a":5}',
|
|
||||||
});
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: await key(remote),
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(report.copied, 0);
|
|
||||||
expect(
|
|
||||||
report.skipped,
|
|
||||||
unorderedEquals(['list/log.json', 'shape/log.json']),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,221 +0,0 @@
|
|||||||
/// One-time copy from the plaintext prefix to `<prefix>-e2e`.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _old = 'app/notes';
|
|
||||||
|
|
||||||
Future<E2eKey> _key(MemoryRemote remote, E2eLayout layout) => unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
passphrase: 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
);
|
|
||||||
|
|
||||||
MemoryRemote _plainRemote() => MemoryRemote({
|
|
||||||
'$_old/phone/log.json': encodeLog(logOf({'a': 'milk', 'b': 'eggs'})),
|
|
||||||
'$_old/pc/log.json': encodeLog(logOf({'c': 'tea'}, nodeId: 'node-b')),
|
|
||||||
});
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
final layout = E2eLayout.of(_old);
|
|
||||||
|
|
||||||
test('layout puts ciphertext on a new prefix, revs apart from old', () {
|
|
||||||
expect(layout.prefix, 'app/notes-e2e');
|
|
||||||
expect(layout.revsPath, isNot(defaultRevsPath(_old)));
|
|
||||||
expect(layout.e2ePath, startsWith('app/'));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('copy seals every device log under the new prefix', () async {
|
|
||||||
final remote = _plainRemote();
|
|
||||||
final key = await _key(remote, layout);
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(report.copied, 2);
|
|
||||||
final blob = remote.files['app/notes-e2e/phone/log.json']!;
|
|
||||||
expect(blob, isNot(contains('milk')));
|
|
||||||
expect(blob, isNot(contains('"title"')));
|
|
||||||
expect(remote.files['$_old/phone/log.json'], contains('milk'));
|
|
||||||
final enc = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
key,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
revsPath: layout.revsPath,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
);
|
|
||||||
final merged = await syncLog(
|
|
||||||
client: enc,
|
|
||||||
deviceId: 'tablet',
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
localLog: {},
|
|
||||||
encode: encodeLog,
|
|
||||||
decode: decodeLog,
|
|
||||||
);
|
|
||||||
expect(merged.keys, unorderedEquals(['a', 'b', 'c']));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('copying twice adds no duplicate and loses nothing', () async {
|
|
||||||
final remote = _plainRemote();
|
|
||||||
final key = await _key(remote, layout);
|
|
||||||
Future<MigrationReport> run() => copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
await run();
|
|
||||||
final first = Map.of(remote.files);
|
|
||||||
remote.writes.clear();
|
|
||||||
final second = await run();
|
|
||||||
expect(second.copied, 0);
|
|
||||||
expect(remote.writes, isEmpty);
|
|
||||||
expect(remote.files, first);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a later plaintext write by an old build is copied again', () async {
|
|
||||||
final remote = _plainRemote();
|
|
||||||
final key = await _key(remote, layout);
|
|
||||||
await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
remote.files['$_old/pc/log.json'] = encodeLog(
|
|
||||||
logOf({'c': 'tea', 'd': 'jam'}, nodeId: 'node-b'),
|
|
||||||
);
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(report.copied, 1);
|
|
||||||
expect(
|
|
||||||
await verifyCopy(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
),
|
|
||||||
isTrue,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('cleanup refuses before the copy is verified, then deletes', () async {
|
|
||||||
final remote = _plainRemote();
|
|
||||||
final key = await _key(remote, layout);
|
|
||||||
expect(
|
|
||||||
await deletePlaintextPrefix(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
),
|
|
||||||
isFalse,
|
|
||||||
);
|
|
||||||
expect(remote.files['$_old/phone/log.json'], isNotNull);
|
|
||||||
await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
await deletePlaintextPrefix(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
),
|
|
||||||
isTrue,
|
|
||||||
);
|
|
||||||
expect(remote.files.keys.where((k) => k.startsWith('$_old/')), isEmpty);
|
|
||||||
expect(remote.files['app/notes-e2e/phone/log.json'], isNotNull);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a corrupt source blob is skipped and blocks cleanup', () async {
|
|
||||||
final remote = _plainRemote();
|
|
||||||
remote.files['$_old/bad/log.json'] = '{oops';
|
|
||||||
final key = await _key(remote, layout);
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(report.copied, 2);
|
|
||||||
expect(report.skipped, ['bad/log.json']);
|
|
||||||
expect(
|
|
||||||
await deletePlaintextPrefix(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
),
|
|
||||||
isFalse,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('slashless prefix (settings-sync)', () {
|
|
||||||
final flat = E2eLayout.of('settings-sync');
|
|
||||||
|
|
||||||
test('revs and header stay inside the app node', () {
|
|
||||||
expect(flat.prefix, 'settings-sync-e2e');
|
|
||||||
expect(flat.revsPath, 'settings-sync-e2e/revs');
|
|
||||||
expect(flat.e2ePath, 'settings-sync-e2e/e2e');
|
|
||||||
});
|
|
||||||
|
|
||||||
test('old revs and header are not copied as logs', () async {
|
|
||||||
final remote = MemoryRemote({
|
|
||||||
'settings-sync/phone/log.json': encodeLog(logOf({'a': 'x'})),
|
|
||||||
'settings-sync/revs/phone': 'abc',
|
|
||||||
'settings-sync/e2e': '{"v":1}',
|
|
||||||
});
|
|
||||||
final key = await _key(remote, flat);
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: 'settings-sync',
|
|
||||||
layout: flat,
|
|
||||||
);
|
|
||||||
expect(report.copied, 1);
|
|
||||||
expect(report.skipped, isEmpty);
|
|
||||||
expect(
|
|
||||||
await verifyCopy(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: 'settings-sync',
|
|
||||||
layout: flat,
|
|
||||||
),
|
|
||||||
isTrue,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('never overwrites a non-log blob and skips empty sources', () async {
|
|
||||||
final remote = MemoryRemote({
|
|
||||||
'app/notes/pc/current.json': '{}',
|
|
||||||
'app/notes-e2e/pc/current.json': '{"photos":["a"]}',
|
|
||||||
'app/notes/tab/current.json': '{}',
|
|
||||||
});
|
|
||||||
final key = await _key(remote, layout);
|
|
||||||
final report = await copyToEncrypted(
|
|
||||||
store: remote,
|
|
||||||
key: key,
|
|
||||||
fromPrefix: _old,
|
|
||||||
layout: layout,
|
|
||||||
);
|
|
||||||
expect(report.copied, 0);
|
|
||||||
expect(remote.files['app/notes-e2e/pc/current.json'], '{"photos":["a"]}');
|
|
||||||
expect(remote.files.containsKey('app/notes-e2e/tab/current.json'), isFalse);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
/// openEncryptedStore must not pay Argon2id or a full copy on every tick.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _old = 'app/notes';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
setUp(resetE2eCopyMemo);
|
|
||||||
|
|
||||||
test('a cached key skips Argon2 and still unlocks', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
List<int>? cached;
|
|
||||||
var derived = 0;
|
|
||||||
Future<E2eState> open() => openEncryptedStore(
|
|
||||||
store: remote,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
keyCache: E2eKeyCache(
|
|
||||||
read: () async => cached,
|
|
||||||
write: (bytes) async => cached = bytes,
|
|
||||||
),
|
|
||||||
onDerive: () => derived++,
|
|
||||||
);
|
|
||||||
expect(await open(), isA<E2eReady>());
|
|
||||||
expect(cached, hasLength(32));
|
|
||||||
expect(await open(), isA<E2eReady>());
|
|
||||||
expect(derived, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a stale cached key falls back to the passphrase', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
List<int>? cached = List<int>.filled(32, 9);
|
|
||||||
final state = await openEncryptedStore(
|
|
||||||
store: remote,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
keyCache: E2eKeyCache(
|
|
||||||
read: () async => cached,
|
|
||||||
write: (bytes) async => cached = bytes,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect(state, isA<E2eReady>());
|
|
||||||
expect(cached, isNot(List<int>.filled(32, 9)));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('the copy reruns only when old revisions change', () async {
|
|
||||||
final remote = MemoryRemote({
|
|
||||||
'$_old/pc/log.json': encodeLog(logOf({'a': 'x'})),
|
|
||||||
'app/revs/pc': 'r1',
|
|
||||||
});
|
|
||||||
Future<void> open() => openEncryptedStore(
|
|
||||||
store: remote,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
);
|
|
||||||
await open();
|
|
||||||
remote.reads.clear();
|
|
||||||
await open();
|
|
||||||
expect(remote.reads.where((p) => p.startsWith('app/notes-e2e/')), isEmpty);
|
|
||||||
remote.files['$_old/pc/log.json'] = encodeLog(logOf({'a': 'x', 'b': 'y'}));
|
|
||||||
remote.files['app/revs/pc'] = 'r2';
|
|
||||||
await open();
|
|
||||||
final state =
|
|
||||||
await openEncryptedStore(
|
|
||||||
store: remote,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
)
|
|
||||||
as E2eReady;
|
|
||||||
final text = await state.store.getFileText('app/notes-e2e/pc/log.json');
|
|
||||||
expect(decodeLog(text!).keys, unorderedEquals(['a', 'b']));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('bulk reads of a data dir come back decrypted', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final state =
|
|
||||||
await openEncryptedStore(
|
|
||||||
store: remote,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
)
|
|
||||||
as E2eReady;
|
|
||||||
final log = encodeLog(logOf({'k': 'secret'}));
|
|
||||||
await state.store.putFileText('app/notes-e2e/k1', log, message: 'm');
|
|
||||||
expect(remote.files['app/notes-e2e/k1'], isNot(contains('secret')));
|
|
||||||
final map = await state.store.getStringMap('app/notes-e2e');
|
|
||||||
expect(map['k1'], log);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a cache that reports a bad header locks as badHeader', () async {
|
|
||||||
final state = await openEncryptedStore(
|
|
||||||
store: MemoryRemote(),
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
keyCache: E2eKeyCache(
|
|
||||||
read: () async => throw E2eHeaderError('bad header'),
|
|
||||||
write: (_) async {},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
expect((state as E2eLocked).reason, E2eLockReason.badHeader);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _old = 'app/notes';
|
|
||||||
|
|
||||||
Future<E2eState> _open(MemoryRemote r, String? pass) => openEncryptedStore(
|
|
||||||
store: r,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => pass,
|
|
||||||
params: cheapArgon,
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
// The copy memo is process-wide; a prior open would skip the copy.
|
|
||||||
setUp(resetE2eCopyMemo);
|
|
||||||
|
|
||||||
test('no passphrase is locked', () async {
|
|
||||||
for (final p in [null, '']) {
|
|
||||||
final s = await _open(MemoryRemote(), p);
|
|
||||||
expect((s as E2eLocked).reason, E2eLockReason.needsPassphrase);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
test('right passphrase copies and is ready; wrong one is locked', () async {
|
|
||||||
final r = MemoryRemote({
|
|
||||||
'$_old/phone/log.json': encodeLog(logOf({'a': 'milk'})),
|
|
||||||
});
|
|
||||||
expect(await _open(r, 'pw'), isA<E2eReady>());
|
|
||||||
expect(r.files['app/notes-e2e/phone/log.json'], isNot(contains('milk')));
|
|
||||||
expect(await _open(r, 'pw'), isA<E2eReady>());
|
|
||||||
expect(
|
|
||||||
((await _open(r, 'bad')) as E2eLocked).reason,
|
|
||||||
E2eLockReason.wrongKey,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a corrupt header locks as badHeader', () async {
|
|
||||||
final r = MemoryRemote({'app/e2e': 'garbage'});
|
|
||||||
expect(
|
|
||||||
((await _open(r, 'pw')) as E2eLocked).reason,
|
|
||||||
E2eLockReason.badHeader,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a failing copy does not stop the open', () async {
|
|
||||||
final r = MemoryRemote();
|
|
||||||
r.files['$_old/phone/log.json'] = encodeLog(logOf({'a': 'x'}));
|
|
||||||
final failing = _FailingList(r);
|
|
||||||
final s = await openEncryptedStore(
|
|
||||||
store: failing,
|
|
||||||
oldPrefix: _old,
|
|
||||||
readPassphrase: () async => 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
);
|
|
||||||
expect(s, isA<E2eReady>());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FailingList extends PlainRemote {
|
|
||||||
_FailingList(super.inner);
|
|
||||||
@override
|
|
||||||
Future<List<String>> listDirectory(String path) =>
|
|
||||||
throw StateError('list down');
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
/// EncryptingStore.getStringMap on a data dir that also holds non-log
|
|
||||||
/// entries and unreadable ones.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _old = 'settings-sync';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
final layout = E2eLayout.of(_old);
|
|
||||||
|
|
||||||
Future<E2eKey> key(RemoteStore remote) => unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
passphrase: 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
);
|
|
||||||
|
|
||||||
EncryptingStore open(
|
|
||||||
MemoryRemote remote,
|
|
||||||
E2eKey k, {
|
|
||||||
bool acceptPlaintext = true,
|
|
||||||
}) => EncryptingStore(
|
|
||||||
remote,
|
|
||||||
k,
|
|
||||||
pathPrefix: layout.prefix,
|
|
||||||
revsPath: layout.revsPath,
|
|
||||||
e2ePath: layout.e2ePath,
|
|
||||||
acceptPlaintext: acceptPlaintext,
|
|
||||||
);
|
|
||||||
|
|
||||||
test('the header inside the prefix passes through undecrypted', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final store = open(remote, await key(remote));
|
|
||||||
final log = encodeLog(logOf({'a': 'secret'}));
|
|
||||||
await store.putFileText('${layout.prefix}/node.json', log, message: 'm');
|
|
||||||
final map = await store.getStringMap(layout.prefix);
|
|
||||||
expect(map['e2e'], remote.files[layout.e2ePath]);
|
|
||||||
expect(map['node.json'], log);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('an unreadable entry is dropped from the bulk read', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final store = open(remote, await key(remote), acceptPlaintext: false);
|
|
||||||
remote.files['${layout.prefix}/old.json'] = encodeLog(logOf({'a': 'x'}));
|
|
||||||
final map = await store.getStringMap(layout.prefix);
|
|
||||||
expect(map.containsKey('old.json'), isFalse);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
/// EncryptingStore forwards what it does not seal to the inner store.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:glados/glados.dart' show Random;
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _prefix = 'todo-sync/notes';
|
|
||||||
const _revs = 'todo-sync/revs';
|
|
||||||
|
|
||||||
Future<E2eKey> _key(MemoryRemote remote, [String passphrase = 'pw']) =>
|
|
||||||
unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
passphrase: passphrase,
|
|
||||||
params: cheapArgon,
|
|
||||||
random: Random(1),
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
test('paths outside the prefix pass through untouched', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
await store.putFileText('other/x', '{"a":1}', message: 'm');
|
|
||||||
expect(remote.files['other/x'], '{"a":1}');
|
|
||||||
expect(await store.getFileText('other/x'), '{"a":1}');
|
|
||||||
expect(await store.getFileText('$_prefix/none/log.json'), isNull);
|
|
||||||
});
|
|
||||||
|
|
||||||
group('delegation', () {
|
|
||||||
test('bulk reads forward when the inner store has them', () async {
|
|
||||||
final remote = MemoryRemote({'$_revs/a': 'r'});
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
expect(await store.getStringMap(_revs), {'a': 'r'});
|
|
||||||
});
|
|
||||||
|
|
||||||
test('bulk reads degrade to "fetch everything" without them', () async {
|
|
||||||
final remote = MemoryRemote({'$_revs/a': 'r'});
|
|
||||||
final store = EncryptingStore(
|
|
||||||
PlainRemote(remote),
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
expect(await store.getStringMap(_revs), isEmpty);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('list, delete, access and close reach the inner store', () async {
|
|
||||||
final remote = MemoryRemote({'$_prefix/a/log.json': '{}'});
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
expect(await store.listDirectory(_prefix), ['a']);
|
|
||||||
await store.deleteFile('$_prefix/a/log.json', message: 'm');
|
|
||||||
expect(remote.files.containsKey('$_prefix/a/log.json'), isFalse);
|
|
||||||
expect(await store.canAccessRemote(), isTrue);
|
|
||||||
store.close();
|
|
||||||
expect(remote.closed, isTrue);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,240 +0,0 @@
|
|||||||
/// syncLog over an EncryptingStore: the relay sees ciphertext, merge is
|
|
||||||
/// unchanged.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:glados/glados.dart' hide expect, group, test, setUp;
|
|
||||||
import 'package:test/test.dart';
|
|
||||||
|
|
||||||
import 'e2e_fakes.dart';
|
|
||||||
|
|
||||||
const _prefix = 'todo-sync/notes';
|
|
||||||
const _revs = 'todo-sync/revs';
|
|
||||||
|
|
||||||
Future<E2eKey> _key(MemoryRemote remote, [String passphrase = 'pw']) =>
|
|
||||||
unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
passphrase: passphrase,
|
|
||||||
params: cheapArgon,
|
|
||||||
random: Random(1),
|
|
||||||
);
|
|
||||||
|
|
||||||
Future<Log> _tick(
|
|
||||||
RemoteStore client,
|
|
||||||
String deviceId,
|
|
||||||
Log local, {
|
|
||||||
SyncStateStore? state,
|
|
||||||
List<String>? skipped,
|
|
||||||
}) => syncLog(
|
|
||||||
client: client,
|
|
||||||
deviceId: deviceId,
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
localLog: local,
|
|
||||||
encode: encodeLog,
|
|
||||||
decode: decodeLog,
|
|
||||||
stateStore: state,
|
|
||||||
onPeerSkipped: (id, _) => skipped?.add(id),
|
|
||||||
);
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
test('pushed blob is ciphertext and a peer merges it', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final key = await _key(remote);
|
|
||||||
final store = EncryptingStore(remote, key, pathPrefix: _prefix);
|
|
||||||
await _tick(store, 'phone', logOf({'n1': 'buy milk'}));
|
|
||||||
|
|
||||||
final blob = remote.files['$_prefix/phone/log.json']!;
|
|
||||||
expect(blob, isNot(contains('title')));
|
|
||||||
expect(blob, isNot(contains('buy milk')));
|
|
||||||
|
|
||||||
final merged = await _tick(store, 'pc', logOf({'n2': 'call mum'}));
|
|
||||||
expect(merged.keys, unorderedEquals(['n1', 'n2']));
|
|
||||||
expect(remote.files.values.where((v) => v.contains('"title"')), isEmpty);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('published revisions are keyed, not sha256 of the plaintext', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
final local = logOf({'n1': 'x'});
|
|
||||||
await _tick(store, 'phone', local, state: InMemorySyncStateStore());
|
|
||||||
final rev = remote.files['$_revs/phone']!;
|
|
||||||
expect(rev, isNot(revisionOf(encodeLog(local))));
|
|
||||||
expect(rev, hasLength(64));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a peer that has not upgraded is still read', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
await _tick(remote, 'pc', logOf({'old': 'plain'}));
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
final merged = await _tick(store, 'phone', logOf({'n1': 'x'}));
|
|
||||||
expect(merged.keys, unorderedEquals(['old', 'n1']));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a tampered peer is skipped and the others still merge', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
await _tick(store, 'b', logOf({'b1': 'y'}));
|
|
||||||
await _tick(store, 'a', logOf({'a1': 'x'}));
|
|
||||||
final blob = remote.files['$_prefix/a/log.json']!;
|
|
||||||
remote.files['$_prefix/a/log.json'] = blob.replaceRange(
|
|
||||||
40,
|
|
||||||
41,
|
|
||||||
blob[40] == 'A' ? 'B' : 'A',
|
|
||||||
);
|
|
||||||
final skipped = <String>[];
|
|
||||||
final merged = await _tick(store, 'c', {}, skipped: skipped);
|
|
||||||
expect(merged.keys, ['b1']);
|
|
||||||
expect(skipped, ['a']);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('unparsable and mis-shaped peers are reported as skipped', () async {
|
|
||||||
final remote = MemoryRemote({
|
|
||||||
'$_prefix/bad/log.json': '{oops',
|
|
||||||
'$_prefix/shape/log.json': '{"n":{"id":1}}',
|
|
||||||
});
|
|
||||||
final skipped = <String>[];
|
|
||||||
await _tick(remote, 'me', {}, skipped: skipped);
|
|
||||||
expect(skipped, unorderedEquals(['bad', 'shape']));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a peer under another passphrase is skipped, not fatal', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final other = MemoryRemote();
|
|
||||||
final mine = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
final theirs = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(other, 'other'),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
await _tick(theirs, 'x', logOf({'x1': 'x'}));
|
|
||||||
expect(await _tick(mine, 'me', {}), isEmpty);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a prefix without a slash keeps revs out of the sealed set', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final key = await unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: 'wake-alarm',
|
|
||||||
passphrase: 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
);
|
|
||||||
final store = EncryptingStore(remote, key, pathPrefix: 'wake-alarm');
|
|
||||||
await syncLog(
|
|
||||||
client: store,
|
|
||||||
deviceId: 'phone',
|
|
||||||
pathPrefix: 'wake-alarm',
|
|
||||||
localLog: logOf({'n': 'x'}),
|
|
||||||
encode: encodeLog,
|
|
||||||
decode: decodeLog,
|
|
||||||
stateStore: InMemorySyncStateStore(),
|
|
||||||
);
|
|
||||||
expect(remote.files['wake-alarm/revs/phone'], hasLength(64));
|
|
||||||
expect(remote.files['wake-alarm/phone/log.json'], isNot(contains('"x"')));
|
|
||||||
expect(remote.files['wake-alarm/e2e'], contains('argon2id'));
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a flat <prefix>/<node>.json layout (todo) is sealed too', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
final log = encodeLog(logOf({'n1': 'buy milk'}));
|
|
||||||
await store.putFileText('$_prefix/node-a.json', log, message: 'm');
|
|
||||||
expect(remote.files['$_prefix/node-a.json'], isNot(contains('milk')));
|
|
||||||
expect(isE2eEnvelope(remote.files['$_prefix/node-a.json']!), isTrue);
|
|
||||||
expect(await store.getFileText('$_prefix/node-a.json'), log);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('a slashless prefix keeps the header and revs out of sealing', () async {
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final key = await unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: 'wake-alarm',
|
|
||||||
passphrase: 'pw',
|
|
||||||
params: cheapArgon,
|
|
||||||
);
|
|
||||||
final store = EncryptingStore(remote, key, pathPrefix: 'wake-alarm');
|
|
||||||
final header = remote.files['wake-alarm/e2e']!;
|
|
||||||
expect(await store.getFileText('wake-alarm/e2e'), header);
|
|
||||||
await store.putFileText('wake-alarm/e2e', header, message: 'm');
|
|
||||||
expect(remote.files['wake-alarm/e2e'], header);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('plaintext is refused when acceptPlaintext is off', () async {
|
|
||||||
final remote = MemoryRemote({
|
|
||||||
'$_prefix/pc/log.json': encodeLog(logOf({'a': 'b'})),
|
|
||||||
});
|
|
||||||
final store = EncryptingStore(
|
|
||||||
remote,
|
|
||||||
await _key(remote),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
acceptPlaintext: false,
|
|
||||||
);
|
|
||||||
expect(await _tick(store, 'phone', {}), isEmpty);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Differential: the same sync rounds over a plain and an encrypting relay
|
|
||||||
// must converge to the same logs.
|
|
||||||
Glados(
|
|
||||||
any.list(
|
|
||||||
any.combine3(
|
|
||||||
any.intInRange(0, 3),
|
|
||||||
any.intInRange(0, 6),
|
|
||||||
any.letterOrDigits,
|
|
||||||
(int d, int n, String t) => (d, n, t),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ExploreConfig(numRuns: 25),
|
|
||||||
).test('merge is identical with and without encryption', (edits) async {
|
|
||||||
const devices = ['a', 'b', 'c'];
|
|
||||||
Log localFor(int d) => {
|
|
||||||
for (final (i, (dev, note, title)) in edits.indexed)
|
|
||||||
if (dev == d)
|
|
||||||
'n$note': Record(
|
|
||||||
id: 'n$note',
|
|
||||||
fields: {
|
|
||||||
'title': (
|
|
||||||
title,
|
|
||||||
Hlc(wallTimeMs: 1000 + i, counter: 0, nodeId: devices[d]),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
};
|
|
||||||
final plain = MemoryRemote();
|
|
||||||
final sealedRemote = MemoryRemote();
|
|
||||||
final sealed = EncryptingStore(
|
|
||||||
sealedRemote,
|
|
||||||
await E2eKey.fromBytes(List<int>.filled(32, 3)),
|
|
||||||
pathPrefix: _prefix,
|
|
||||||
);
|
|
||||||
final plainLogs = [for (var d = 0; d < 3; d++) localFor(d)];
|
|
||||||
final sealedLogs = [for (var d = 0; d < 3; d++) localFor(d)];
|
|
||||||
for (var round = 0; round < 2; round++) {
|
|
||||||
for (var d = 0; d < 3; d++) {
|
|
||||||
plainLogs[d] = await _tick(plain, devices[d], plainLogs[d]);
|
|
||||||
sealedLogs[d] = await _tick(sealed, devices[d], sealedLogs[d]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
expect(sealedLogs, plainLogs);
|
|
||||||
expect(sealedLogs[0], sealedLogs[2]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"passphrase": "correct horse ✓",
|
|
||||||
"header": "{\"v\":1,\"kdf\":\"argon2id\",\"salt\":\"HGW+FZJe6hd71He22BrlUA==\",\"m\":64,\"t\":2,\"p\":1,\"check\":\"okKnATkNoZKvjSGfrgQGOjdRw5NORh2lC32zuBq7V6I=\"}",
|
|
||||||
"master_hex": "cad5afe8ddc6e21d2f39eb196de454db6b6d1f60629619ce8539f03a4bb0b086",
|
|
||||||
"revision_of_abc": "e7f845e1b0a7ea2b571fd3e3bdfb60641e650d63171bf73b6356c7909d2748c8",
|
|
||||||
"path": "vec/notes-e2e/phone/log.json",
|
|
||||||
"log": "{\"n1\":{\"id\":\"n1\",\"fields\":{\"title\":[\"buy milk\",\"1970-01-01T00:00:01.000Z-0000-node-a\"]},\"deleted\":false,\"deleted_hlc\":null},\"n2\":{\"id\":\"n2\",\"fields\":{\"title\":[\"zażółć\",\"1970-01-01T00:00:01.000Z-0000-node-a\"]},\"deleted\":false,\"deleted_hlc\":null}}",
|
|
||||||
"envelope": "{\"v\":1,\"r\":{\"n1\":{\"d\":false,\"dh\":null,\"h\":\"1970-01-01T00:00:01.000Z-0000-node-a\",\"p\":\"AR1zODx4TD67X3TGa0N7EV/V4FcZAaqc41jxZVtskFu3Pqb/pNlqm6db66rQUaMyNLtTPa4HMOJzZomBRyaSHjaPb4oNxgVPkMeIF5IbuI/GA30gR0sz/MSvYmfZ5wSnlBo1+fpH\"},\"n2\":{\"d\":false,\"dh\":null,\"h\":\"1970-01-01T00:00:01.000Z-0000-node-a\",\"p\":\"Aa0omlBGnmlsItzq7A21G0A1tqT8xMOJE0wgxcxJ1c3hVpRmNt4kq2IPNNGuW8v4A7fvs2FrnGX4A+NVtXPpu41ckKSShTqk8Ml6zTuxyrT85g50sgzbM7PKFczeEaS+ITWDj0N04u0=\"}}}",
|
|
||||||
"whole": "{\"v\":1,\"b\":\"AYdAwPehG84oHBRhRr5dP5VmleBGzQC1ryV5QHTCqBZE9ZsOZMMkJiP40+KzpnfIc2g=\"}"
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"passphrase": "correct horse ✓",
|
|
||||||
"header": "{\"v\":1,\"kdf\":\"argon2id\",\"salt\":\"fGy9SnWSTwxKbS/sAluVjA==\",\"m\":64,\"t\":2,\"p\":1,\"check\":\"ekpcuZxZl+Ei6Y5yQp+cwdi4yR6ItJiYR7S3cd214ds=\"}",
|
|
||||||
"master_hex": "834f54fef4eb086e4201b918c938be179f91cf72e157e28d56dfe72bc46cbefd",
|
|
||||||
"path": "vec/notes-e2e/pc/log.json",
|
|
||||||
"log": "{\"n9\": {\"id\": \"n9\", \"fields\": {\"title\": [\"zażółć\", \"2026-01-01T00:00:00.000Z-0000-pc\"]}, \"deleted\": false, \"deleted_hlc\": null}}",
|
|
||||||
"envelope": "{\"v\":1,\"r\":{\"n9\":{\"d\":false,\"dh\":null,\"h\":\"2026-01-01T00:00:00.000Z-0000-pc\",\"p\":\"ATAIR4jQmlBjDF+/4+AYp3ATcGgjZQ60tQ05uvF1howYly4W4h3lLI04BssCRASargNV/+hDhqTl7n2cz4hh7Z5lmZYgElso/4k85hwO1SRuDPOYMKsLCpYgTy8zYzEiiRlv+g==\"}}}",
|
|
||||||
"whole": "{\"v\":1,\"b\":\"ARvUAj5nIfmJdsxdaiAl5uYkgry9VG5VQLQBi6+BNbyJ0t//UGjc1Ji2hmbBJl3v9kw=\"}"
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
/// Read-only done check: lists plaintext blobs under an RTDB root.
|
|
||||||
///
|
|
||||||
/// Usage: `dart run tool/e2e_audit.dart <root> <firebase_auth.json>`
|
|
||||||
/// Exit 0 when every blob is sealed, 1 when any is plaintext, 2 on misuse.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
|
|
||||||
Future<void> main(List<String> args) async {
|
|
||||||
if (args.length != 2) {
|
|
||||||
stderr.writeln('usage: e2e_audit.dart <root> <firebase_auth.json>');
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
final [root, sessionFile] = args;
|
|
||||||
final home = Platform.environment['HOME'];
|
|
||||||
final cfg =
|
|
||||||
jsonDecode(
|
|
||||||
File('$home/.config/crdt-sync/firebase.json').readAsStringSync(),
|
|
||||||
)
|
|
||||||
as Map<String, dynamic>;
|
|
||||||
final session = FirebaseCredentials.fromJson(
|
|
||||||
jsonDecode(File(sessionFile).readAsStringSync()) as Map<String, dynamic>,
|
|
||||||
);
|
|
||||||
final auth = FirebaseTokenProvider(
|
|
||||||
apiKey: cfg['apiKey'] as String,
|
|
||||||
store: InMemoryCredentialStore(session),
|
|
||||||
);
|
|
||||||
final url = Uri.parse(
|
|
||||||
'${cfg['databaseUrl']}/${encodePath(root)}.json'
|
|
||||||
'?auth=${await auth.idToken()}',
|
|
||||||
);
|
|
||||||
final response = await http.get(url);
|
|
||||||
if (response.statusCode != 200) {
|
|
||||||
stderr.writeln('GET $root: HTTP ${response.statusCode}');
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
final plaintext = plaintextBlobPaths(jsonDecode(response.body));
|
|
||||||
stdout.writeln('plaintext blobs under $root: ${plaintext.length}');
|
|
||||||
for (final path in plaintext) {
|
|
||||||
stdout.writeln(' $root/$path');
|
|
||||||
}
|
|
||||||
exit(plaintext.isEmpty ? 0 : 1);
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
/// Writes cross-language golden vectors for the Python port to open.
|
|
||||||
///
|
|
||||||
/// Run: `dart run tool/e2e_vectors.dart > test/fixtures/e2e_dart_vectors.json`
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:math';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
|
|
||||||
import '../test/e2e_fakes.dart';
|
|
||||||
|
|
||||||
Future<void> main() async {
|
|
||||||
const params = Argon2Params(memoryKiB: 64, iterations: 2, parallelism: 1);
|
|
||||||
final remote = MemoryRemote();
|
|
||||||
final key = await unlockE2e(
|
|
||||||
store: remote,
|
|
||||||
pathPrefix: 'vec/notes-e2e',
|
|
||||||
passphrase: 'correct horse ✓',
|
|
||||||
params: params,
|
|
||||||
random: Random(7),
|
|
||||||
e2ePath: 'vec/e2e',
|
|
||||||
);
|
|
||||||
final cipher = key.cipher();
|
|
||||||
const path = 'vec/notes-e2e/phone/log.json';
|
|
||||||
final log = encodeLog(logOf({'n1': 'buy milk', 'n2': 'zażółć'}));
|
|
||||||
print(
|
|
||||||
const JsonEncoder.withIndent(' ').convert({
|
|
||||||
'passphrase': 'correct horse ✓',
|
|
||||||
'header': remote.files['vec/e2e'],
|
|
||||||
'master_hex': key.bytes
|
|
||||||
.map((b) => b.toRadixString(16).padLeft(2, '0'))
|
|
||||||
.join(),
|
|
||||||
'revision_of_abc': await key.revision('abc'),
|
|
||||||
'path': path,
|
|
||||||
'log': log,
|
|
||||||
'envelope': await sealLogText(log, cipher, path: path),
|
|
||||||
'whole': await sealLogText('not a log', cipher, path: path),
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -12,15 +12,15 @@ import 'package:crdt_sync/crdt_sync.dart';
|
|||||||
/// mode 0600 -- never in source, because this repository is public.
|
/// mode 0600 -- never in source, because this repository is public.
|
||||||
final _configDir = '${Platform.environment['HOME']}/.config/crdt-sync';
|
final _configDir = '${Platform.environment['HOME']}/.config/crdt-sync';
|
||||||
|
|
||||||
Log _decode(String t) => (jsonDecode(t) as Map<String, dynamic>).map(
|
Log _decode(String t) => (jsonDecode(t) as Map<String, dynamic>)
|
||||||
(k, v) => MapEntry(k, Record.fromJson(v as Map<String, dynamic>)),
|
.map((k, v) => MapEntry(k, Record.fromJson(v as Map<String, dynamic>)));
|
||||||
);
|
String _encode(Log l) =>
|
||||||
String _encode(Log l) => jsonEncode(l.map((k, v) => MapEntry(k, v.toJson())));
|
jsonEncode(l.map((k, v) => MapEntry(k, v.toJson())));
|
||||||
|
|
||||||
Future<void> main(List<String> args) async {
|
Future<void> main(List<String> args) async {
|
||||||
final cfg =
|
final cfg = jsonDecode(
|
||||||
jsonDecode(File('$_configDir/firebase.json').readAsStringSync())
|
File('$_configDir/firebase.json').readAsStringSync(),
|
||||||
as Map<String, dynamic>;
|
) as Map<String, dynamic>;
|
||||||
final auth = FirebaseTokenProvider(
|
final auth = FirebaseTokenProvider(
|
||||||
apiKey: cfg['apiKey'] as String,
|
apiKey: cfg['apiKey'] as String,
|
||||||
store: InMemoryCredentialStore(),
|
store: InMemoryCredentialStore(),
|
||||||
|
|||||||
@ -23,9 +23,7 @@ const _prefix = '_smoketest/devices';
|
|||||||
var _failures = 0;
|
var _failures = 0;
|
||||||
|
|
||||||
void _check(String what, bool ok, [String detail = '']) {
|
void _check(String what, bool ok, [String detail = '']) {
|
||||||
stdout.writeln(
|
stdout.writeln('${ok ? " ok " : " FAIL"} $what${detail.isEmpty ? '' : ' ($detail)'}');
|
||||||
'${ok ? " ok " : " FAIL"} $what${detail.isEmpty ? '' : ' ($detail)'}',
|
|
||||||
);
|
|
||||||
if (!ok) _failures++;
|
if (!ok) _failures++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,24 +68,16 @@ Future<void> main(List<String> args) async {
|
|||||||
_check('canAccessRemote is false before sign-in', !await auth.hasSession());
|
_check('canAccessRemote is false before sign-in', !await auth.hasSession());
|
||||||
await auth.signIn(email: email, password: password);
|
await auth.signIn(email: email, password: password);
|
||||||
_check('signIn stored a session', await auth.hasSession());
|
_check('signIn stored a session', await auth.hasSession());
|
||||||
_check(
|
_check('canAccessRemote is true after sign-in', await client.canAccessRemote());
|
||||||
'canAccessRemote is true after sign-in',
|
|
||||||
await client.canAccessRemote(),
|
|
||||||
);
|
|
||||||
|
|
||||||
stdout.writeln('\n== round-trip and key escaping ==');
|
stdout.writeln('\n== round-trip and key escaping ==');
|
||||||
const path = '$_prefix/pc/log.json';
|
const path = '$_prefix/pc/log.json';
|
||||||
await client.putFileText(path, '{"hello":"world"}', message: 'smoke');
|
await client.putFileText(path, '{"hello":"world"}', message: 'smoke');
|
||||||
final read = await client.getFileText(path);
|
final read = await client.getFileText(path);
|
||||||
_check(
|
_check('a .json filename round-trips byte-for-byte',
|
||||||
'a .json filename round-trips byte-for-byte',
|
read == '{"hello":"world"}', read ?? 'null');
|
||||||
read == '{"hello":"world"}',
|
_check('missing path reads as null',
|
||||||
read ?? 'null',
|
await client.getFileText('$_prefix/nope/log.json') == null);
|
||||||
);
|
|
||||||
_check(
|
|
||||||
'missing path reads as null',
|
|
||||||
await client.getFileText('$_prefix/nope/log.json') == null,
|
|
||||||
);
|
|
||||||
final listed = await client.listDirectory(_prefix);
|
final listed = await client.listDirectory(_prefix);
|
||||||
_check('listDirectory sees the device', listed.contains('pc'), '$listed');
|
_check('listDirectory sees the device', listed.contains('pc'), '$listed');
|
||||||
|
|
||||||
@ -106,11 +96,8 @@ Future<void> main(List<String> args) async {
|
|||||||
final pushed = await client.getFileText(path);
|
final pushed = await client.getFileText(path);
|
||||||
_check('the log landed in the database', pushed != null);
|
_check('the log landed in the database', pushed != null);
|
||||||
final revs = await client.getStringMap('_smoketest/revs');
|
final revs = await client.getStringMap('_smoketest/revs');
|
||||||
_check(
|
_check('a revision was published for this device',
|
||||||
'a revision was published for this device',
|
revs['pc'] == revisionOf(_encode(pcLog)), '${revs.keys}');
|
||||||
revs['pc'] == revisionOf(_encode(pcLog)),
|
|
||||||
'${revs.keys}',
|
|
||||||
);
|
|
||||||
|
|
||||||
stdout.writeln('\n== sync: an unchanged tick writes nothing ==');
|
stdout.writeln('\n== sync: an unchanged tick writes nothing ==');
|
||||||
final before = await client.getStringMap('_smoketest/revs');
|
final before = await client.getStringMap('_smoketest/revs');
|
||||||
@ -123,10 +110,8 @@ Future<void> main(List<String> args) async {
|
|||||||
decode: _decode,
|
decode: _decode,
|
||||||
stateStore: storePc,
|
stateStore: storePc,
|
||||||
);
|
);
|
||||||
_check(
|
_check('revision unchanged, so nothing was re-uploaded',
|
||||||
'revision unchanged, so nothing was re-uploaded',
|
(await client.getStringMap('_smoketest/revs'))['pc'] == before['pc']);
|
||||||
(await client.getStringMap('_smoketest/revs'))['pc'] == before['pc'],
|
|
||||||
);
|
|
||||||
|
|
||||||
stdout.writeln('\n== sync: two devices converge ==');
|
stdout.writeln('\n== sync: two devices converge ==');
|
||||||
final storePhone = InMemorySyncStateStore();
|
final storePhone = InMemorySyncStateStore();
|
||||||
@ -150,10 +135,8 @@ Future<void> main(List<String> args) async {
|
|||||||
stateStore: storePc,
|
stateStore: storePc,
|
||||||
);
|
);
|
||||||
_check('pc merged the phone record', pcAfter.containsKey('b'));
|
_check('pc merged the phone record', pcAfter.containsKey('b'));
|
||||||
_check(
|
_check('each device wrote only its own revision key',
|
||||||
'each device wrote only its own revision key',
|
(await client.getStringMap('_smoketest/revs')).length == 2);
|
||||||
(await client.getStringMap('_smoketest/revs')).length == 2,
|
|
||||||
);
|
|
||||||
|
|
||||||
stdout.writeln('\n== fail-closed ==');
|
stdout.writeln('\n== fail-closed ==');
|
||||||
await auth.signOut();
|
await auth.signOut();
|
||||||
@ -177,9 +160,7 @@ Future<void> main(List<String> args) async {
|
|||||||
client.close();
|
client.close();
|
||||||
auth.close();
|
auth.close();
|
||||||
stdout.writeln(
|
stdout.writeln(
|
||||||
_failures == 0
|
_failures == 0 ? '\nALL LIVE CHECKS PASSED' : '\n$_failures LIVE CHECK(S) FAILED',
|
||||||
? '\nALL LIVE CHECKS PASSED'
|
|
||||||
: '\n$_failures LIVE CHECK(S) FAILED',
|
|
||||||
);
|
);
|
||||||
exit(_failures == 0 ? 0 : 1);
|
exit(_failures == 0 ? 0 : 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -185,34 +185,6 @@ what Android does in practice, since `Uri.base` there is `file:///`.
|
|||||||
Nothing in this package reads `~/.config/crdt-sync/` directly. That is the
|
Nothing in this package reads `~/.config/crdt-sync/` directly. That is the
|
||||||
desktop/Python half, reached over the wrapper's HTTP routes.
|
desktop/Python half, reached over the wrapper's HTTP routes.
|
||||||
|
|
||||||
## Error and slow-wait reporting
|
|
||||||
|
|
||||||
Every error, and every wait the user sees over 1 s, goes to the PC's
|
|
||||||
`app-errors` ingest (utils `DOCS-app-errors.md`). The board turns each one into
|
|
||||||
a self-fixing ticket. Generalised from kartka.
|
|
||||||
|
|
||||||
```dart
|
|
||||||
final errors = await installAppErrors(const AppErrorsConfig(
|
|
||||||
app: 'todo', repo: 'kuhyx/todo',
|
|
||||||
build: int.fromEnvironment('APP_BUILD'), // versionCode
|
|
||||||
version: String.fromEnvironment('APP_VERSION'),
|
|
||||||
));
|
|
||||||
errors.connect(
|
|
||||||
sink: () async => (await openFirebase())?.patchValues, // null = signed out
|
|
||||||
deviceId: () async => repository.nodeId,
|
|
||||||
);
|
|
||||||
// MaterialApp(navigatorObservers: [AppErrorsRouteObserver(errors)], ...)
|
|
||||||
// Wrap every loader: WaitWatch.centered('list.load')
|
|
||||||
```
|
|
||||||
|
|
||||||
`installAppErrors` chains `FlutterError.onError` and `PlatformDispatcher.onError`.
|
|
||||||
Reports are deduplicated on the device (30 s window, 20 a minute), redacted,
|
|
||||||
queued in `SharedPreferences` (so offline reports survive), and uploaded to
|
|
||||||
RTDB `/<app>/errors/<device>/<id>` with `repo`, `build` and `version`. Without
|
|
||||||
`APP_BUILD` the installed versionCode (`package_info_plus`) is the build. A spinner
|
|
||||||
inside `WaitWatch` that stays over 1 s becomes `perf.slow`. Nothing shows on
|
|
||||||
screen.
|
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
The keystore fake ships with the package, so a consuming app does not rebuild
|
The keystore fake ships with the package, so a consuming app does not rebuild
|
||||||
|
|||||||
@ -14,17 +14,6 @@ library;
|
|||||||
export 'src/account_store.dart';
|
export 'src/account_store.dart';
|
||||||
export 'src/bootstrap.dart';
|
export 'src/bootstrap.dart';
|
||||||
export 'src/device_id.dart';
|
export 'src/device_id.dart';
|
||||||
export 'src/e2e_bootstrap.dart';
|
|
||||||
export 'src/e2e_passphrase_button.dart';
|
|
||||||
export 'src/errors/app_errors.dart';
|
|
||||||
export 'src/errors/app_errors_config.dart';
|
|
||||||
export 'src/errors/error_entry.dart';
|
|
||||||
export 'src/errors/error_queue.dart';
|
|
||||||
export 'src/errors/error_reporter.dart';
|
|
||||||
export 'src/errors/error_upload.dart';
|
|
||||||
export 'src/errors/report_redact.dart';
|
|
||||||
export 'src/errors/slow_wait.dart';
|
|
||||||
export 'src/errors/wait_watch.dart';
|
|
||||||
export 'src/google_any_sign_in.dart';
|
export 'src/google_any_sign_in.dart';
|
||||||
export 'src/google_desktop_sign_in.dart';
|
export 'src/google_desktop_sign_in.dart';
|
||||||
export 'src/google_pkce.dart';
|
export 'src/google_pkce.dart';
|
||||||
|
|||||||
@ -108,7 +108,9 @@ Future<FirebaseAccount?> _adoptSeededSession(
|
|||||||
}) async {
|
}) async {
|
||||||
final httpClient = client ?? http.Client();
|
final httpClient = client ?? http.Client();
|
||||||
try {
|
try {
|
||||||
final response = await httpClient.get(base.resolve(routes.credentialsPath));
|
final response = await httpClient.get(
|
||||||
|
base.resolve(routes.credentialsPath),
|
||||||
|
);
|
||||||
if (response.statusCode != 200) return null;
|
if (response.statusCode != 200) return null;
|
||||||
final body = jsonDecode(utf8.decode(response.bodyBytes));
|
final body = jsonDecode(utf8.decode(response.bodyBytes));
|
||||||
if (body is! Map<String, dynamic>) return null;
|
if (body is! Map<String, dynamic>) return null;
|
||||||
|
|||||||
@ -1,77 +0,0 @@
|
|||||||
/// End-to-end encryption for an app's sync prefix, keyed by the shared
|
|
||||||
/// crdt-sync passphrase kept in the OS keystore (prompt-free after setup).
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:crdt_sync/crdt_sync.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/keystore.dart';
|
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
||||||
|
|
||||||
/// Keystore key holding the shared crdt-sync passphrase.
|
|
||||||
const String kE2ePassphraseKey = kE2ePassphraseStorageKey;
|
|
||||||
|
|
||||||
/// Stores the passphrase this device derives its key from, dropping keys
|
|
||||||
/// cached from an earlier one so the new passphrase is what gets checked.
|
|
||||||
Future<void> saveE2ePassphrase(
|
|
||||||
String passphrase, {
|
|
||||||
FlutterSecureStorage storage = kSecureStorage,
|
|
||||||
}) async {
|
|
||||||
await _dropCachedKeys(storage);
|
|
||||||
await storage.write(key: kE2ePassphraseKey, value: passphrase);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _dropCachedKeys(FlutterSecureStorage storage) async {
|
|
||||||
final all = await storage.readAll();
|
|
||||||
for (final key in all.keys) {
|
|
||||||
if (key.startsWith(kE2eKeyCachePrefix)) await storage.delete(key: key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Keystore key prefix for derived keys, one per old prefix.
|
|
||||||
const String kE2eKeyCachePrefix = 'crdt_sync_e2e_key:';
|
|
||||||
|
|
||||||
/// Forgets the passphrase and every cached key; the next open is locked.
|
|
||||||
Future<void> clearE2ePassphrase({
|
|
||||||
FlutterSecureStorage storage = kSecureStorage,
|
|
||||||
}) async {
|
|
||||||
await storage.delete(key: kE2ePassphraseKey);
|
|
||||||
await _dropCachedKeys(storage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The derived key for [oldPrefix], cached in the OS keystore so Argon2id
|
|
||||||
/// runs once per device instead of on every sync tick.
|
|
||||||
E2eKeyCache keystoreKeyCache(
|
|
||||||
String oldPrefix, {
|
|
||||||
FlutterSecureStorage storage = kSecureStorage,
|
|
||||||
}) {
|
|
||||||
final name = '$kE2eKeyCachePrefix$oldPrefix';
|
|
||||||
return E2eKeyCache(
|
|
||||||
read: () async {
|
|
||||||
final text = await storage.read(key: name);
|
|
||||||
if (text == null) return null;
|
|
||||||
try {
|
|
||||||
return base64.decode(text);
|
|
||||||
} on FormatException {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
write: (bytes) => storage.write(key: name, value: base64.encode(bytes)),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// [openEncryptedStore] reading the passphrase from the OS keystore.
|
|
||||||
Future<E2eState> openEncryptedStoreFromKeystore({
|
|
||||||
required RemoteStore store,
|
|
||||||
required String oldPrefix,
|
|
||||||
FlutterSecureStorage storage = kSecureStorage,
|
|
||||||
Argon2Params params = Argon2Params.recommended,
|
|
||||||
void Function()? onDerive,
|
|
||||||
}) => openEncryptedStore(
|
|
||||||
store: store,
|
|
||||||
oldPrefix: oldPrefix,
|
|
||||||
readPassphrase: () => storage.read(key: kE2ePassphraseKey),
|
|
||||||
params: params,
|
|
||||||
keyCache: keystoreKeyCache(oldPrefix, storage: storage),
|
|
||||||
onDerive: onDerive,
|
|
||||||
);
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
/// A text-free control to enter the shared crdt-sync passphrase: a lock icon
|
|
||||||
/// opens a hidden field; the check icon (or Enter) saves it to the keystore.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync_flutter/src/e2e_bootstrap.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/keystore.dart';
|
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
|
||||||
import 'package:material_ui/material_ui.dart';
|
|
||||||
|
|
||||||
/// Lock icon button; [locked] picks the closed or open lock glyph.
|
|
||||||
class E2ePassphraseButton extends StatelessWidget {
|
|
||||||
/// Creates the button. [onSaved] runs after the passphrase is stored.
|
|
||||||
const E2ePassphraseButton({
|
|
||||||
required this.locked,
|
|
||||||
this.onSaved,
|
|
||||||
this.storage = kSecureStorage,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Whether sync is currently locked (no or wrong passphrase).
|
|
||||||
final bool locked;
|
|
||||||
|
|
||||||
/// Called after a passphrase is saved, e.g. to retry the sync.
|
|
||||||
final VoidCallback? onSaved;
|
|
||||||
|
|
||||||
/// The keystore; only tests pass another.
|
|
||||||
final FlutterSecureStorage storage;
|
|
||||||
|
|
||||||
Future<void> _ask(BuildContext context) async {
|
|
||||||
final entered = await showDialog<String>(
|
|
||||||
context: context,
|
|
||||||
builder: (_) => const _PassphraseDialog(),
|
|
||||||
);
|
|
||||||
if (entered == null || entered.isEmpty) return;
|
|
||||||
await saveE2ePassphrase(entered, storage: storage);
|
|
||||||
onSaved?.call();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => IconButton(
|
|
||||||
icon: Icon(locked ? Icons.lock : Icons.lock_open),
|
|
||||||
onPressed: () => _ask(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PassphraseDialog extends StatefulWidget {
|
|
||||||
const _PassphraseDialog();
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<_PassphraseDialog> createState() => _PassphraseDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _PassphraseDialogState extends State<_PassphraseDialog> {
|
|
||||||
final _controller = TextEditingController();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_controller.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => AlertDialog(
|
|
||||||
content: TextField(
|
|
||||||
controller: _controller,
|
|
||||||
obscureText: true,
|
|
||||||
autofocus: true,
|
|
||||||
onSubmitted: (value) => Navigator.of(context).pop(value),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.check),
|
|
||||||
onPressed: () => Navigator.of(context).pop(_controller.text),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -1,133 +0,0 @@
|
|||||||
/// App-wide error and slow-wait reporting, in one call (generalised from
|
|
||||||
/// kartka's `error_hooks.dart`): the PC's `app-errors` ingest turns every
|
|
||||||
/// report into a self-fixing ticket on kuhy's board.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/app_errors_config.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/error_queue.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/error_reporter.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/error_upload.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/slow_wait.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
|
|
||||||
/// The installed reporting: [reporter] for errors, [waits] for slow waits,
|
|
||||||
/// both into [queue], which [connect] uploads.
|
|
||||||
class AppErrors {
|
|
||||||
/// Reporting for [config] into [queue] (tests; apps call
|
|
||||||
/// [installAppErrors]).
|
|
||||||
AppErrors.forTest(this.config, this.queue, {DateTime Function()? now})
|
|
||||||
: reporter = ErrorReporter(queue, config: config, now: now) {
|
|
||||||
waits = SlowWaitReporter(queue, now: now, route: () => reporter.route);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The installed instance ([WaitWatch] reads it); null before install.
|
|
||||||
static AppErrors? instance;
|
|
||||||
|
|
||||||
/// The app reported for.
|
|
||||||
final AppErrorsConfig config;
|
|
||||||
|
|
||||||
/// Reports not yet uploaded.
|
|
||||||
final ErrorQueue queue;
|
|
||||||
|
|
||||||
/// Records errors.
|
|
||||||
final ErrorReporter reporter;
|
|
||||||
|
|
||||||
/// Times waits.
|
|
||||||
late final SlowWaitReporter waits;
|
|
||||||
|
|
||||||
/// Starts uploading to RTDB through [sink] (null while signed out) as
|
|
||||||
/// [deviceId]; flushes the backlog after [startDelay].
|
|
||||||
ErrorUploader connect({
|
|
||||||
required Future<ErrorSink?> Function() sink,
|
|
||||||
required Future<String> Function() deviceId,
|
|
||||||
Duration startDelay = const Duration(seconds: 20),
|
|
||||||
}) => ErrorUploader(queue, config: config, sink: sink, deviceId: deviceId)
|
|
||||||
..start()
|
|
||||||
..schedule(startDelay);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Installs app-wide reporting for [config] once, from `main` after
|
|
||||||
/// `WidgetsFlutterBinding.ensureInitialized`: uncaught framework errors
|
|
||||||
/// (`uncaught.flutter`) and async errors (`uncaught.async`) are queued, then
|
|
||||||
/// handed to the handlers installed before. Shows nothing on screen.
|
|
||||||
///
|
|
||||||
/// A [config] with build 0 (no `--dart-define=APP_BUILD`) takes the installed
|
|
||||||
/// versionCode from [buildNumber] (default [platformBuildNumber]), so every
|
|
||||||
/// report names the build it came from; an unreadable one stays 0.
|
|
||||||
Future<AppErrors> installAppErrors(
|
|
||||||
AppErrorsConfig config, {
|
|
||||||
SharedPreferences? preferences,
|
|
||||||
Future<String?> Function() buildNumber = platformBuildNumber,
|
|
||||||
}) async {
|
|
||||||
final stamped = config.build != 0
|
|
||||||
? config
|
|
||||||
: config.withBuild(await _installedBuild(buildNumber));
|
|
||||||
final queue = await ErrorQueue.open(
|
|
||||||
preferences ?? await SharedPreferences.getInstance(),
|
|
||||||
);
|
|
||||||
final errors = AppErrors.instance = AppErrors.forTest(stamped, queue);
|
|
||||||
final reporter = errors.reporter;
|
|
||||||
final framework = FlutterError.onError;
|
|
||||||
FlutterError.onError = (details) {
|
|
||||||
if (!details.silent) {
|
|
||||||
reporter.report(
|
|
||||||
'uncaught.flutter',
|
|
||||||
details.exception,
|
|
||||||
stack: details.stack,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
framework?.call(details);
|
|
||||||
};
|
|
||||||
final dispatcher = PlatformDispatcher.instance;
|
|
||||||
final async = dispatcher.onError;
|
|
||||||
dispatcher.onError = (error, stack) {
|
|
||||||
reporter.report('uncaught.async', error, stack: stack);
|
|
||||||
return async?.call(error, stack) ?? false;
|
|
||||||
};
|
|
||||||
return errors;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The installed app's build number (Android versionCode).
|
|
||||||
Future<String?> platformBuildNumber() async =>
|
|
||||||
(await PackageInfo.fromPlatform()).buildNumber;
|
|
||||||
|
|
||||||
Future<int> _installedBuild(Future<String?> Function() read) async {
|
|
||||||
try {
|
|
||||||
return int.tryParse(await read() ?? '') ?? 0;
|
|
||||||
} on Object {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Keeps the reporter's route current, so every report names its screen.
|
|
||||||
/// Add it to the app's `navigatorObservers`. Route names only: give routes
|
|
||||||
/// patterns (`/list/:id`), never ids or titles.
|
|
||||||
class AppErrorsRouteObserver extends NavigatorObserver {
|
|
||||||
/// Stamps routes into [errors].
|
|
||||||
AppErrorsRouteObserver(this.errors);
|
|
||||||
|
|
||||||
/// The reporting stamped.
|
|
||||||
final AppErrors errors;
|
|
||||||
|
|
||||||
void _set(Route<dynamic>? route) {
|
|
||||||
final name = route?.settings.name;
|
|
||||||
if (name != null) errors.reporter.route = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) =>
|
|
||||||
_set(route);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) =>
|
|
||||||
_set(previousRoute);
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) =>
|
|
||||||
_set(newRoute);
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
/// Which app reports, and which build it is.
|
|
||||||
library;
|
|
||||||
|
|
||||||
/// The app's identity in its reports.
|
|
||||||
class AppErrorsConfig {
|
|
||||||
/// The app [app] (as the board shows it), fixed in [repo] (`owner/name`).
|
|
||||||
const AppErrorsConfig({
|
|
||||||
required this.app,
|
|
||||||
required this.repo,
|
|
||||||
this.package,
|
|
||||||
this.build = 0,
|
|
||||||
this.version,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// The app name: the RTDB root key and the board's `app`
|
|
||||||
/// (`^[a-z0-9][a-z0-9_-]*$`).
|
|
||||||
final String app;
|
|
||||||
|
|
||||||
/// The repo that holds the fix (`kuhyx/todo`).
|
|
||||||
final String repo;
|
|
||||||
|
|
||||||
/// The Dart package name, when it is not [app] with `-` as `_`.
|
|
||||||
final String? package;
|
|
||||||
|
|
||||||
/// The build number (Android versionCode); 0 when unknown.
|
|
||||||
final int build;
|
|
||||||
|
|
||||||
/// The version name (`1.2.3`).
|
|
||||||
final String? version;
|
|
||||||
|
|
||||||
/// This config with [build] replaced.
|
|
||||||
AppErrorsConfig withBuild(int build) => AppErrorsConfig(
|
|
||||||
app: app,
|
|
||||||
repo: repo,
|
|
||||||
package: package,
|
|
||||||
build: build,
|
|
||||||
version: version,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// What marks the app's own stack frames (`package:todo/`).
|
|
||||||
String get mark => 'package:${package ?? app.replaceAll('-', '_')}/';
|
|
||||||
}
|
|
||||||
@ -1,84 +0,0 @@
|
|||||||
/// One error or slow-wait report, in the shape every reporter (Dart, Python,
|
|
||||||
/// GDScript) writes and utils `app_errors` ingests (its README, "Entry").
|
|
||||||
library;
|
|
||||||
|
|
||||||
/// The kind of a user-visible wait that lasted over a second.
|
|
||||||
const perfSlowKind = 'perf.slow';
|
|
||||||
|
|
||||||
/// One report, before the uploader adds the app's repo, mark and build.
|
|
||||||
class ErrorEntry {
|
|
||||||
/// A report of [kind] at [at].
|
|
||||||
const ErrorEntry({
|
|
||||||
required this.at,
|
|
||||||
required this.kind,
|
|
||||||
required this.error,
|
|
||||||
this.stack = const [],
|
|
||||||
this.route,
|
|
||||||
this.operation,
|
|
||||||
this.durationMs,
|
|
||||||
this.waitId,
|
|
||||||
this.still,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// Decodes [toJson]'s shape; throws on a wrong one ([tryFromJson] does not).
|
|
||||||
factory ErrorEntry.fromJson(Map<String, Object?> json) => ErrorEntry(
|
|
||||||
at: DateTime.parse(json['at']! as String),
|
|
||||||
kind: json['kind']! as String,
|
|
||||||
error: json['error']! as String,
|
|
||||||
stack: [for (final f in json['stack'] as List<Object?>? ?? []) '$f'],
|
|
||||||
route: json['route'] as String?,
|
|
||||||
operation: json['operation'] as String?,
|
|
||||||
durationMs: json['durationMs'] as int?,
|
|
||||||
waitId: json['waitId'] as String?,
|
|
||||||
still: json['still'] as bool?,
|
|
||||||
);
|
|
||||||
|
|
||||||
/// [ErrorEntry.fromJson], or null when [json] is not an entry.
|
|
||||||
static ErrorEntry? tryFromJson(Object? json) {
|
|
||||||
try {
|
|
||||||
return ErrorEntry.fromJson(json! as Map<String, Object?>);
|
|
||||||
} on Object {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// When it happened (UTC).
|
|
||||||
final DateTime at;
|
|
||||||
|
|
||||||
/// `uncaught.flutter`, `uncaught.async`, `perf.slow`, ...
|
|
||||||
final String kind;
|
|
||||||
|
|
||||||
/// The error's text (a slow wait: `<operation> waited <ms> ms`).
|
|
||||||
final String error;
|
|
||||||
|
|
||||||
/// The innermost frames, then the app's own.
|
|
||||||
final List<String> stack;
|
|
||||||
|
|
||||||
/// The route on top when it happened (a pattern, never an id).
|
|
||||||
final String? route;
|
|
||||||
|
|
||||||
/// What a slow wait waited for (`list.load`).
|
|
||||||
final String? operation;
|
|
||||||
|
|
||||||
/// How long a slow wait took.
|
|
||||||
final int? durationMs;
|
|
||||||
|
|
||||||
/// Names one slow wait across its still-going and final reports.
|
|
||||||
final String? waitId;
|
|
||||||
|
|
||||||
/// True for the report of a wait that has not ended yet.
|
|
||||||
final bool? still;
|
|
||||||
|
|
||||||
/// The JSON shape (absent fields are left out).
|
|
||||||
Map<String, Object?> toJson() => {
|
|
||||||
'at': at.toUtc().toIso8601String(),
|
|
||||||
'kind': kind,
|
|
||||||
'error': error,
|
|
||||||
'stack': stack,
|
|
||||||
'route': ?route,
|
|
||||||
'operation': ?operation,
|
|
||||||
'durationMs': ?durationMs,
|
|
||||||
'waitId': ?waitId,
|
|
||||||
'still': ?still,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
/// The on-device queue of reports not yet uploaded.
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/error_entry.dart';
|
|
||||||
import 'package:crypto/crypto.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
|
|
||||||
/// Reports waiting for upload, persisted in `SharedPreferences` (so web
|
|
||||||
/// builds keep them too): a crash, a lost connection or a signed-out device
|
|
||||||
/// loses nothing. Keeps the newest [maxEntries].
|
|
||||||
class ErrorQueue {
|
|
||||||
ErrorQueue._(this._prefs, this._entries);
|
|
||||||
|
|
||||||
/// The queue stored in [prefs]; a corrupt store opens empty.
|
|
||||||
static Future<ErrorQueue> open(SharedPreferences prefs) async {
|
|
||||||
final entries = <ErrorEntry>[];
|
|
||||||
try {
|
|
||||||
for (final raw in jsonDecode(prefs.getString(key) ?? '[]') as List) {
|
|
||||||
final entry = ErrorEntry.tryFromJson(raw);
|
|
||||||
if (entry != null) entries.add(entry);
|
|
||||||
}
|
|
||||||
} on FormatException {
|
|
||||||
// A corrupt queue is dropped: reporting must never stop the app.
|
|
||||||
}
|
|
||||||
return ErrorQueue._(prefs, entries);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Preferences key of the queue.
|
|
||||||
static const key = 'app_errors.queue';
|
|
||||||
|
|
||||||
/// Most reports kept.
|
|
||||||
static const maxEntries = 300;
|
|
||||||
|
|
||||||
final SharedPreferences _prefs;
|
|
||||||
final List<ErrorEntry> _entries;
|
|
||||||
final _added = StreamController<ErrorEntry>.broadcast();
|
|
||||||
Future<void> _tail = Future.value();
|
|
||||||
|
|
||||||
/// The id of [entry]: a hash of its JSON, so a re-sent upload is a no-op.
|
|
||||||
static String idOf(ErrorEntry entry) => sha1
|
|
||||||
.convert(utf8.encode(jsonEncode(entry.toJson())))
|
|
||||||
.toString()
|
|
||||||
.substring(0, 20);
|
|
||||||
|
|
||||||
/// What is queued, oldest first.
|
|
||||||
List<ErrorEntry> get entries => List.unmodifiable(_entries);
|
|
||||||
|
|
||||||
/// Fires after each [add].
|
|
||||||
Stream<ErrorEntry> get added => _added.stream;
|
|
||||||
|
|
||||||
/// Completes when every change so far is stored.
|
|
||||||
Future<void> get saved => _tail;
|
|
||||||
|
|
||||||
/// Queues [entry] and stores the queue.
|
|
||||||
void add(ErrorEntry entry) {
|
|
||||||
_entries.add(entry);
|
|
||||||
if (_entries.length > maxEntries) {
|
|
||||||
_entries.removeRange(0, _entries.length - maxEntries);
|
|
||||||
}
|
|
||||||
_save();
|
|
||||||
_added.add(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Drops the entries whose ids are in [ids] and stores the queue.
|
|
||||||
void remove(Set<String> ids) {
|
|
||||||
_entries.removeWhere((e) => ids.contains(idOf(e)));
|
|
||||||
_save();
|
|
||||||
}
|
|
||||||
|
|
||||||
void _save() {
|
|
||||||
final text = jsonEncode([for (final e in _entries) e.toJson()]);
|
|
||||||
_tail = _tail.then((_) => _prefs.setString(key, text));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,94 +0,0 @@
|
|||||||
/// Records errors the user saw (or that escaped) in the [ErrorQueue].
|
|
||||||
library;
|
|
||||||
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/app_errors_config.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/error_entry.dart';
|
|
||||||
import 'package:crdt_sync_flutter/src/errors/error_queue.dart';
|
|
||||||
|
|
||||||
/// The one door for the app-wide hooks (from kartka's `ErrorReporter`).
|
|
||||||
///
|
|
||||||
/// It guards the queue against error loops: an identical `kind` + message
|
|
||||||
/// inside [window] is dropped, and at most [maxPerMinute] reports are kept a
|
|
||||||
/// minute. It never throws and never reports from inside a report.
|
|
||||||
class ErrorReporter {
|
|
||||||
/// A reporter into [queue] for [config]'s app, reading time from [now].
|
|
||||||
ErrorReporter(this.queue, {required this.config, DateTime Function()? now})
|
|
||||||
: _now = now ?? DateTime.now;
|
|
||||||
|
|
||||||
/// How long an identical error stays suppressed.
|
|
||||||
static const window = Duration(seconds: 30);
|
|
||||||
|
|
||||||
/// Most reports kept in one minute.
|
|
||||||
static const maxPerMinute = 20;
|
|
||||||
|
|
||||||
/// Innermost frames always kept; the rest are the app's own frames.
|
|
||||||
static const _innerFrames = 2;
|
|
||||||
|
|
||||||
/// Where reports go.
|
|
||||||
final ErrorQueue queue;
|
|
||||||
|
|
||||||
/// The app reported for.
|
|
||||||
final AppErrorsConfig config;
|
|
||||||
|
|
||||||
/// The route on top now (an [AppErrorsRouteObserver] keeps it current).
|
|
||||||
String? route;
|
|
||||||
|
|
||||||
final DateTime Function() _now;
|
|
||||||
final _lastSeen = <String, DateTime>{};
|
|
||||||
DateTime? _minute;
|
|
||||||
int _inMinute = 0;
|
|
||||||
bool _busy = false;
|
|
||||||
|
|
||||||
/// Records [error] (with [stack]) as a [kind] report, unless suppressed.
|
|
||||||
void report(String kind, Object? error, {StackTrace? stack}) {
|
|
||||||
if (_busy) return;
|
|
||||||
_busy = true;
|
|
||||||
try {
|
|
||||||
final at = _now().toUtc();
|
|
||||||
final text = '${error ?? 'unknown error'}';
|
|
||||||
if (_allowed('$kind|$text', at)) {
|
|
||||||
queue.add(
|
|
||||||
ErrorEntry(
|
|
||||||
at: at,
|
|
||||||
kind: kind,
|
|
||||||
error: text,
|
|
||||||
stack: _focus(stack),
|
|
||||||
route: route,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} on Object {
|
|
||||||
// An error whose toString throws: nothing sensible to record.
|
|
||||||
} finally {
|
|
||||||
_busy = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _allowed(String key, DateTime at) {
|
|
||||||
_lastSeen.removeWhere((_, seen) => at.difference(seen) >= window);
|
|
||||||
if (_lastSeen.containsKey(key)) return false;
|
|
||||||
final minute = _minute;
|
|
||||||
if (minute == null || at.difference(minute) >= const Duration(minutes: 1)) {
|
|
||||||
_minute = at;
|
|
||||||
_inMinute = 0;
|
|
||||||
}
|
|
||||||
if (_inMinute >= maxPerMinute) return false;
|
|
||||||
_inMinute++;
|
|
||||||
_lastSeen[key] = at;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The innermost frames, then the app's own frames, so a framework-deep
|
|
||||||
/// stack still names the app code that triggered it.
|
|
||||||
List<String> _focus(StackTrace? stack) {
|
|
||||||
if (stack == null) return const [];
|
|
||||||
final frames = [
|
|
||||||
for (final line in '$stack'.split('\n'))
|
|
||||||
if (line.trim().isNotEmpty) line.trim(),
|
|
||||||
];
|
|
||||||
return [
|
|
||||||
...frames.take(_innerFrames),
|
|
||||||
...frames.skip(_innerFrames).where((f) => f.contains(config.mark)),
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user