Skip to content

Cookies

$bolt.setCookie(cName, cValue)

Set a cookie with default path (/).

$bolt.setCookie("user", "john")

$bolt.setCookieEx(cName, cValue, cOptions)

Set cookie with custom options.

$bolt.setCookieEx("token", "abc123", "Path=/; Max-Age=3600; HttpOnly; Secure")

$bolt.cookie(cName)

Get cookie value.

user = $bolt.cookie("user")

$bolt.deleteCookie(cName)

Delete a cookie.

$bolt.deleteCookie("user")

setCookieSecret(cSecret)

Set secret for signed cookies.

setCookieSecret("my-secret-key")

$bolt.setSignedCookie(cName, cValue)

Set a signed cookie. Requires setCookieSecret() to be called first.

$bolt.setSignedCookie("session", "data")

$bolt.getSignedCookie(cName)

Get and verify signed cookie. Returns empty string if invalid.

data = $bolt.getSignedCookie("session")