WebPushProvider class

Web Push, per RFC 8291 (encryption) and RFC 8292 (VAPID).

The recipient is the browser subscription as JSON, exactly as PushManager.subscribe() produced it. It is not a token that can be posted to: the push service is untrusted infrastructure that never sees the plaintext, so the payload is encrypted to a key only the subscribing user agent holds, and the request is signed so the service knows which application server is sending.

Both halves already exist as DVWebPush and DVWebPushVapid; this is what puts them on the wire together. Neither is optional — an unencrypted body is a protocol error rather than a degraded mode, and an unsigned POST is refused because anyone who learned the endpoint could otherwise send to it.

Implemented types

Constructors

WebPushProvider({required DVWebPushKeyPair vapidKeys, required String subject, Duration timeToLive = const Duration(hours: 24), DVHttpSend transport = dvSendHttpRequest})

Properties

hashCode int
The hash code for this object.
no setterinherited
kind DVNotificationProviderKind
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subject String
A mailto: or https: contact for whoever operates this server. Push services require one so they can report abuse to a human.
final
timeToLive Duration
How long a message may wait if the device is offline.
final
transport DVHttpSend
final
vapidKeys DVWebPushKeyPair
The application server's identity key. Stable across sends: it is the public half of this pair that the browser pinned at subscribe time, so rotating it invalidates every existing subscription.
final

Methods

buildPayload(DVNotificationMessage message) Map<String, Object?>
The payload a service worker receives in its push event.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
send(String recipient, DVNotificationMessage message) Future<void>
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited