def key_gen(self, key_name, type, size=2048, **kwargs):
        """Adds a new public key that can be used for name_publish.

        .. code-block:: python

            >>> c.key_gen('example_key_name')
            {'Name': 'example_key_name',
             'Id': 'QmQLaT5ZrCfSkXTH6rUKtVidcxj8jrW3X2h75Lug1AV7g8'}

        Parameters
        ----------
        key_name : str
            Name of the new Key to be generated. Used to reference the Keys.
        type : str
            Type of key to generate. The current possible keys types are:

             * ``"rsa"``
             * ``"ed25519"``
        size : int
            Bitsize of key to generate

        Returns
        -------
            dict : Key name and Key Id
        """

        opts = {"type": type, "size": size}
        kwargs.setdefault("opts", opts)
        args = (key_name,)

        return self._client.request('/key/gen', args,
                                    decoder='json', **kwargs)
Adds a new public key that can be used for name_publish.

        .. code-block:: python

            >>> c.key_gen('example_key_name')
            {'Name': 'example_key_name',
             'Id': 'QmQLaT5ZrCfSkXTH6rUKtVidcxj8jrW3X2h75Lug1AV7g8'}

        Parameters
        ----------
        key_name : str
            Name of the new Key to be generated. Used to reference the Keys.
        type : str
            Type of key to generate. The current possible keys types are:

             * ``"rsa"``
             * ``"ed25519"``
        size : int
            Bitsize of key to generate

        Returns
        -------
            dict : Key name and Key Id