private function parseHeader(string $data): array
    {
        $header = $this->decoder->jsonDecode($this->decoder->base64UrlDecode($data));

        if (! is_array($header)) {
            throw new InvalidArgumentException('Headers must be an array');
        }

        if (isset($header['enc'])) {
            throw new InvalidArgumentException('Encryption is not supported yet');
        }

        if (! isset($header['typ'])) {
            throw new InvalidArgumentException('The header "typ" must be present');
        }

        return $header;
    }