Documentation
¶
Overview ¶
Package webpush provides Web Push notification support using VAPID authentication.
Index ¶
- func GetOrCreateVAPIDKeys(kv kvstore.Store) (privateKey, publicKey string, err error)
- type Handler
- type Sender
- type Store
- func (s *Store) DeleteByEndpoint(ctx context.Context, endpoint string) error
- func (s *Store) ListAll(ctx context.Context) ([]*Subscription, error)
- func (s *Store) ListByUser(ctx context.Context, userID string) ([]*Subscription, error)
- func (s *Store) Subscribe(ctx context.Context, userID string, sub *Subscription) error
- func (s *Store) Unsubscribe(ctx context.Context, endpoint string) error
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides HTTP endpoints for Web Push subscription management.
func NewHandler ¶
NewHandler creates a new Web Push handler.
func (*Handler) GetVAPIDKey ¶
GetVAPIDKey returns the VAPID public key for browser subscription.
func (*Handler) RegisterRoutes ¶
RegisterRoutes registers Web Push routes on the given echo group.
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender delivers Web Push notifications to subscribed browsers.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides SQLite-backed persistence for push subscriptions.
func NewStoreWithReadDB ¶
NewStoreWithReadDB creates a new push subscription store with separate write and read database handles.
func (*Store) DeleteByEndpoint ¶
DeleteByEndpoint removes a subscription by endpoint (for stale cleanup).
func (*Store) ListAll ¶
func (s *Store) ListAll(ctx context.Context) ([]*Subscription, error)
ListAll returns all subscriptions (for broadcast).
func (*Store) ListByUser ¶
ListByUser returns all subscriptions for a user.
type Subscription ¶
type Subscription struct {
ID int64 `json:"id"`
UserID string `json:"user_id"`
Endpoint string `json:"endpoint"`
KeyP256dh string `json:"key_p256dh"`
KeyAuth string `json:"key_auth"`
CreatedAt time.Time `json:"created_at"`
}
Subscription represents a Web Push subscription from a browser.