{"record":{"id":"0e0bf934ee8231ca","repo":"grafana/k6","slug":"invalid-ec-jwk-key-w","errorCode":null,"errorMessage":"invalid EC JWK key: %w","messagePattern":"invalid EC JWK key: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/jwk.go","lineNumber":229,"sourceCode":"\n\texported.Set(\"x\", base64URLEncode(x.Bytes()))\n\texported.Set(\"y\", base64URLEncode(y.Bytes()))\n\n\tif d != nil {\n\t\texported.Set(\"d\", encodeCurveBigInt(d, curveBits))\n\t}\n\n\treturn exported, nil\n}\n\nfunc importECDSAJWK(_ EllipticCurveKind, jsonKeyData []byte) (any, CryptoKeyType, error) {\n\tvar jwkKey ecJWK\n\tif err := json.Unmarshal(jsonKeyData, &jwkKey); err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to parse input as EC JWK key: %w\", err)\n\t}\n\n\tif err := jwkKey.validate(); err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"invalid EC JWK key: %w\", err)\n\t}\n\n\tcrv, err := pickEllipticCurve(jwkKey.Crv)\n\tif err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to parse elliptic curve: %w\", err)\n\t}\n\n\tx, err := base64URLDecode(jwkKey.X)\n\tif err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to decode X coordinate: %w\", err)\n\t}\n\n\ty, err := base64URLDecode(jwkKey.Y)\n\tif err != nil {\n\t\treturn nil, UnknownCryptoKeyType, fmt.Errorf(\"failed to decode Y coordinate: %w\", err)\n\t}\n\n\tpk := &ecdsa.PublicKey{","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/webcrypto/jwk.go#L211-L247","documentation":"Returned by importECDSAJWK when the input parsed as JSON but failed the ecJWK semantic validation — e.g. `kty` is not \"EC\", or required coordinate fields (`x`, `y`) are missing/empty. The wrapped error identifies the first failed check. Distinct from a JSON syntax failure, which produces the 'failed to parse input' error instead.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/jwk.go:228 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the JWK has \"kty\":\"EC\" plus non-empty base64url-encoded \"x\" and \"y\" coordinates","Include \"d\" only when importing a private key"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}