Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openssl rand -base64 32 #2316

Merged
merged 2 commits into from
Jan 30, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions middleware/encryptcookie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type Config struct {
// Base64 encoded unique key to encode & decode cookies.
//
// Required. Key length should be 32 characters.
ReneWerner87 marked this conversation as resolved.
Show resolved Hide resolved
// You may use `encryptcookie.GenerateKey()` to generate a new key.
// You may run `openssl rand -base64 32` or use `encryptcookie.GenerateKey()` to generate a new key.
Key string

// Custom function to encrypt cookies.
Expand All @@ -89,7 +89,7 @@ type Config struct {

```go
// `Key` must be a 32 character string. It's used to encrpyt the values, so make sure it is random and keep it secret.
// You can call `encryptcookie.GenerateKey()` to create a random key for you.
// You can run `openssl rand -base64 32` or call `encryptcookie.GenerateKey()` to create a random key for you.
// Make sure not to set `Key` to `encryptcookie.GenerateKey()` because that will create a new key every run.
app.Use(encryptcookie.New(encryptcookie.Config{
Key: "secret-thirty-2-character-string",
Expand All @@ -110,4 +110,4 @@ app.Use(csrf.New(csrf.Config{
CookieName: "csrf_1",
CookieHTTPOnly: true,
}))
```
```