Documentation
¶
Overview ¶
Package cookie provides cookie encryption using PASETO
Index ¶
- func SecureCookie() bool
- type Client
- func (c *Client) Decrypt(cookieName, cookieValue string) (Values, error)
- func (c *Client) Delete(w http.ResponseWriter, cookieName string)
- func (c *Client) Encrypt(cookieName string, expiration time.Time, cval Values) string
- func (c *Client) Read(r *http.Request, cookieName string) (params Values, found bool, err error)
- func (c *Client) WritePersistentCookie(w http.ResponseWriter, cookieName, domain string, httpOnly bool, ...)
- func (c *Client) WriteSessionCookie(w http.ResponseWriter, cookieName, domain string, httpOnly bool, ...)
- type Key
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SecureCookie ¶
func SecureCookie() bool
SecureCookie returns true if the cookie should be secure
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements reading and writing encrypted cookies
func New ¶
New returns a new Client keyBase64 must be a base64-encoded string of at least 32 random bytes, used to derived the symmetric key.
func (*Client) Delete ¶
func (c *Client) Delete(w http.ResponseWriter, cookieName string)
Delete deletes a cookie from the response
func (*Client) WritePersistentCookie ¶
func (c *Client) WritePersistentCookie(w http.ResponseWriter, cookieName, domain string, httpOnly bool, sameSite http.SameSite, expiration time.Duration, cval Values)
WritePersistentCookie writes a persistent cookie to the response
func (*Client) WriteSessionCookie ¶
func (c *Client) WriteSessionCookie(w http.ResponseWriter, cookieName, domain string, httpOnly bool, sameSite http.SameSite, cval Values)
WriteSessionCookie writes a session cookie to the response
Click to show internal directories.
Click to hide internal directories.