Signs and verifies short-lived Phoenix.Token credentials for bridging
HTTP session state into cookie-less WebTransport connections.
Because browsers send WebTransport CONNECT requests with
credentials: "omit", Plug session cookies are not attached to the HTTP/3
handshake. Applications mint a signed token on the normal HTTPS/HTTP endpoint
(see PhoenixWebTransport.Plug) and verify it in socket.connect/1 or a
LiveView on_mount hook.
Summary
Functions
Default token lifetime in seconds.
Signs claims using Phoenix.Token.sign/4.
Verifies a token minted by sign/3.
Functions
@spec default_max_age() :: pos_integer()
Default token lifetime in seconds.
Signs claims using Phoenix.Token.sign/4.
context may be a Phoenix.Endpoint, a Plug.Conn, or a secret_key_base
binary. Options: :salt (default "phoenix_wtransport_connect"), :max_age.
@spec verify(module() | Plug.Conn.t() | binary(), String.t() | nil, keyword()) :: {:ok, term()} | {:error, :missing | :invalid | :expired}
Verifies a token minted by sign/3.
Options: :salt (default "phoenix_wtransport_connect"), :max_age
(default 60 seconds).