<commit_before>"""Let's Encrypt client interfaces."""
import zope.interface

# pylint: disable=no-self-argument,no-method-argument


class IAuthenticator(zope.interface.Interface):
    """Generic Let's Encrypt Authenticator.

    Class represents all possible tools processes that have the
    ability to perform challenges and attain a certificate.

    """
    def get_chall_pref(domain):
        """Return list of challenge preferences.

        :param str domain: Domain for which challenge preferences are sought.

        :returns: list of strings with the most preferred challenges first.
        :rtype: list

        """
    def perform(chall_list):
        """Perform the given challenge.

        :param list chall_list: List of challenge types defined in client.py

        :returns: List of responses
            If the challenge cant be completed...
            None - Authenticator can perform challenge, but can't at this time
            False - Authenticator will never be able to perform (error)
        :rtype: `list` of dicts

        """
    def cleanup(chall_list):
        """Revert changes and shutdown after challenges complete."""


class IChallenge(zope.interface.Interface):
    """Let's Encrypt challenge."""

    def perform():
        """Perform the challenge."""

    def generate_response():
        """Generate response."""

    def cleanup():
        """Cleanup."""


class IInstaller(zope.interface.Interface):
    """Generic Let's Encrypt Installer Interface.

    Represents any server that an X509 certificate can be placed.

    """
    def get_all_names():
        """Returns all names that may be authenticated."""

    def deploy_cert(domain, cert, key, cert_chain=None):
        """Deploy certificate.

        :param str domain: domain to deploy certificate
        :param str cert: certificate filename
        :param str key: private key filename

        """

    # def choose_virtual_host(domain):
    #    """Chooses a virtual host based on a given domain name."""

    # def enable_redirect(ssl_vhost):
    #    """Redirect all traffic to the given ssl_vhost (port 80 => 443)."""

    # def enable_hsts(ssl_vhost):
    #    """Enable HSTS on the given ssl_vhost."""

    # def enable_ocsp_stapling(ssl_vhost):
    #    """Enable OCSP stapling on given ssl_vhost."""

    def enhance(domain, enhancment, options=None):
        """Peform a configuration enhancment.

        :param str domain: domain for which to provide enhancement
        :param str enhancement: An enhancement as defined in CONFIG.ENHANCEMENTS
        :param options: flexible options parameter for enhancement
        :type options: Check documentation of
            :class:`letsencrypt.client.CONFIG.ENHANCEMENTS` for expected options
            for each enhancement.

        """

    def supported_enhancements():
        """Returns a list of supported enhancments.

        :returns: supported enhancments which should be a subset of the
        enhancments in :class:`letsencrypt.client.CONFIG.ENHANCEMENTS`
        :rtype: `list` of `str`

        """

    def get_all_certs_keys():
        """Retrieve all certs and keys set in configuration.

        :returns: list of tuples with form [(cert, key, path)]
            cert - str path to certificate file
            key - str path to associated key file
            path - file path to configuration file
        :rtype: list

        """

    # def enable_site(vhost):
    #     """Enable the site at the given vhost.

    #     :param vhost: domain 

    #     """

    def save(title=None, temporary=False):
        """Saves all changes to the configuration files.

        Both title and temporary are needed because a save may be
        intended to be permanent, but the save is not ready to be a full
        checkpoint

        :param str title: The title of the save. If a title is given, the
            configuration will be saved as a new checkpoint and put in a
            timestamped directory. `title` has no effect if temporary is true.

        :param bool temporary: Indicates whether the changes made will
            be quickly reversed in the future (challenges)

        """

    def rollback_checkpoints(rollback=1):
        """Revert `rollback` number of configuration checkpoints."""

    def view_config_changes():
        """Display all of the LE config changes."""

    def config_test():
        """Make sure the configuration is valid."""

    def restart():
        """Restart or refresh the server content."""


class IDisplay(zope.interface.Interface):
    """Generic display."""

    def generic_notification(message):
        pass

    def generic_menu(message, choices, input_text=""):
        pass

    def generic_input(message):
        pass

    def generic_yesno(message, yes_label="Yes", no_label="No"):
        pass

    def filter_names(names):
        pass

    def success_installation(domains):
        pass

    def display_certs(certs):
        pass

    def confirm_revocation(cert):
        pass

    def more_info_cert(cert):
        pass

    def redirect_by_default():
        pass


class IValidator(object):
    """Configuration validator."""

    def redirect(name):
        pass

    def ocsp_stapling(name):
        pass

    def https(names):
        pass

    def hsts(name):
        pass<commit_msg>update interface documentation<commit_after>"""Let's Encrypt client interfaces."""
import zope.interface

# pylint: disable=no-self-argument,no-method-argument,no-init


