Home / Function/ Test_Middleware_InvalidKeys() — fiber Function Reference

Test_Middleware_InvalidKeys() — fiber Function Reference

Architecture documentation for the Test_Middleware_InvalidKeys() function in encryptcookie_test.go from the fiber codebase.

Entity Profile

Dependency Diagram

graph TD
  18f2902d_d6b1_bfba_c349_cd26400b8dba["Test_Middleware_InvalidKeys()"]
  ac3bbef3_a1d3_d68b_64fb_619088dde10d["encryptcookie_test.go"]
  18f2902d_d6b1_bfba_c349_cd26400b8dba -->|defined in| ac3bbef3_a1d3_d68b_64fb_619088dde10d
  style 18f2902d_d6b1_bfba_c349_cd26400b8dba fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

middleware/encryptcookie/encryptcookie_test.go lines 39–72

func Test_Middleware_InvalidKeys(t *testing.T) {
	t.Parallel()
	tests := []struct {
		length int
	}{
		{length: 11},
		{length: 25},
		{length: 60},
	}

	for _, tt := range tests {
		t.Run(strconv.Itoa(tt.length)+"_length_encrypt", func(t *testing.T) {
			t.Parallel()
			key := make([]byte, tt.length)
			_, err := rand.Read(key)
			require.NoError(t, err)
			keyString := base64.StdEncoding.EncodeToString(key)

			_, err = EncryptCookie("test", "SomeThing", keyString)
			require.Error(t, err)
		})

		t.Run(strconv.Itoa(tt.length)+"_length_decrypt", func(t *testing.T) {
			t.Parallel()
			key := make([]byte, tt.length)
			_, err := rand.Read(key)
			require.NoError(t, err)
			keyString := base64.StdEncoding.EncodeToString(key)

			_, err = DecryptCookie("test", "SomeThing", keyString)
			require.Error(t, err)
		})
	}
}

Domain

Subdomains

Frequently Asked Questions

What does Test_Middleware_InvalidKeys() do?
Test_Middleware_InvalidKeys() is a function in the fiber codebase, defined in middleware/encryptcookie/encryptcookie_test.go.
Where is Test_Middleware_InvalidKeys() defined?
Test_Middleware_InvalidKeys() is defined in middleware/encryptcookie/encryptcookie_test.go at line 39.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free