aes128gcm content encoding (RFC 8188) layered over the Web Push message
encryption (RFC 8291).
Encrypts a plaintext payload into the binary body POSTed to the push service
endpoint. The receiving user agent decrypts it with the subscription's
private key + auth secret and hands the plaintext to the service worker's
push event.
Single-record only: payloads must fit in record_size - 17 bytes (4079 for
the default 4096). Notifications are usually well under 250 bytes, so
records are never split.
Summary
Functions
Returns the binary body to POST. p256dh and auth come from the
subscription (URL-safe base64, no padding).
Functions
Returns the binary body to POST. p256dh and auth come from the
subscription (URL-safe base64, no padding).
Generates a fresh application-server ECDH keypair and salt for each call.
@spec encrypt_with( plaintext :: binary(), p256dh :: String.t(), auth :: String.t(), keypair :: {binary(), binary()}, salt :: binary() ) :: binary()
Same as encrypt/3 but takes the application-server keypair and salt
explicitly, making the output deterministic. Exposed for testing against
RFC 8291 §5 vectors; production callers should use encrypt/3.