feat: Web Push — VAPID keys, subscription store, send loop, and browser package (#162) - #163
Merged
Merged
Conversation
…er package (#162) Adds Elarion.WebPush (IWebPushSender, WebPushSubscriptionService, VAPID key provider, store seams with in-memory defaults; RFC 8291/8292 on the .NET crypto primitives), Elarion.WebPush.EntityFrameworkCore ([GenerateElarionWebPush], ELWP001), Elarion.WebPush.AspNetCore (MapElarionWebPush), and the @swimmesberger/elarion-webpush npm package (availability detection incl. iOS Home Screen, gesture-safe enablePush, subscribe/refresh helpers, service-worker module). Endpoints are restricted to known push services by default (SSRF guard). Documented in ADR-0076 and the Web Push capability page.
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.
Summary
Closes #162. Adds Web Push (RFC 8030 / 8291 / 8292) so apps can notify users whose app is closed — the half that client events (ADR-0043) cannot cover. Recipients, triggers, and text stay in the app; keys, store, delivery with cleanup, and the browser/service-worker plumbing move into the framework (ADR-0076).
Elarion.WebPush—IWebPushSender(SendToUsersAsync/SendToCurrentUserAsync,WebPushMessagewith title/body/url/tag/urgency/TTL).aes128gcmencryption and ES256 VAPID signing on the .NET crypto primitives (AOT-compatible, no third-party push SDK), bounded-concurrency fan-out, deletion of 404/410 and malformed subscriptions, transient failures kept. VAPID keys: configuration → store → generate (race-safe across nodes).WebPushSubscriptionServicebinds subscriptions toICurrentUser(upsert by endpoint, reassigning a device that re-subscribes under another account). In-memory stores by default.Elarion.WebPush.EntityFrameworkCore—elarion_push_subscriptions/elarion_vapid_keysvia[GenerateElarionWebPush](newELWP001) ormodelBuilder.UseElarionWebPush(); PostgreSQLON CONFLICTupsert / first-insert-wins.Elarion.WebPush.AspNetCore—MapElarionWebPush():GET public-key,POST subscribe(subscription.toJSON()),POST unsubscribe; AOT-safeRequestDelegateregistrations.@swimmesberger/elarion-webpush(npm) —pushAvailability()(available/install-firstfor iOS Safari outside the Home Screen /unsupported), gesture-safeenablePush,subscribe/unsubscribe/isSubscribed/refreshOnStartover a pluggableWebPushServerApi(fetchWebPushApi()or an adapter over the generated JSON-RPC client), and a/swmodule forpush,notificationclick,pushsubscriptionchange.capabilities/web-pushpage, ADR-0076, package/attribute/diagnostic references, CHANGELOG, README, elarion skill.Type of change
Checklist
dotnet build Elarion.slnx -c Releasepasses (warnings are errors).dotnet testpasses; new/changed behavior is covered by tests. (2139/2139, PostgreSQL integration tests ran via Testcontainers.)tests/Elarion.Tests/Generators.AnalyzerReleases.Unshipped.md.docs/is updated for any user-visible change. (websitebuild +check:linksclean.)CHANGELOG.mdis updated under Unreleased.Notes for reviewers
AllowedEndpointHostsorAllowAnyEndpointHost.r‖sformat. Not tested against a live push service.PlatformNotSupportedException(OpenSSL:CryptographicException);P256.TryImportPublicKeyhandles both.WebPushMessageuses nominalrequired/initproperties (repo DTO style) instead of the positional record sketched in the issue.Tagdoubles as the RFC 8030Topic(hashed when > 32 URL-safe chars).[Handler]s: apps either useMapElarionWebPush()or write three thin handlers delegating toWebPushSubscriptionService(documented).src/elarion-webpushadded to the CI and publish npm matrices; per repo rule all touched action pins were bumped to latest (checkoutv7.0.1,setup-dotnetv6.0.0,setup-nodev7.0.0 inpublish.yml).@swimmesberger/elarion-webpushon npmjs.com; until then that matrix leg fails (others unaffected,fail-fast: false).