From de7e2b57e57c7b5ccb0787a391f10b77cc400d5b Mon Sep 17 00:00:00 2001 From: meehow Date: Mon, 30 Jan 2023 08:47:47 +0100 Subject: [PATCH] openssl rand -base64 32 (#2316) * openssl rand -base64 32 * Apply suggestions from code review --------- Co-authored-by: RW --- middleware/encryptcookie/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/middleware/encryptcookie/README.md b/middleware/encryptcookie/README.md index 7f0f5edf3f..94cb7fc836 100644 --- a/middleware/encryptcookie/README.md +++ b/middleware/encryptcookie/README.md @@ -69,8 +69,8 @@ type Config struct { // 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. + // Required. The key should be 32 bytes of random data in base64-encoded form. + // You may run `openssl rand -base64 32` or use `encryptcookie.GenerateKey()` to generate a new key. Key string // Custom function to encrypt cookies. @@ -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", @@ -110,4 +110,4 @@ app.Use(csrf.New(csrf.Config{ CookieName: "csrf_1", CookieHTTPOnly: true, })) -``` \ No newline at end of file +```