th-c561f1: auto-provision VAPID keys so Web Push works out of the box - #335
Merged
Conversation
Notifications no-op'd because the daemon only read VAPID keys from SMOOTH_VAPID_PUBLIC/_PRIVATE (unset on a normal install) → /push/key 503 → dead 'Enable notifications' button. Now the daemon generates a P-256 keypair on first run (pure-Rust p256), persists it to ~/.smooth/vapid.json (mode 600), and serves it. Precedence: explicit env → persisted file → fresh pair. Windows stays disabled. SMOOTH_VAPID_FILE overrides the path. +3 tests incl. a web-push VapidSignatureBuilder round-trip proving the key format. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L3xMBWMtMRNayBC2GjHntk
🦋 Changeset detectedLatest commit: 7ca351b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
"Enable notifications" did nothing. The daemon only read VAPID keys from
SMOOTH_VAPID_PUBLIC/SMOOTH_VAPID_PRIVATE— unset on a normal install — so/push/keyreturned 503 and the button silently no-op'd (surfaced honestly in #333; this makes it actually work).Fix
The daemon now generates a P-256 VAPID keypair on first run (pure-Rust
p256, already in the tree via web-push), persists it to~/.smooth/vapid.json(mode 600), and serves it — push enrolls with zero setup.SMOOTH_VAPID_*env → persistedvapid.json→ freshly generated pair.#[cfg(not(windows))]).SMOOTH_VAPID_FILEoverrides the path (used by tests so they never touch~/.smooth).Verification
cargo test -p smooai-smooth-daemon push::— 4/4 pass, including:generated_keys_are_valid_vapid— public = 65-byte uncompressed point (0x04…), private = 32-byte scalar, and the key round-trips throughweb-push'sVapidSignatureBuilder::from_base64.load_or_generate_is_stable— persists on first run, reuses on the next.windows_resolves_to_no_keys.cargo fmtclean.Rollout
Once merged, redeploy to smoo-hub (
scripts/smoo-hub/install-app.sh) and its Big Smooth will have working push; the client's "Enable notifications" then enrolls this device.🤖 Generated with Claude Code