diff --git a/docs/api/client/configurator.rst b/docs/api/client/configurator.rst deleted file mode 100644 index 7331f35ec..000000000 --- a/docs/api/client/configurator.rst +++ /dev/null @@ -1,5 +0,0 @@ -:mod:`letsencrypt.client.configurator` --------------------------------------- - -.. automodule:: letsencrypt.client.configurator - :members: diff --git a/docs/api/client/interfaces.rst b/docs/api/client/interfaces.rst new file mode 100644 index 000000000..e14daed7f --- /dev/null +++ b/docs/api/client/interfaces.rst @@ -0,0 +1,5 @@ +:mod:`letsencrypt.client.interfaces` +------------------------------------ + +.. automodule:: letsencrypt.client.interfaces + :members: diff --git a/docs/api/client/validator.rst b/docs/api/client/validator.rst deleted file mode 100644 index 7f990e2a4..000000000 --- a/docs/api/client/validator.rst +++ /dev/null @@ -1,5 +0,0 @@ -:mod:`letsencrypt.client.validator` ------------------------------------ - -.. automodule:: letsencrypt.client.validator - :members: diff --git a/letsencrypt/client/challenge.py b/letsencrypt/client/challenge.py index 44aabcda4..b2eb33c53 100644 --- a/letsencrypt/client/challenge.py +++ b/letsencrypt/client/challenge.py @@ -5,29 +5,6 @@ import sys from letsencrypt.client import CONFIG -class Challenge(object): - """Let's Encrypt challenge.""" - - def __init__(self, configurator): - self.config = configurator - - def perform(self, quiet=True): - """Perform the challange. - - :param bool quiet: TODO - - """ - raise NotImplementedError() - - def generate_response(self): - """Generate response.""" - raise NotImplementedError() - - def cleanup(self): - """Cleanup.""" - raise NotImplementedError() - - def gen_challenge_path(challenges, combos=None): """Generate a plan to get authority over the identity. @@ -101,13 +78,13 @@ def _find_smart_path(challenges, combos): def _find_dumb_path(challenges): - """Find challange path without server hints. + """Find challenge path without server hints. Should be called if the combinations hint is not included by the server. This function returns the best path that does not contain multiple mutually exclusive challenges. - :param list challanges: A list of challenges from ACME "challenge" + :param list challenges: A list of challenges from ACME "challenge" server message to be fulfilled by the client in order to prove possession of the identifier. diff --git a/letsencrypt/client/interactive_challenge.py b/letsencrypt/client/interactive_challenge.py index 4f93f1e4f..c802ca191 100644 --- a/letsencrypt/client/interactive_challenge.py +++ b/letsencrypt/client/interactive_challenge.py @@ -1,12 +1,13 @@ import textwrap import dialog +import zope.interface -from letsencrypt.client import challenge +from letsencrypt.client import interfaces -class InteractiveChallenge(challenge.Challenge): - """Interactive challange. +class InteractiveChallenge(object): + """Interactive challenge. Interactive challenge displays the string sent by the CA formatted to fit on the screen of the client. The Challenge also adds proper @@ -14,9 +15,12 @@ class InteractiveChallenge(challenge.Challenge): process. """ + zope.interface.implements(interfaces.IChallenge) + BOX_SIZE = 70 def __init__(self, string): + super(InteractiveChallenge, self).__init__() self.string = string def perform(self, quiet=True): diff --git a/letsencrypt/client/interfaces.py b/letsencrypt/client/interfaces.py index 06bb5e83e..3bdaace7f 100644 --- a/letsencrypt/client/interfaces.py +++ b/letsencrypt/client/interfaces.py @@ -1,6 +1,8 @@ -"""Interfaces.""" +"""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. @@ -16,6 +18,23 @@ class IAuthenticator(zope.interface.Interface): """Revert changes and shutdown after challenges complete.""" +class IChallenge(zope.interface.Interface): + """Let's Encrypt challenge.""" + + def perform(quiet=True): + """Perform the challenge. + + :param bool quiet: TODO + + """ + + def generate_response(): + """Generate response.""" + + def cleanup(): + """Cleanup.""" + + class IInstaller(zope.interface.Interface): """Generic Let's Encrypt Installer Interface. @@ -89,3 +108,19 @@ class IInstaller(zope.interface.Interface): def restart(): """Restart or refresh the server content.""" + + +class IValidator(object): + """Configuration validator.""" + + def redirect(name): + pass + + def ocsp_stapling(name): + pass + + def https(names): + pass + + def hsts(name): + pass diff --git a/letsencrypt/client/recovery_contact_challenge.py b/letsencrypt/client/recovery_contact_challenge.py index 6b8f23e91..d5cd5f889 100644 --- a/letsencrypt/client/recovery_contact_challenge.py +++ b/letsencrypt/client/recovery_contact_challenge.py @@ -8,19 +8,22 @@ import time import dialog import requests +import zope.interface -from letsencrypt.client import challenge +from letsencrypt.client import interfaces -class RecoveryContact(challenge.Challenge): - """Recovery Contact Identitifier Validation Challange. +class RecoveryContact(object): + """Recovery Contact Identitifier Validation Challenge. Based on draft-barnes-acme, section 6.3. """ + zope.interface.implements(interfaces.IChallenge) def __init__(self, activation_url="", success_url="", contact="", poll_delay=3): + super(RecoveryContact, self).__init__() self.token = "" self.activation_url = activation_url self.success_url = success_url diff --git a/letsencrypt/client/recovery_token_challenge.py b/letsencrypt/client/recovery_token_challenge.py index 56d401dad..abe8789b7 100644 --- a/letsencrypt/client/recovery_token_challenge.py +++ b/letsencrypt/client/recovery_token_challenge.py @@ -3,19 +3,22 @@ .. note:: This challenge has not been implemented into the project yet """ -from letsencrypt.client import challenge +import zope.interface + from letsencrypt.client import display +from letsencrypt.client import interfaces -class RecoveryToken(challenge.Challenge): +class RecoveryToken(object): """Recovery Token Identifier Validation Challenge. Based on draft-barnes-acme, section 6.4. """ + zope.interface.implements(interfaces.IChallenge) - def __init__(self, configurator): - super(RecoveryToken, self).__init__(configurator) + def __init__(self): + super(RecoveryToken, self).__init__() self.token = "" def perform(self, quiet=True): diff --git a/letsencrypt/client/validator.py b/letsencrypt/client/validator.py deleted file mode 100644 index 716d1528f..000000000 --- a/letsencrypt/client/validator.py +++ /dev/null @@ -1,14 +0,0 @@ -class Validator(object): - """Configuration validator.""" - - def redirect(self, name): - raise NotImplementedError() - - def ocsp_stapling(self, name): - raise NotImplementedError() - - def https(self, names): - raise NotImplementedError() - - def hsts(self, name): - raise NotImplementedError()