Expand description
Web Push (kernel spec §6; plan 10a): the VAPID key pair in
<data>/vapid.key and the tokens it signs, the owner’s push
subscriptions, and each hat’s push policy. Delivery and its triggers are
plan 10b’s. The subscriptions and the policies share the host registry’s
connection and owner, as hats do, and every query names the owner
(kernel spec §1).
Structs§
- NewSubscription
- A subscription as the browser sent it (
PushSubscription.toJSON()). - Notice
- A notification for the owner’s devices, before the hat’s policy is applied (kernel spec §6; plan 10b decision 1). The modules that own a trigger fill it in (ACP core §10, gateway §7); delivery applies the policy, so no caller re-implements it:
- Notices
- The queue’s reading end, for delivery. Dropping it makes
notifydrop everything. - Push
- Where notices go to be delivered (kernel spec §6): a queue that
delivery (plan 10b-ii) drains. Cheap to clone;
notifynever waits and never fails, so a trigger can call it from any thread, async or not. - Push
Policy - A hat’s push policy (kernel spec §6). The default, for a hat with no row: not muted, no details, the session title shown.
- Subscription
- One stored subscription.
- Vapid
Key - The collector’s VAPID key pair (RFC 8292): a P-256 key generated on the
first start and kept in
vapid.key(kernel spec §6). Every push subscription is bound to its public key, so the file is never replaced: one that cannot be read stops the start (decision 1). The private key leaves this type only as signatures.
Enums§
- Subscribed
- The outcome of
Hosts::subscribeandHosts::rotate. - Urgency
- How soon a push service should deliver a notification (RFC 8030 §5.3):
highfor “needs your answer”,normalotherwise (kernel spec §6).
Constants§
- MAX_
CONTACT - The longest contact address accepted (RFC 5321’s path limit).
- MAX_
ENDPOINT - The longest endpoint accepted (decision 3). The push services’ own are a few hundred bytes.
- MAX_
SUBSCRIPTIONS - The subscriptions an owner may have at once (decision 5): each is a request per notification.
- NOTICE_
QUEUE - The tags waiting to be delivered, at most (plan 10b-i decision 5). A tag holds one notice, its latest, so one session cannot fill the queue for the others (10b-i’s review, A2).
- VAPID_
KEY_ FILE - The VAPID private key’s file in the collector’s data directory (kernel spec §1).
- VAPID_
TOKEN_ SECS - How long a VAPID token is valid. RFC 8292 §2 allows at most 24 hours.
Functions§
- audience
- A VAPID token’s
aud(RFC 8292 §2): the endpoint’s origin,scheme://host, with:portonly when it is not the scheme’s default. - contact_
problem - Why
contactcannot be the owner’s push contact, orNone: a plain e-mail address, which the VAPID token names asmailto:(kernel spec §6; plan 10a decision 7). Letters, digits and.+_-before the@; a domain name with a dot after it. - parse_
endpoint endpointas a push subscription’s (decision 3), in the form it is stored, looked up and sent to (the review’s A2), or why it cannot be one. The push services’ endpoints arehttpsURLs on their own domain names at the default port; anything else is refused before it is stored, and the address it resolves to is checked again on every send (kernel spec §7.1).- parse_
keys - The subscription’s public key and secret (base64url, padded or not),
in the form they are stored: base64url without padding, so delivery
decodes them one way.
Errunless they are a P-256 point, uncompressed, and 16 bytes (RFC 8291 §3.2). - subject
- A VAPID token’s
sub(kernel spec §6; maintainer decision 6b):mailto:the owner’s contact (contact_problemkeeps it free of anythingmailto:would need escaped), else thepublic_urlorigin when it ishttps.Nonefor anhttpone (loopback): kernel §6 never sends a non-routablesub, and Apple refuses anything butmailto:orhttps:(the review’s N1), so the token carries none.
Type Aliases§
- Notice
Guard - Modules may revoke queued notification attempts without changing delivery policy.