webpush

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CEK_SIZE    = 16
	IKM_SIZE    = 32
	NONCE_SIZE  = 12
	RECORD_SIZE = 4
	SALT_SIZE   = 16

	MAX_PAYLOAD_SIZE   = 4096
	MAX_PLAINTEXT_SIZE = 3993 // see https://datatracker.ietf.org/doc/html/rfc8291/#section-4
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WebPush

type WebPush struct {
	CEK       []byte
	Endpoint  string
	Nonce     []byte
	PublicKey *ecdh.PublicKey
	Salt      [SALT_SIZE]byte
}

func NewWebPush

func NewWebPush(sub *models.PushSubscription) (p *WebPush, err error)

func (*WebPush) Encrypt

func (p *WebPush) Encrypt(payload []byte) (buf []byte, err error)

func (*WebPush) Send

func (p *WebPush) Send(payload []byte, params *request.WithWebPushParams) (res *http.Response, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL