{"record":{"id":"2f548da846e1f366","repo":"grafana/k6","slug":"invalid-key-type","errorCode":null,"errorMessage":"invalid key type","messagePattern":"invalid key type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/webcrypto/key.go","lineNumber":103,"sourceCode":"// IsKeyPair .\nfunc (ck *CryptoKey) IsKeyPair() bool {\n\treturn false\n}\n\n// ResolveCryptoKeyPair returns an error since the underlying type is not a CryptoKeyPair.\nfunc (ck *CryptoKey) ResolveCryptoKeyPair() (*CryptoKeyPair, error) {\n\treturn nil, errors.New(\"not a Crypto Key Pair\")\n}\n\n// ResolveCryptoKey returns the underlying CryptoKey.\nfunc (ck *CryptoKey) ResolveCryptoKey() (*CryptoKey, error) {\n\treturn ck, nil\n}\n\n// Validate checks if the key is valid.\nfunc (ck *CryptoKey) Validate() error {\n\tif ck.Type != PrivateCryptoKeyType && ck.Type != PublicCryptoKeyType && ck.Type != SecretCryptoKeyType {\n\t\treturn errors.New(\"invalid key type\")\n\t}\n\n\treturn nil\n}\n\nvar _ CryptoKeyGenerationResult = &CryptoKey{}\n\n// ContainsUsage returns true if the key contains the specified usage.\nfunc (ck *CryptoKey) ContainsUsage(usage CryptoKeyUsage) bool {\n\treturn slices.Contains(ck.Usages, usage)\n}\n\n// CryptoKeyType represents the type of a key.\n//\n// Note that it is defined as an alias of string, instead of a dedicated type,\n// to ensure it is handled as a string by sobek.\ntype CryptoKeyType = string\n","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/webcrypto/key.go#L85-L121","documentation":"Error \"invalid key type\" thrown in grafana/k6.","triggerScenarios":"Thrown at internal/js/modules/k6/webcrypto/key.go:103 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-16T03:17:38.424Z"}