[ci skip] more codex 5.3 improvements

This commit is contained in:
2026-02-06 15:17:38 +11:00
parent dc96431f06
commit dfbaacb6f3
16 changed files with 297 additions and 75 deletions

View File

@@ -0,0 +1,27 @@
package secrets
import (
"encoding/base64"
"io"
"log/slog"
"strings"
"testing"
)
func testLogger() *slog.Logger {
return slog.New(slog.NewTextHandler(io.Discard, nil))
}
func TestDecryptRejectsShortCiphertext(t *testing.T) {
key := []byte("0123456789abcdef0123456789abcdef")
s := New(testLogger(), key)
encoded := base64.StdEncoding.EncodeToString([]byte{1, 2, 3})
_, err := s.Decrypt(encoded)
if err == nil {
t.Fatal("expected error for short ciphertext, got nil")
}
if !strings.Contains(err.Error(), "ciphertext is too short") {
t.Fatalf("unexpected error: %v", err)
}
}