class IAuthenticator(zope.interface.Interface):
    """Generic Let's Encrypt Authenticator.

    Class represents all possible tools processes that have the
    ability to perform challenges and attain a certificate.

    """
    def get_chall_pref(domain):
        """Return list of challenge preferences.

        :param str domain: Domain for which challenge preferences are sought.

        :returns: list of strings with the most preferred challenges first.
        :rtype: list

        """
    def perform(chall_list):
        """Perform the given challenge.

        :param list chall_list: List of challenge types defined in client.py

        :returns: List of responses
            If the challenge cant be completed...
            None - Authenticator can perform challenge, but can't at this time
            False - Authenticator will never be able to perform (error)
        :rtype: `list` of dicts

        """
    def cleanup(chall_list):
        """Revert changes and shutdown after challenges complete."""


class IChallenge(zope.interface.Interface):
    """Let's Encrypt challenge."""

    def perform():
        """Perform the challenge."""

    def generate_response():
        """Generate response."""

    def cleanup():
        """Cleanup."""


class IInstaller(zope.interface.Interface):
    """Generic Let's Encrypt Installer Interface.

    Represents any server that an X509 certificate can be placed.

    """
    def get_all_names():
        """Returns all names that may be authenticated."""

    def deploy_cert(domain, cert, key, cert_chain=None):
        """Deploy certificate.

        :param str domain: domain to deploy certificate
        :param str cert: certificate filename
        :param str key: private key filename

        """

    # def choose_virtual_host(domain):
    #    """Chooses a virtual host based on a given domain name."""

    # def enable_redirect(ssl_vhost):
    #    """Redirect all traffic to the given ssl_vhost (port 80 => 443)."""

    # def enable_hsts(ssl_vhost):
    #    """Enable HSTS on the given ssl_vhost."""

    # def enable_ocsp_stapling(ssl_vhost):
    #    """Enable OCSP stapling on given ssl_vhost."""

    def enhance(domain, enhancment, options=None):
        """Peform a configuration enhancment.

        :param str domain: domain for which to provide enhancement
        :param str enhancement: An enhancement as defined in CONFIG.ENHANCEMENTS
        :param options: flexible options parameter for enhancement
        :type options: Check documentation of
            :class:`letsencrypt.client.CONFIG.ENHANCEMENTS` for expected options
            for each enhancement.

        """

    def supported_enhancements():
        """Returns a list of supported enhancments.

        :returns: supported enhancments which should be a subset of the
        enhancments in :class:`letsencrypt.client.CONFIG.ENHANCEMENTS`
        :rtype: `list` of `str`

        """

    def get_all_certs_keys():
        """Retrieve all certs and keys set in configuration.

        :returns: list of tuples with form [(cert, key, path)]
            cert - str path to certificate file
            key - str path to associated key file
            path - file path to configuration file
        :rtype: list

        """

    # def enable_site(vhost):
    #     """Enable the site at the given vhost.

    #     :param vhost: domain 

    #     """

    def save(title=None, temporary=False):
        """Saves all changes to the configuration files.

        Both title and temporary are needed because a save may be
        intended to be permanent, but the save is not ready to be a full
        checkpoint

        :param str title: The title of the save. If a title is given, the
            configuration will be saved as a new checkpoint and put in a
            timestamped directory. `title` has no effect if temporary is true.

        :param bool temporary: Indicates whether the changes made will
            be quickly reversed in the future (challenges)

        """
    def rollback_checkpoints(rollback=1):
        """Revert `rollback` number of configuration checkpoints."""

    def view_config_changes():
        """Display all of the LE config changes."""

    def config_test():
        """Make sure the configuration is valid."""

    def restart():
        """Restart or refresh the server content."""


class IDisplay(zope.interface.Interface):
    """Generic display."""

    def generic_notification(message):
        """Displays a string message

        :param str message: Message to display

        """
    def generic_menu(message, choices, input_text=""):
        """Displays a generic menu.

        :param str message: message to display
        :param tup choices: choices formated as a `list` of `tup`
        :param str input_text: instructions on how to make a selection

        """
    def generic_input(message):
        """Accept input from the user."""

    def generic_yesno(message, yes_label="Yes", no_label="No"):
        """A yes/no dialog."""

    def filter_names(names):
        """Allow the user to select which names they would like to activate."""

    def success_installation(domains):
        """Display a congratulations message for new https domains."""

    def display_certs(certs):
        """Display a list of certificates."""

    def confirm_revocation(cert):
        """Confirmation of revocation screen."""

    def more_info_cert(cert):
        """Print out all information for a given certificate dict."""

    def redirect_by_default():
        """Ask the user whether they would like to redirect to HTTPS."""


class IValidator(object):
    """Configuration validator."""

    def redirect(name):
        """Verify redirect to HTTPS."""

    def ocsp_stapling(name):
        """Verify ocsp stapling for domain."""

    def https(names):
        """Verifiy HTTPS is enabled for domain."""

    def hsts(name):
        """Verify HSTS header is enabled."""
{'fraction_non_alphanumeric': 0.09126466753585398, 'fraction_numerical': 0.0015645371577574967, 'mean_word_length': 2.5688585607940446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7127804', 'n_tokens_mistral': 3073, 'n_tokens_neox': 2886, 'n_words': 1150}