PHP 7.4.33
Preview: achallenges.py Size: 1.62 KB
//usr/lib/python3/dist-packages/certbot/achallenges.py
"""Client annotated ACME challenges.

Please use names such as ``achall`` to distinguish from variables "of type"
:class:`acme.challenges.Challenge` (denoted by ``chall``)
and :class:`.ChallengeBody` (denoted by ``challb``)::

  from acme import challenges
  from acme import messages
  from certbot import achallenges

  chall = challenges.DNS(token='foo')
  challb = messages.ChallengeBody(chall=chall)
  achall = achallenges.DNS(chall=challb, domain='example.com')

Note, that all annotated challenges act as a proxy objects::

  achall.token == challb.token

"""
import logging
from typing import Type

import josepy as jose

from acme import challenges
from acme.challenges import Challenge

logger = logging.getLogger(__name__)


class AnnotatedChallenge(jose.ImmutableMap):
    """Client annotated challenge.

    Wraps around server provided challenge and annotates with data
    useful for the client.

    :ivar ~.challb: Wrapped `~.ChallengeBody`.

    """
    __slots__ = ('challb',)
    _acme_type: Type[Challenge] = NotImplemented

    def __getattr__(self, name):
        return getattr(self.challb, name)


class KeyAuthorizationAnnotatedChallenge(AnnotatedChallenge):
    """Client annotated `KeyAuthorizationChallenge` challenge."""
    __slots__ = ('challb', 'domain', 'account_key')

    def response_and_validation(self, *args, **kwargs):
        """Generate response and validation."""
        return self.challb.chall.response_and_validation(
            self.account_key, *args, **kwargs)


class DNS(AnnotatedChallenge):
    """Client annotated "dns" ACME challenge."""
    __slots__ = ('challb', 'domain')
    acme_type = challenges.DNS

Directory Contents

Dirs: 6 × Files: 11
Name Size Perms Modified Actions
compat DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
display DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
plugins DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
tests DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
_internal DIR
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
- drwxr-xr-x 2023-04-05 06:35:49
Edit Download
1.62 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
10.18 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
23.83 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
2.53 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
16.59 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
405 B lrw-r--r-- 2021-11-02 21:27:18
Edit Download
14.58 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
21.15 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
424 B lrw-r--r-- 2021-11-02 21:27:18
Edit Download
20.31 KB lrw-r--r-- 2021-11-02 21:27:18
Edit Download
113 B lrw-r--r-- 2021-11-02 21:27:19
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).