RC-1
release-tag / release-image (push) Failing after 1m18s

This commit is contained in:
2026-08-10 05:48:55 +02:00
parent 4f0ac14c49
commit 005fd6ca51
52 changed files with 9020 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
package server
import (
"net/http/httptest"
"strings"
"testing"
"neuralhunt/internal/auth"
)
func TestDecodeAuthAcceptsExtraJWKMembers(t *testing.T) {
body := `{"public_jwk":{"kty":"EC","crv":"P-256","x":"abc","y":"def","ext":true,"key_ops":["verify"],"alg":"ES256","use":"sig","kid":"browser-key","vendor_future_field":"ok"}}`
req := httptest.NewRequest("POST", "/api/auth/challenge", strings.NewReader(body))
var in struct {
PublicJWK auth.PublicJWK `json:"public_jwk"`
}
if err := decodeAuth(req, &in); err != nil {
t.Fatalf("decodeAuth should tolerate optional/unknown JWK metadata: %v", err)
}
if in.PublicJWK.Kty != "EC" || in.PublicJWK.Crv != "P-256" || in.PublicJWK.X != "abc" || in.PublicJWK.Y != "def" {
t.Fatalf("core JWK fields were not decoded: %+v", in.PublicJWK)
}
}
func TestDecodeAuthRejectsSecondJSONValue(t *testing.T) {
req := httptest.NewRequest("POST", "/api/auth/challenge", strings.NewReader(`{"public_jwk":{}} {"x":1}`))
var in any
if err := decodeAuth(req, &in); err == nil {
t.Fatal("expected second JSON value to be rejected")
}
}