Expand description
Shared cookie utilities for building Set-Cookie headers.
Functions§
- create_
account_ cookie_ header - Render an account cookie with resolved account attributes and numeric TTL. Chunk names inherit the base cookie attributes.
- create_
clear_ cookie - Build a
Set-Cookieheader value that clears an arbitrary cookie by name, using the session config’s cookie attributes for consistency. - create_
clear_ session_ cookie - Build a
Set-Cookieheader value that clears the session cookie. - create_
cookie - Build a
Set-Cookieheader value for an arbitrary cookie using the auth config’s session cookie attributes for consistency. - create_
cookie_ with_ max_ age - Create a factory cookie: producer attributes precede per-cookie overrides. Unlike session-token issuance, the configured family age takes precedence.
- create_
derived_ session_ cookie - Build a derived cookie with the resolved session-token attributes. Multiple-session proofs inherit the token’s overrides as well as defaults.
- create_
session_ cookie - Build a
Set-Cookieheader value for a signed session token. - create_
session_ cookie_ with_ max_ age - Build a
Set-Cookieheader value for a session token using the session cookie attributes, optionally omittingMax-Ageto create a browser-session cookie. - create_
session_ like_ cookie - Build a
Set-Cookieheader value using the session cookie attributes for an arbitrary cookie name. - delete_
session_ cookie_ headers - Clear all cookies associated with the current session.
- related_
cookie_ name - Build a Better Auth related cookie name using the configured session cookie
prefix. For example,
better-auth.session_token+session_databecomesbetter-auth.session_data. - sign_
cookie_ value - Sign and URI-encode a cookie value using Better Call’s HMAC-SHA256 encoding.
- verify_
cookie_ value - Return a cookie’s payload only when its signature verifies.