Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigDefault = Config{ Next: nil, Except: []string{"csrf_"}, Key: "", Encryptor: EncryptCookie, Decryptor: DecryptCookie, }
ConfigDefault is the default config
Functions ¶
func DecryptCookie ¶
DecryptCookie Decrypts a cookie value with specific encryption key
func EncryptCookie ¶
EncryptCookie Encrypts a cookie value with specific encryption key
Types ¶
type Config ¶
type Config struct {
// Next defines a function to skip this middleware when returned true.
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool
// Array of cookie keys that should not be encrypted.
//
// Optional. Default: []
Except []string
// Base64 encoded unique key to encode & decode cookies.
//
// Required. Key length should be 32 characters.
// You may use `encryptcookie.GenerateKey()` to generate a new key.
Key string
// Custom function to encrypt cookies.
//
// Optional. Default: EncryptCookie
Encryptor func(decryptedString, key string) (string, error)
// Custom function to decrypt cookies.
//
// Optional. Default: DecryptCookie
Decryptor func(encryptedString, key string) (string, error)
}
Config defines the config for middleware.
Click to show internal directories.
Click to hide internal directories.