Skip to content

License keys: read and checked with no server, and asked for anew - #380

Merged
tiendc merged 1 commit into
mainfrom
feat/license-core
Dec 6, 2026
Merged

tiendc merged 1 commit into
mainfrom
feat/license-core

Conversation

@tiendc

@tiendc tiendc commented Dec 5, 2026

Copy link
Copy Markdown
Collaborator

Step 2 of docs/design/license.md: crates/core's license, which the desktop and the phones both reach. Nothing calls it yet. Settings › License (step 3) and the limits (step 4) come next.

What it does

  • Reads a key. A key is the portal's signed envelope, under the context shellwing-license-v1. It needs both signatures, Ed25519ctx and ML-DSA-65.
    • Release builds trust only the portal's shared production keys. They are copies of pkg/licensesig/prodkeys/shared, the same files packwing uses.
    • Debug builds trust only the portal's development keys.
  • Refuses with a message that says nothing about the key:
    • a key of another product (packwing's, for one);
    • a plan that is not shellwing's;
    • a key that names installations;
    • a changed payload;
    • a key with only one signature.
  • Plans: Free, Plus, Pro and Business, under the portal's IDs (shellwing-plus, shellwing-pro, shellwing-business).
    • Free: no sync through Google Drive, OneDrive, iCloud or Dropbox; at most 2 hosts given to AI (FREE_AI_HOSTS); no session logs.
    • Plus: all of the above, without limits.
    • Pro and Business: shellwing cloud as well.
  • Standing: a key works until it ends, then through its grace, then the plan is Free. A trial has no grace. A newer key of the same license replaces the one held (newest).
  • Refresh: POST /api/licenses/refresh with {"key": …} and nothing else. The answers are read as the portal's refresh contract says. SHELLWING_PORTAL points a debug build at a portal that signs with the development keys.

crates/signed

The envelope check was crates/update/src/envelope.rs, used for the list of releases. It is now its own crate, shellwing-signed, which both update and core use.

  • update re-exports it as envelope.
  • Its test data moved with it. crates/app/src/ui_tests/updates.rs and docs/updates.md now point to the new paths.
  • Its error messages no longer say "release", because the crate also opens license keys. update adds "the list of releases:" in front of them instead.

Tests

  • 11 tests in license. They read keys made by the portal's own signer with its development keys; crates/core/testdata/license/README.md has the program that makes them again.
  • cargo test --release passes too: a release build refuses a development key.
  • Also run: cargo test -p shellwing-signed -p shellwing-update -p shellwing-core --lib, make lint, cargo clippy -p shellwing --features ui-tests --all-targets -D warnings, and i18n.py check.
  • One new string in 14 languages.
  • The workspace and UI tests were not run here. CI runs them.

🤖 Generated with Claude Code

The second step of docs/design/license.md: what a key from the portal
says, and what each plan gives, in crates/core (license), where the
desktop and the phones both reach it. Nothing uses it yet; Settings ›
License and the limits come next.

- A key is the portal's signed envelope under shellwing-license-v1:
  Ed25519ctx and ML-DSA-65, the portal's shared public keys built in,
  its development keys in debug builds only. A key of another product,
  a plan that is not shellwing's, a key naming installations, a change
  or one signature alone are refused, with a message that names nothing
  of the key.
- Plans: Free, Plus, Pro, Business, by the portal's IDs (shellwing-*).
  Free gives two hosts to AI and no session logs, and no sync through
  Google Drive, OneDrive, iCloud or Dropbox; shellwing cloud is Pro's.
- A key works through its end and its grace (none for a trial), then
  Free; a newer key of the same license replaces it.
- The refresh: POST /api/licenses/refresh with the key alone, its answers
  read as the portal's contract says. SHELLWING_PORTAL points a debug
  build at another portal.

The envelope was crates/update's, for the list of releases: it is
crates/signed now, which both open. Its test data moves with it.

The tests read keys the portal's own signer made with its development
keys (crates/core/testdata/license, with how to make them again).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@tiendc
tiendc merged commit 7247b3c into main Dec 6, 2026
5 checks passed
@tiendc
tiendc deleted the feat/license-core branch December 6, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant