initial upload

This commit is contained in:
David Schroeder
2026-07-25 13:11:37 -05:00
commit 943ddb064f
25 changed files with 2586 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package app
import (
"strings"
"testing"
)
func TestDeploymentCodeFormatAndNormalization(t *testing.T) {
code, err := deploymentCode()
if err != nil {
t.Fatal(err)
}
if !strings.HasPrefix(code, "TAPM-") || len(code) != 16 {
t.Fatalf("unexpected code format: %q", code)
}
if got := normalizeCode(strings.ToLower(code)); got != code {
t.Fatalf("normalizeCode() = %q, want %q", got, code)
}
}
func TestSignature(t *testing.T) {
secret := []byte("01234567890123456789012345678901")
signature := signValue(secret, "state")
if !verifySignature(secret, "state", signature) {
t.Fatal("valid signature was rejected")
}
if verifySignature(secret, "different", signature) {
t.Fatal("invalid signature was accepted")
}
}