Metadata-Version: 2.4
Name: pyvorin-thin
Version: 1.0.9
Summary: Pyvorin Thin Client — licensing, device-bound .pyvpkg delivery, and protected-core loading (no compiler shipped)
Author: Pyvorin Team
License: MIT
Keywords: thin-client,licensing,python,package-delivery,protected-core
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Requires-Python: <3.13,>=3.12
Description-Content-Type: text/markdown
Requires-Dist: typer<0.13,>=0.9
Requires-Dist: click<8.2,>=8.1
Requires-Dist: rich<14,>=13.7
Requires-Dist: colorama>=0.4.6
Requires-Dist: cryptography>=42
Requires-Dist: pynacl>=1.5
Provides-Extra: local-native
Requires-Dist: pyvorin>=1.0.0rc2; extra == "local-native"
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-cov>=4.1; extra == "dev"

# Pyvorin Thin Client

**Experimental / Internal — Private Pilot Only**

`pyvorin-thin` is a safe, compiler-free client for Pyvorin licensing, device-bound
`.pyvpkg` delivery, usage metering, and **protected compiler-core loading**.  It
does **not** contain the Pyvorin compiler: the core is delivered separately as a
customer/device-bound package and loaded only through
`pyvorin_thin.ProtectedCoreLoader`.

## What it does

- **Activation** — create a per-installation X25519 + Ed25519 keypair and
  register its *public* keys against a licence.
- **Artifact delivery** — resolve and download the machine-appropriate
  `.pyvpkg` from a short-lived signed URL.
- **Verify + decrypt** — Ed25519 package signature, time/replay/anti-rollback,
  ECIES (X25519 → HKDF-SHA256 → XChaCha20-Poly1305) content-key unwrap, and the
  payload AEAD.  The content key is never sent next to the ciphertext.
- **Install** — atomic staging → manifest + Merkle verification → self-test →
  `current` symlink swap (rollback is a pointer swap).
- **Load** — `ProtectedCoreLoader` verifies `CORE_MANIFEST` against the pinned
  Ed25519 release key plus the per-file hash index, binds the entitlement to the
  build/device, then (and only then) imports the core.
- **Licence / usage / workload** — the original thin-client surface.

## What it does NOT do

- Contain the compiler (no `native_compiler`, lowering, planner or router).
- Ship compiler internals, HMAC secrets, or a server-side decryption key.
- Upload customer source — compilation is local and source never leaves the machine.

## Install

The public PyPI package is `pyvorin`, which is the thin client and depends on
`pyvorin-thin` (this package) for its implementation:

```bash
pip install pyvorin
# or use the implementation package directly:
pip install pyvorin-thin
```

Dependencies: `cryptography` (Ed25519/X25519/HKDF/AEAD), `pynacl` (XChaCha20-
Poly1305 / libsodium), `typer`, `click`, `rich`, `colorama`.

## Core lifecycle

```bash
pyvorin-thin core status            # active build, verified files, entitlement
pyvorin-thin core doctor            # environment + pinned keys + core checks
pyvorin-thin core update            # fetch, verify, decrypt, install
pyvorin-thin core update --package core.pyvpkg   # air-gap install
pyvorin-thin core update --load     # install then load the core
pyvorin-thin core rollback          # restore the previous verified build
```

## Safety

- Manifest/lease keys are pinned in the client; a core cannot nominate its own
  trust anchor.
- All verification is fail-closed (typed `PVL0xx` errors); no partial load and no
  fallback to an unverified tree.
- License keys are hashed before logging.

## License

MIT (this thin client). The Pyvorin Compiler Core is distributed separately as a
customer/installation-bound, signed and encrypted `.pyvpkg` under the applicable
commercial agreement — it is not part of this package.

See the repo document `docs/THIN_CLIENT_ARCHITECTURE.md` for the full
distribution model (thin client, compiler core, four operating modes, `.pyvpkg`
format, signature/lease hierarchy and the honest protection limits).
