pub enum CookieSigning {
Fastauth,
BetterAuth(Secret),
}Expand description
How signed cookies (the session token, the rememberMe: false marker and every cookie a
plugin signs) are signed and checked.
Variants§
Fastauth
value.signature, an HMAC-SHA256 in base64url keyed with a key derived from the
secrets (fastauth/v1/cookie), every configured secret verifying session tokens.
BetterAuth(Secret)
Better Auth’s format, so a Better Auth app on the same database and fastauth accept each
other’s cookies: encodeURIComponent(value + "." + signature), the signature an
HMAC-SHA256 in padded standard base64 keyed with this secret’s bytes as they are, with
no key derivation. Cookies are verified in constant time and accepted percent-encoded or
not, as better-call does.
Only this one secret signs and verifies cookies, as in Better Auth 1.7.8, which signs
cookies with its current secret alone: rotating it signs everyone out of both apps.
.secrets(..) still keys everything else. Can’t be combined with the cookie cache.
Implementations§
Source§impl CookieSigning
impl CookieSigning
Sourcepub fn better_auth(secret: impl Into<Vec<u8>>) -> Self
pub fn better_auth(secret: impl Into<Vec<u8>>) -> Self
CookieSigning::BetterAuth with the Better Auth app’s BETTER_AUTH_SECRET, as the
app has it (its UTF-8 bytes, not decoded).