VAPID (RFC 8292) JWT signing for Web Push authentication.
Builds a JWT with ES256 over the claims {aud, exp, sub}, signs it with
the VAPID P-256 private key, and returns the Authorization header value
in the form vapid t=<jwt>, k=<vapid_public_b64>.
Keys come from application config:
config :web_push, :vapid,
public_key: "B...",
private_key: "...",
subject: "mailto:you@example.com"Generate a keypair with mix web_push.gen.vapid.
Summary
Functions
Returns the origin (scheme + host + non-default port) of a URL: the value
used as the aud claim in the VAPID JWT.
Builds the full Authorization header value for a request to endpoint_url.
Generates a VAPID P-256 keypair, URL-safe base64 without padding.
Returns the configured VAPID public key (URL-safe base64, 65-byte point).
The client passes this to pushManager.subscribe({ applicationServerKey }).
Functions
Returns the origin (scheme + host + non-default port) of a URL: the value
used as the aud claim in the VAPID JWT.
Builds the full Authorization header value for a request to endpoint_url.
Generates a VAPID P-256 keypair, URL-safe base64 without padding.
@spec public_key() :: String.t()
Returns the configured VAPID public key (URL-safe base64, 65-byte point).
The client passes this to pushManager.subscribe({ applicationServerKey }).