public function thumbprint(string $hash_algorithm): string
    {
        if (!\in_array($hash_algorithm, \hash_algos(), true)) {
            throw new \InvalidArgumentException(\sprintf('The hash algorithm "%s" is not supported.', $hash_algorithm));
        }

        $values = \array_intersect_key($this->values, \array_flip(['kty', 'n', 'e', 'crv', 'x', 'y', 'k']));
        \ksort($values);
        $input = \json_encode($values, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

        return Base64Url::encode(\hash($hash_algorithm, $input, true));
    }