Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrCookieValueIsTooLarge = errors.New("security/cookie: value is greater than 4096") ErrCookieValueIsInvalid = errors.New("security/cookie: value is not valid") ErrCookieInvaildTimestamp = errors.New("security/cookie: timestamp is invalid") ErrCookieTimestampIsTooNew = errors.New("security/cookie: timestamp is too new") ErrCookieTimestampIsExpired = errors.New("security/cookie: timestamp expried") ErrSignVerificationIsFailed = errors.New("security/cookie: sign verification is failed") )
Cookie errors
Functions ¶
Types ¶
type Manager ¶
type Manager struct { Options *Options // contains filtered or unexported fields }
Manager struct used to manage and process secure cookie.
func NewManager ¶
NewManager method returns the new cookie manager.
func (*Manager) Decode ¶
Decode method decodes the secure cookie value.
It performs:
- Checks max cookie size i.e 4Kb
- Decodes the value using Base64
- Validates the signed data
- Validates timestamp
- Decodes the value using Base64
- Decrypts the value
func (*Manager) Encode ¶
Encode method encodes given value.
It performs:
- Encrypts it if encryption key configured
- Signs the value if sign key configured
- Encodes value into Base64 string
- Checks max cookie size i.e 4Kb
Click to show internal directories.
Click to hide internal directories.