{"record":{"id":"8812f040fc75ef74","repo":"grafana/k6","slug":"unsupported-algorithm-v","errorCode":null,"errorMessage":"unsupported algorithm: %v","messagePattern":"unsupported algorithm: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/jwk.go","lineNumber":109,"sourceCode":"}\n\nfunc extractAlg(inAlg any, keyLen int) (string, error) {\n\tswitch alg := inAlg.(type) {\n\tcase hasHash:\n\t\tv := alg.hash()\n\t\tif len(v) < 4 {\n\t\t\treturn \"\", errors.New(\"length of hash algorithm is less than 4: \" + v)\n\t\t}\n\t\treturn \"HS\" + v[4:], nil\n\tcase hasAlg:\n\t\tv := alg.alg()\n\t\tif len(v) < 4 {\n\t\t\treturn \"\", errors.New(\"length of named algorithm is less than 4: \" + v)\n\t\t}\n\n\t\treturn fmt.Sprintf(\"A%d%s\", (8 * keyLen), v[4:]), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported algorithm: %v\", inAlg)\n\t}\n}\n\n// ecJWK represents an EC JWK key.\n// It is used to unmarshal ECDSA and ECDH keys to and from JWK format.\ntype ecJWK struct {\n\t// Key type\n\tKty string `json:\"kty\"`\n\t// Canonical Curve\n\tCrv string `json:\"crv\"`\n\t// X coordinate\n\tX string `json:\"x\"`\n\t// Y coordinate\n\tY string `json:\"y\"`\n\t// Private scalar\n\tD string `json:\"d\"`\n}\n","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/webcrypto/jwk.go#L91-L127","documentation":"Returned by extractAlg when the object held in the CryptoKey's Algorithm field implements neither the hasHash interface (HMAC-style, exposing a hash name) nor the hasAlg interface (AES-style, exposing an algorithm name). I.e. the key's algorithm is of an unrecognized Go type, so no JWK `alg` string (HS*/A*) can be derived for export. Fires during symmetric key JWK export.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/jwk.go:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create keys with supported algorithms: HMAC, AES-GCM, AES-CBC, AES-CTR, or AES-KW","Use raw or AESJWK import formats that construct a proper algorithm object instead of hand-crafted ones"],"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"}