Documentation
¶
Overview ¶
Package webpush provides Web Push notification sending support (VAPID + Push API).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPushServiceError = errors.New("webpush: push service error")
ErrPushServiceError is returned when the push service responds with an unexpected non-2xx, non-404/410 status code.
var ErrSubscriptionGone = errors.New("webpush: subscription gone")
ErrSubscriptionGone is returned when the push service reports the subscription is no longer valid (HTTP 404 or 410). The caller must soft-delete the corresponding UserContact or prune it from channel Settings.
Functions ¶
func GetOrCreateVAPIDKeys ¶
func GetOrCreateVAPIDKeys(ctx context.Context, cfg Config, dbSvc db.Service) (string, string, error)
GetOrCreateVAPIDKeys returns the server's VAPID keypair. It reads VAPIDPublicKey / VAPIDPrivateKey from cfg first; if absent, reads from the app_settings table; if still absent, generates a new pair, persists both to app_settings, and returns them. Must be called once during app startup and the result stored in config.
Types ¶
type Config ¶
Config holds the web-push configuration used for VAPID key management. It mirrors the relevant fields from config.WebPushConfig.