Documentation
¶
Index ¶
- func DecodeVAPIDPrivateKey(privKeyB64 string) (*ecdsa.PrivateKey, error)
- func DeleteSubscriptionByEndpoint(ctx context.Context, db *sql.DB, endpoint string) error
- func DispatchPushReminder(ctx context.Context, db *sql.DB, recipients []int, ...)
- func GenerateVAPIDKeys() (publicKey, privateKey string, err error)
- func GetVAPIDKeys(vapidPublic, vapidPrivate string) (pub, priv string, err error)
- func SaveSubscription(ctx context.Context, db *sql.DB, userID int, ...) error
- func Send(sub Subscription, payload []byte, ...) error
- type PushConfig
- type Subscription
- type SubscriptionExpiredError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeVAPIDPrivateKey ¶
func DecodeVAPIDPrivateKey(privKeyB64 string) (*ecdsa.PrivateKey, error)
DecodeVAPIDPrivateKey decodes a base64url-encoded VAPID private key into an ECDSA key.
func DeleteSubscriptionByEndpoint ¶
DeleteSubscriptionByEndpoint removes a push subscription by endpoint URL.
func DispatchPushReminder ¶
func DispatchPushReminder(ctx context.Context, db *sql.DB, recipients []int, reminder notifications.PendingReminder, cfg PushConfig)
DispatchPushReminder sends push notifications for a pending reminder to all subscribed recipients.
func GenerateVAPIDKeys ¶
GenerateVAPIDKeys generates a new VAPID key pair encoded as base64url strings.
func GetVAPIDKeys ¶
GetVAPIDKeys reads VAPID keys from the given public/private strings. If empty, generates new keys and logs a warning.
Types ¶
type PushConfig ¶
PushConfig holds VAPID configuration for push dispatching.
type Subscription ¶
Subscription represents a Web Push subscription.
func GetSubscriptionsForUser ¶
func GetSubscriptionsForUser(ctx context.Context, db *sql.DB, userID int, userType string) ([]Subscription, error)
GetSubscriptionsForUser returns all push subscriptions for a specific user.
func GetSubscriptionsForUsers ¶
func GetSubscriptionsForUsers(ctx context.Context, db *sql.DB, userIDs []int, userType string) ([]Subscription, error)
GetSubscriptionsForUsers returns push subscriptions for multiple users.
type SubscriptionExpiredError ¶
SubscriptionExpiredError indicates a subscription endpoint is no longer valid.
func (*SubscriptionExpiredError) Error ¶
func (e *SubscriptionExpiredError) Error() string