cookie

package
Version: v2.0.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2015 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SignedValue

func SignedValue(seed string, key string, value string, now time.Time) string

SignedValue returns a cookie that is signed and can later be checked with Validate

func Validate

func Validate(cookie *http.Cookie, seed string, expiration time.Duration) (value string, t time.Time, ok bool)

Validate ensures a cookie is properly signed

Types

type Cipher

type Cipher struct {
	cipher.Block
}

Cipher provides methods to encrypt and decrypt cookie values

func NewCipher

func NewCipher(secret string) (*Cipher, error)

NewCipher returns a new aes Cipher for encrypting cookie values

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(s string) (string, error)

Decrypt a value from a cookie to it's original string

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(value string) (string, error)

Encrypt a value for use in a cookie

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL