MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / TestEncryptDecryptAES

Function TestEncryptDecryptAES

internal/crypto/aes_test.go:11–23  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestEncryptDecryptAES(t *testing.T) {
12 key := "test-client-secret"
13 plaintext := `{"sub":"user123","roles":["admin"],"nonce":"abc"}`
14
15 encrypted, err := EncryptAES(key, plaintext)
16 require.NoError(t, err)
17 assert.NotEmpty(t, encrypted)
18 assert.NotEqual(t, plaintext, encrypted)
19
20 decrypted, err := DecryptAES(key, encrypted)
21 require.NoError(t, err)
22 assert.Equal(t, plaintext, decrypted)
23}
24
25func TestEncryptAES_DifferentNonces(t *testing.T) {
26 key := "test-key"

Callers

nothing calls this directly

Calls 2

EncryptAESFunction · 0.85
DecryptAESFunction · 0.85

Tested by

no test coverage detected