grafana/k6 · error

not a Crypto Key Pair

Error message

not a Crypto Key Pair

What it means

Error "not a Crypto Key Pair" thrown in grafana/k6.

Source

Thrown at internal/js/modules/k6/webcrypto/key.go:92

	// `CryptoKey` type without having to cast the `Algorithm` field.
	Algorithm any `js:"algorithm"`

	// Usages holds the key usages for which this key can be used.
	Usages []CryptoKeyUsage `js:"usages"`

	// handle is an internal slot, holding the underlying key data.
	// See [specification](https://www.w3.org/TR/WebCryptoAPI/#dfnReturnLink-0).
	handle any
}

// IsKeyPair .
func (ck *CryptoKey) IsKeyPair() bool {
	return false
}

// ResolveCryptoKeyPair returns an error since the underlying type is not a CryptoKeyPair.
func (ck *CryptoKey) ResolveCryptoKeyPair() (*CryptoKeyPair, error) {
	return nil, errors.New("not a Crypto Key Pair")
}

// ResolveCryptoKey returns the underlying CryptoKey.
func (ck *CryptoKey) ResolveCryptoKey() (*CryptoKey, error) {
	return ck, nil
}

// Validate checks if the key is valid.
func (ck *CryptoKey) Validate() error {
	if ck.Type != PrivateCryptoKeyType && ck.Type != PublicCryptoKeyType && ck.Type != SecretCryptoKeyType {
		return errors.New("invalid key type")
	}

	return nil
}

var _ CryptoKeyGenerationResult = &CryptoKey{}

View on GitHub (pinned to 93accf6570)

When it happens

Trigger: Thrown at internal/js/modules/k6/webcrypto/key.go:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15). Data as JSON: /api/errors/12de0fa0696b496d. Report an issue: GitHub.