{"record":{"id":"54376863a20663f8","repo":"grafana/k6","slug":"modulus-n-is-required","errorCode":null,"errorMessage":"modulus (n) is required","messagePattern":"modulus \\(n\\) is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/jwk.go","lineNumber":313,"sourceCode":"type rsaJWK struct {\n\tKty string `json:\"kty\"`          // Key Type\n\tN   string `json:\"n\"`            // Modulus\n\tE   string `json:\"e\"`            // Exponent\n\tD   string `json:\"d,omitempty\"`  // Private exponent\n\tP   string `json:\"p,omitempty\"`  // First prime factor\n\tQ   string `json:\"q,omitempty\"`  // Second prime factor\n\tDp  string `json:\"dp,omitempty\"` // Exponent1\n\tDq  string `json:\"dq,omitempty\"` // Exponent2\n\tQi  string `json:\"qi,omitempty\"` // Coefficient\n}\n\nfunc (jwk *rsaJWK) validate() error {\n\tif jwk.Kty != \"RSA\" {\n\t\treturn fmt.Errorf(\"invalid key type: %s\", jwk.Kty)\n\t}\n\n\tif jwk.N == \"\" {\n\t\treturn errors.New(\"modulus (n) is required\")\n\t}\n\n\tif jwk.E == \"\" {\n\t\treturn errors.New(\"exponent (e) is required\")\n\t}\n\n\t// TODO: consider validating the other fields in future\n\treturn nil\n}\n\nfunc importRSAJWK(jsonKeyData []byte) (any, CryptoKeyType, int, error) {\n\tvar jwk rsaJWK\n\tif err := json.Unmarshal(jsonKeyData, &jwk); err != nil {\n\t\treturn nil, UnknownCryptoKeyType, 0, fmt.Errorf(\"failed to parse input as RSA JWK key: %w\", err)\n\t}\n\n\tif err := jwk.validate(); err != nil {\n\t\treturn nil, UnknownCryptoKeyType, 0, fmt.Errorf(\"invalid RSA JWK key: %w\", err)","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/webcrypto/jwk.go#L295-L331","documentation":"Error \"modulus (n) is required\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/jwk.go:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}