feat(14.3-01): export lagoon.GenerateAppKey

- key:generate now calls GenerateAppKey; its output is unchanged
- tools can write a fresh app.key without the check-mark decoration
- document lagoon.GenerateAppKey in the lagoon README

Claude-Session: https://claude.ai/code/session_01M8Qu9LgCKYy7iYEho52tW8
This commit is contained in:
Jakub Zych
2026-10-08 11:41:38 +02:00
parent cc7386d22e
commit ca5b2963a5
3 changed files with 33 additions and 3 deletions

View File

@@ -38,3 +38,21 @@ func TestEncryptedKeyGeneratePrints32ByteBase64(t *testing.T) {
t.Fatalf("decoded key length = %d, want 32", len(raw))
}
}
func TestGenerateAppKeyIs32ByteBase64(t *testing.T) {
a, err := GenerateAppKey()
if err != nil {
t.Fatal(err)
}
b, err := GenerateAppKey()
if err != nil {
t.Fatal(err)
}
if len(a) != 44 || a == b {
t.Fatalf("keys %q and %q: want two distinct 44-character values", a, b)
}
raw, err := base64.StdEncoding.DecodeString(a)
if err != nil || len(raw) != 32 {
t.Fatalf("key %q decodes to %d bytes, err %v", a, len(raw), err)
}
}