
    M/ef                     z   d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ ddlmZ ddlmZ ddlmZ dZi ddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?	Zi ej5                         D  ci c]  \  } }e| z   | c}} Zd@edAefdBZ G dC dDej>                  e      Z  G dE dFe       Z! e!d(      Z" e!dG      Z# G dH dIejH                        Z% G dJ dKejH                  ejL                        Z& G dL dMe       Z' e'dN      Z( e'dO      Z) e'dP      Z* e'dQ      Z+ e'dR      Z, e'dS      Z- e'dT      Z. e'dU      Z/ G dV dWej>                        Z0 G dX dYejH                        Z1 G dZ d[e1      Z2 G d\ d]ejH                        Z3 G d^ d_      Z4 ed`dab      Z5 G dc dae3      Z6 G dd dee6      Z7 G df dge6      Z8 G dh die2      Z9 G dj dke3      Z: G dl dme1      Z; G dn doe3      Z< G dp dqe<      Z= G dr dse<      Z> G dt due2      Z? G dv dwejH                        Z@ G dx dye2      ZA G dz d{ejH                        ZB G d| d}e3      ZC G d~ de2      ZD G d deC      ZEyc c}} w )zACME protocol messages.    )HashableN)Any)Dict)Iterator)List)Mapping)MutableMapping)Optional)Tuple)Type)TypeVar)
challenges)errors)fields)jws)utilzurn:ietf:params:acme:error:accountDoesNotExistz4The request specified an account that does not existalreadyRevokedzOThe request specified a certificate to be revoked that has already been revokedbadCSRz2The CSR is unacceptable (e.g., due to a short key)badNoncez1The client sent an unacceptable anti-replay noncebadPublicKeyz>The JWS was signed by a public key the server does not supportbadRevocationReasonz;The revocation reason provided is not allowed by the serverbadSignatureAlgorithmz@The JWS was signed with an algorithm the server does not supportcaaz\Certification Authority Authorization (CAA) records forbid the CA from issuing a certificatecompoundzBSpecific error conditions are indicated in the "subproblems" array
connectionz?The server could not connect to the client to verify the domaindnszAThere was a problem with a DNS query during identifier validationdnssecz4The server could not validate a DNSSEC signed domainincorrectResponsez;Response received didn't match the challenge's requirementsinvalidEmailz1The provided email for a registration was invalidinvalidContactz$The provided contact URI was invalid	malformedz!The request message was malformedrejectedIdentifierz9The server will not issue certificates for the identifierzLThe request attempted to finalize an order that is not ready to be finalizedz,There were too many requests of a given typez(The server experienced an internal errorz=The server experienced a TLS error during domain verificationz)The client lacks sufficient authorizationz@A contact URL for an account used an unsupported protocol schemez*The server could not resolve a domain namez'An identifier is of an unsupported typez,The server requires external account binding)	orderNotReadyrateLimitedserverInternaltlsunauthorizedunsupportedContactunknownHostunsupportedIdentifierexternalAccountRequirederrreturnc                 `    t        | t              r| j                  t        | j                  v S y)z#Check if argument is an ACME error.F)
isinstanceErrortypERROR_PREFIX)r-   s    //usr/lib/python3/dist-packages/acme/messages.pyis_acme_errorr5   @   s'    #u377#6sww&&    c                        e Zd ZU dZdZeZeed f   e	d<   deddf fdZ
defdZed	edd fd
       ZdefdZdedefdZdefdZ xZS )	_ConstantzACME constant.namePOSSIBLE_NAMESr:   r.   Nc                 N    t         |           | | j                  |<   || _        y N)super__init__r;   r:   selfr:   	__class__s     r4   r?   z_Constant.__init__L   s%    $(D!	r6   c                     | j                   S r=   r9   rA   s    r4   to_partial_jsonz_Constant.to_partial_jsonQ   s    yyr6   jobjc                     || j                   vr"t        j                  | j                   d      | j                   |   S )Nz not recognized)r;   joseDeserializationError__name__clsrF   s     r4   	from_jsonz_Constant.from_jsonT   s=    s)))++s||nO,LMM!!$''r6   c                 N    | j                   j                   d| j                   dS )N())rB   rJ   r:   rD   s    r4   __repr__z_Constant.__repr__Z   s$    ..))*!DII;a88r6   otherc                 b    t        |t        |             xr |j                  | j                  k(  S r=   )r0   typer:   )rA   rR   s     r4   __eq__z_Constant.__eq__]   s%    %d,Htyy1HHr6   c                 D    t        | j                  | j                  f      S r=   )hashrB   r:   rD   s    r4   __hash__z_Constant.__hash__`   s    T^^TYY/00r6   )rJ   
__module____qualname____doc__	__slots__NotImplementedr;   r   str__annotations__r?   rE   classmethodrM   rQ   r   boolrU   intrX   __classcell__rB   s   @r4   r8   r8   G   s    I-;NDk)*;S T 
  (S ([ ( (
9# 9IC ID I1# 1r6   r8   c                   *    e Zd ZU dZi Zeeef   ed<   y)IdentifierTypezACME identifier type.r;   N	rJ   rY   rZ   r[   r;   r   r^   r8   r_    r6   r4   rf   rf   d   s    +-NDi(-r6   rf   ipc                       e Zd ZU dZ ej
                  dej                        Zee	d<    ej
                  d      Z
ee	d<   y)
IdentifierzJACME identifier.

    :ivar IdentifierType typ:
    :ivar str value:

    rT   decoderr2   valueN)rJ   rY   rZ   r[   rH   fieldrf   rM   r2   r_   rn   r^   rh   r6   r4   rk   rk   m   s;     %$**V^5M5MNCNG$E3$r6   rk   c                      e Zd ZU dZ ej
                  ddd      Zeed<    ej
                  dd      Z	eed<    ej
                  d	d      Z
eed	<    ej
                  d
ej                  d      Zed   ed
<    ej
                  dd      Zeed      ed<   ej"                  deeeef      ded   fd       Zedededd fd       Zedee   fd       Zedee   fd       ZdededdfdZdefdZy)r1   a  ACME error.

    https://datatracker.ietf.org/doc/html/rfc7807

    Note: Although Error inherits from JSONObjectWithFields, which is immutable,
    we add mutability for Error to comply with the Python exception API.

    :ivar str typ:
    :ivar str title:
    :ivar str detail:
    :ivar Identifier identifier:
    :ivar tuple subproblems: An array of ACME Errors which may be present when the CA
            returns multiple errors related to the same request, `tuple` of `Error`.

    rT   Tzabout:blank	omitemptydefaultr2   titlerr   detail
identifierrm   rr   rk   subproblems)r1   .rn   r.   c                 &    t        d | D              S )Nc              3   F   K   | ]  }t         j                  |        y wr=   )r1   rM   ).0
subproblems     r4   	<genexpr>z$Error.subproblems.<locals>.<genexpr>   s     IZU__Z0I   !tuplern   s    r4   ry   zError.subproblems   s    I5IIIr6   codekwargsc                 T    |t         vrt        d|z        t        |z   } | dd|i|S )zCreate an Error instance with an ACME Error code.

        :str code: An ACME error code, like 'dnssec'.
        :kwargs: kwargs to pass to Error.

        z4The supplied code: %s is not a known ACME error coder2   rh   )ERROR_CODES
ValueErrorr3   )rL   r   r   r2   s       r4   	with_codezError.with_code   sE     {" %'+, - -T! %s%f%%r6   c                 @    t         j                  | j                        S )zHardcoded error description based on its type.

        :returns: Description if standard ACME error or ``None``.
        :rtype: str

        )ERROR_TYPE_DESCRIPTIONSgetr2   rD   s    r4   descriptionzError.description   s     '**48844r6   c                 j    t        | j                        j                  dd      d   }|t        v r|S y)zACME error code.

        Basically self.typ without the ERROR_PREFIX.

        :returns: error code if standard ACME code or ``None``.
        :rtype: str

        :   )maxsplitN)r^   r2   rsplitr   )rA   r   s     r4   r   z
Error.code   s6     488}##C!#4R8;Kr6   r:   Nc                 0    t         j                  | ||      S r=   )object__setattr__)rA   r:   rn   s      r4   r   zError.__setattr__   s    !!$e44r6   c                 v   dj                  d | j                  | j                  | j                  | j                  fD              j                         }| j                  rd| j                  j                   d|z   }| j                  r1t        | j                        dkD  r| j                  D ]
  }|d| z  } |S )Ns    :: c              3   D   K   | ]  }||j                  dd        y w)Nasciibackslashreplaceencode)r|   parts     r4   r~   z Error.__str__.<locals>.<genexpr>   s*      !9= KK!34!s    zProblem for z: r   
)
joinr2   r   rv   rt   decoderw   rn   ry   len)rA   resultr}   s      r4   __str__zError.__str__   s     !XXt''djjA! ! "( 	 ??#DOO$9$9#:"=FFD$4$4 5 9".. ,
Bzl++,r6   )rJ   rY   rZ   r[   rH   ro   r2   r^   r_   rt   rv   rk   rM   rw   r
   ry   r   rm   r   r   r   r`   r   propertyr   r   r   r   rh   r6   r4   r1   r1   x   sh    tzz&D-HCHGt4E34$**X6FC6)3j22d*DJ& D1;MUY1ZK%-.Z J4S#X/ JE,4G J J &S &C &G & & 5Xc] 5 5 hsm  5 5C 5D 5
 
r6   r1   c                   *    e Zd ZU dZi Zeeef   ed<   y)StatuszACME "status" field.r;   Nrg   rh   r6   r4   r   r      s    +-NDi(-r6   r   unknownpending
processingvalidinvalidrevokedreadydeactivatedc                       e Zd ZdZ G d dej
                        Zdeee	f   ddfdZ
dede	fd	Zdede	fd
Zdeee	f   fdZedeee	f   dd fd       Zy)	DirectoryzmDirectory.

    Directory resources must be accessed by the exact field name in RFC8555 (section 9.7.5).
    c                   8    e Zd ZU dZ ej
                  dd      Zeed<    ej
                  dd      Z	eed<    ej
                  dd      Z
ee   ed<    ej
                  d	d      Zeed
<   deddf fdZedefd       Zdee   f fdZdedefdZ xZS )Directory.MetazDirectory Meta.termsOfServiceTru   _terms_of_servicewebsitecaaIdentitiescaa_identitiesr,   external_account_requiredr   r.   Nc                     |j                         D ci c]  \  }}| j                  |      | }}}t        |   di | y c c}}w Nrh   items_internal_namer>   r?   rA   r   kvrB   s       r4   r?   zDirectory.Meta.__init__   sF    <BLLNKDAqd))!,a/KFKG&v& L   Ac                     | j                   S )zURL for the CA TOS)r   rD   s    r4   terms_of_servicezDirectory.Meta.terms_of_service   s     )))r6   c              #   P   K   t         |          D ]  }|dk(  r|dd  n|  y w)Nr   r   r>   __iter__r@   s     r4   r   zDirectory.Meta.__iter__   s8      (* H"&*="=d12h4GHs   #&r:   c                     |dk(  rd|z   S |S )Nr   _rh   rA   r:   s     r4   r   zDirectory.Meta._internal_name   s    !%);!;3:EEr6   )rJ   rY   rZ   r[   rH   ro   r   r^   r_   r   r   r   r   ra   r   r?   r   r   r   r   r   rc   rd   s   @r4   Metar      s    !+,<!M3M!tzz)t<<$.DJJ$$OS	O*4$**5NZ^*_!4_	'S 	'T 	' 
	*c 	* 
	*	Hhsm 	H	Fs 	Fs 	Fr6   r   rF   r.   Nc                     || _         y r=   )_jobjrA   rF   s     r4   r?   zDirectory.__init__   s	    
r6   r:   c                 X    	 | |   S # t         $ r}t        t        |            d }~ww xY wr=   )KeyErrorAttributeErrorr^   )rA   r:   errors      r4   __getattr__zDirectory.__getattr__   s0    	-: 	- U,,	-s    	)$)c                 Z    	 | j                   |   S # t        $ r t        d| d      w xY w)NzDirectory field "z" not found)r   r   r   s     r4   __getitem__zDirectory.__getitem__  s=    	B::d## 	B.tfK@AA	Bs    *c                 D    t        j                  | j                  d       S )Nc                     | S r=   rh   )r   s    r4   <lambda>z+Directory.to_partial_json.<locals>.<lambda>  s    1 r6   )r   map_keysr   rD   s    r4   rE   zDirectory.to_partial_json  s    }}TZZ55r6   c                 n    | j                   j                  |j                  di             |d<    | |      S )Nmeta)r   rM   poprK   s     r4   rM   zDirectory.from_json  s/    xx))$((62*>?V4yr6   )rJ   rY   rZ   r[   rH   JSONObjectWithFieldsr   r   r^   r   r?   r   r   r   rE   r`   r	   rM   rh   r6   r4   r   r      s    
Ft(( F2WS#X. 4 - - -B B B6c3h 6 ^CH5 +  r6   r   c                   @    e Zd ZU dZ ej
                  d      Zded<   y)ResourcezOACME Resource.

    :ivar acme.messages.ResourceBody body: Resource body.

    bodyResourceBodyN)rJ   rY   rZ   r[   rH   ro   r   r_   rh   r6   r4   r   r     s    
 &4::f-D.-r6   r   c                   @    e Zd ZU dZ ej
                  d      Zeed<   y)ResourceWithURIzKACME Resource with URI.

    :ivar str uri: Location of the resource.

    uriN)	rJ   rY   rZ   r[   rH   ro   r   r^   r_   rh   r6   r4   r   r     s    
 tzz% C r6   r   c                       e Zd ZdZy)r   zACME Resource Body.NrJ   rY   rZ   r[   rh   r6   r4   r   r   '  s    r6   r   c                   T    e Zd ZdZedej                  dededede	ee
f   f
d       Zy)	ExternalAccountBindingzACME External Account Bindingaccount_public_keykidhmac_key	directoryr.   c                    t        j                  |j                               j                         }t        j
                  j                  |      }|d   }t        j                  j                  |t        j                  j                  |      t        j                  j                  d||      }|j                         S )zLCreate External Account Binding Resource from contact details, kid and hmac.
newAccount)keyN)jsondumpsrE   r   rH   b64	b64decoder   JWSsignjwkJWKOctjwaHS256)	rL   r   r   r   r   key_jsondecoded_hmac_keyurleabs	            r4   	from_dataz ExternalAccountBinding.from_data.  s    
 ::0@@BCJJL88--h7%ggll8TXX__9I_%J88>>4% ""$$r6   N)rJ   rY   rZ   r[   r`   rH   JWKr^   r   r   r   r   rh   r6   r4   r   r   +  sH    '%488 %# % %&%+/S>% %r6   r   GenericRegistrationRegistration)boundc                       e Zd ZU dZ ej
                  ddej                  j                        Zej                  e	d<    ej
                  ddd      Z
eedf   e	d<    ej
                  d	d
      Zee	d	<    ej
                  dd
      Zee	d<    ej
                  dd
      Zee	d<    ej
                  dd
      Zee	d<    ej
                  dd
      Zeeef   e	d<   dZdZe	 	 	 d$dee   dee   dee   deeeef      dedefd       Zdeddf fdZdedeedf   fdZdeeef   deeef   fdZdeeef   f fd Z deeef   f fd!Z!e"deedf   fd"       Z#e"deedf   fd#       Z$ xZ%S )%r   zRegistration Resource Body.

    :ivar jose.JWK key: Public key.
    :ivar tuple contact: Contact information following ACME spec,
        `tuple` of `str`.
    :ivar str agreement:

    r   Trr   rm   contactrh   rq   .	agreementru   statustermsOfServiceAgreedterms_of_service_agreedonlyReturnExistingonly_return_existingexternalAccountBindingexternal_account_bindingztel:zmailto:NrL   phoneemailr   r.   c                 F   d|v }t        |j                  dd            }||j                  | j                  |z          |;|j	                  |j                  d      D cg c]  }| j                  |z    c}       |s|rt        |      |d<   |r||d<    | di |S c c}w )a  
        Create registration resource from contact details.

        The `contact` keyword being passed to a Registration object is meaningful, so
        this function represents empty iterables in its kwargs by passing on an empty
        `tuple`.
        r  rh   ,r  )listr   appendphone_prefixextendsplitemail_prefixr   )rL   r  r  r  r   contact_provideddetailsmails           r4   r   zRegistration.from_data[  s     %. vzz)R01NN3++e34NNC@PQC,,t3QR & %gF9#1IF-.}V} Rs    Bc                 d    d|v r|d   t         j                  | dd       t        |   di | y)z;Note if the user provides a value for the `contact` member.r  N_add_contactTrh   )r   r   r>   r?   )rA   r   rB   s     r4   r?   zRegistration.__init__|  s7    6)#4#@t^T:"6"r6   prefixc                 @    t        fd| j                  D              S )Nc              3   \   K   | ]#  }|j                        r|t              d   % y wr=   )
startswithr   )r|   rv   r  s     r4   r~   z/Registration._filter_contact.<locals>.<genexpr>  s2      *%+  ( 3v;< *s   ),)r   r  )rA   r  s    `r4   _filter_contactzRegistration._filter_contact  s!     */3||* * 	*r6   rF   c                 H    t        | dd      r| j                  d      |d<   |S )a  
        The `contact` member of Registration objects should not be required when
        de-serializing (as it would be if the Fields' `omitempty` flag were `False`), but
        it should be included in serializations if it was provided.

        :param jobj: Dictionary containing this Registrations' data
        :type jobj: dict

        :returns: Dictionary containing Registrations data to transmit to the server
        :rtype: dict
        r  Fr  )getattrr   r   s     r4   _add_contact_if_appropriatez(Registration._add_contact_if_appropriate  s'     4/"kk)4DOr6   c                 B    t         |          }| j                  |      S )z2Modify josepy.JSONDeserializable.to_partial_json())r>   rE   r"  rA   rF   rB   s     r4   rE   zRegistration.to_partial_json  s!    w&(//55r6   c                 B    t         |          }| j                  |      S )z;Modify josepy.JSONObjectWithFields.fields_to_partial_json())r>   fields_to_partial_jsonr"  r$  s     r4   r&  z#Registration.fields_to_partial_json  s!    w-///55r6   c                 8    | j                  | j                        S )z*All phones found in the ``contact`` field.)r  r  rD   s    r4   phoneszRegistration.phones       ##D$5$566r6   c                 8    | j                  | j                        S )z*All emails found in the ``contact`` field.)r  r  rD   s    r4   emailszRegistration.emails  r)  r6   )NNN)&rJ   rY   rZ   r[   rH   ro   r   rM   r   r_   r  r   r^   r  r  r   r  ra   r	  r  r   r   r  r  r`   r   r   r
   r   r?   r  r"  rE   r&  r   r(  r+  rc   rd   s   @r4   r   r   A  s    DJJudhh>P>PQCQ  *tzz)tRPGU38_PTZZt<Is<TZZD9FF9$.DJJ/EQU$VTV!+,@D!Q$Q/9tzz:RDH0Jd38n J LLIM)-GKt/0 # !#,4T#s(^,D   %8 @# # #*c *eCHo *
S#X 4S> "6c3h 6
6S#X 6
 7c3h 7 7 7c3h 7 7r6   c                       e Zd ZdZy)NewRegistrationzNew registration.Nr   rh   r6   r4   r-  r-    s    r6   r-  c                       e Zd ZdZy)UpdateRegistrationzUpdate registration.Nr   rh   r6   r4   r/  r/    s    r6   r/  c                       e Zd ZU dZ ej
                  dej                        Zee	d<    ej
                  dd      Z
ee	d<    ej
                  dd      Zee	d<   y)	RegistrationResourcezRegistration Resource.

    :ivar acme.messages.Registration body:
    :ivar str new_authzr_uri: Deprecated. Do not use.
    :ivar str terms_of_service: URL for the CA TOS.

    r   rl   new_authzr_uriTru   r   N)rJ   rY   rZ   r[   rH   ro   r   rM   r   r_   r2  r^   r   rh   r6   r4   r1  r1    sW     $FL4J4JKD,K$$**%5FNCF&DJJ'9TJcJr6   r1  c                       e Zd ZU dZdZ ej                  ddd      Zee	d<    ej                  de
j                  de	      Ze
e	d<    ej                  d
d      Zej"                  e	d
<    ej                  dej                  dd	      Zee	d<   deddf fdZdedef fdZdeeef   f fdZedeeef   deeef   f fd       Zedefd       ZdedefdZdee   f fdZ dedefdZ! xZ"S )ChallengeBodya>  Challenge Resource Body.

    .. todo::
       Confusingly, this has a similar name to `.challenges.Challenge`,
       as well as `.achallenges.AnnotatedChallenge`. Please use names
       such as ``challb`` to distinguish instances of this class from
       ``achall``.

    :ivar acme.challenges.Challenge: Wrapped challenge.
        Conveniently, all challenge fields are proxied, i.e. you can
        call ``challb.x`` to get ``challb.chall.x`` contents.
    :ivar acme.messages.Status status:
    :ivar datetime.datetime validated:
    :ivar messages.Error error:

    )challr   TNrq   _urlr  )rm   rr   rs   	validatedru   r   r   r.   c                     |j                         D ci c]  \  }}| j                  |      | }}}t        |   di | y c c}}w r   r   r   s       r4   r?   zChallengeBody.__init__  sF    8>G1$%%a(!+GG"6" Hr   r:   c                 @    t         |   | j                  |            S r=   )r>   r   r   r@   s     r4   r   zChallengeBody.encode  s    w~d11$788r6   c                 v    t         |          }|j                  | j                  j                                |S r=   )r>   rE   updater5  r$  s     r4   rE   zChallengeBody.to_partial_json  s.    w&(DJJ..01r6   rF   c                 j    t         |   |      }t        j                  j	                  |      |d<   |S )Nr5  )r>   fields_from_jsonr   	ChallengerM   )rL   rF   jobj_fieldsrB   s      r4   r=  zChallengeBody.fields_from_json  s3    g.t4)33==dCGr6   c                     | j                   S )zThe URL of this challenge.)r6  rD   s    r4   r   zChallengeBody.uri  s     yyr6   c                 .    t        | j                  |      S r=   )r!  r5  r   s     r4   r   zChallengeBody.__getattr__  s    tzz4((r6   c              #   J   K   t         |          D ]  }|dk(  rdn|  y w)Nr6  r   r   r@   s     r4   r   zChallengeBody.__iter__  s.      G$& 	4D6>%t3	4s    #c                     |dk(  rdS |S )Nr   r6  rh   r   s     r4   r   zChallengeBody._internal_name   s    v0D0r6   )#rJ   rY   rZ   r[   r\   rH   ro   r6  r^   r_   r   rM   STATUS_PENDINGr  r   rfc3339r7  datetimer1   r   r   r?   r   r   rE   r`   r   r=  r   r   r   r   r   r   rc   rd   s   @r4   r4  r4    sQ     I
 

5D$?D#?TZZ&2B2B"&@FF @#16>>+#NIx  N4::gu!%t5E5 5# # #93 93 9c3h 
 GCH$5 $sCx.  
 S  ) ) )4(3- 413 13 1r6   r4  c                       e Zd ZU dZ ej
                  dej                        Zee	d<    ej
                  d      Z
ee	d<   edefd       Zy)ChallengeResourcezChallenge Resource.

    :ivar acme.messages.ChallengeBody body:
    :ivar str authzr_uri: URI found in the 'up' ``Link`` header.

    r   rl   
authzr_urir.   c                 .    | j                   j                  S )zThe URL of the challenge body.)r   r   rD   s    r4   r   zChallengeResource.uri  s     yy}}r6   N)rJ   rY   rZ   r[   rH   ro   r4  rM   r   r_   rI  r^   r   r   rh   r6   r4   rH  rH    sT     %$**V]5L5LMD-M djj.J.S  r6   rH  c                      e Zd ZU dZ ej
                  dej                  d      Zee	d<    ej
                  dd      Z
ee   e	d<    ej
                  ddej                        Zee	d<    ej                   d	d      Zej$                  e	d	<    ej
                  d
d      Zee	d
<   e
j*                  deeeef      deedf   fd       Z
y)AuthorizationzAuthorization Resource Body.

    :ivar acme.messages.Identifier identifier:
    :ivar list challenges: `list` of `.ChallengeBody`
    :ivar acme.messages.Status status:
    :ivar datetime.datetime expires:

    rw   Trx   r   ru   r  r  expireswildcardrn   r.   .c                 &    t        d | D              S )Nc              3   F   K   | ]  }t         j                  |        y wr=   )r4  rM   )r|   r5  s     r4   r~   z+Authorization.challenges.<locals>.<genexpr>,  s     G],,U3Gr   r   r   s    r4   r   zAuthorization.challenges*  s    GGGGr6   N)rJ   rY   rZ   r[   rH   ro   rk   rM   rw   r_   r   r   r4  r   r  r   rE  rM  rF  rN  ra   rm   r   r^   r   r   rh   r6   r4   rL  rL    s     (TZZj>R>R^bcJ
c&0djj&NJ]#NTZZD&BRBRSFFS
 "0	T!JGXJTZZ
d;Hd; H$tCH~. H59K3L H Hr6   rL  c                       e Zd ZdZy)NewAuthorizationzNew authorization.Nr   rh   r6   r4   rR  rR  /  s    r6   rR  c                       e Zd ZdZy)UpdateAuthorizationzUpdate authorization.Nr   rh   r6   r4   rT  rT  3  s    r6   rT  c                       e Zd ZU dZ ej
                  dej                        Zee	d<    ej
                  dd      Z
ee	d<   y)AuthorizationResourcez~Authorization Resource.

    :ivar acme.messages.Authorization body:
    :ivar str new_cert_uri: Deprecated. Do not use.

    r   rl   new_cert_uriTru   N)rJ   rY   rZ   r[   rH   ro   rL  rM   r   r_   rW  r^   rh   r6   r4   rV  rV  7  s=     %$**V]5L5LMD-M"

>TBL#Br6   rV  c                       e Zd ZU dZ ej
                  dej                  ej                        Zej                  e
d<   y)CertificateRequestz~ACME newOrder request.

    :ivar jose.ComparableX509 csr:
        `OpenSSL.crypto.X509Req` wrapped in `.ComparableX509`

    csrrm   encoderN)rJ   rY   rZ   r[   rH   ro   
decode_csr
encode_csrrZ  ComparableX509r_   rh   r6   r4   rY  rY  B  s3      *tzz%RVRaRabC		br6   rY  c                   x    e Zd ZU dZ ej
                  d      Zeed<    ej
                  d      Z	e
edf   ed<   y)CertificateResourcea  Certificate Resource.

    :ivar josepy.util.ComparableX509 body:
        `OpenSSL.crypto.X509` wrapped in `.ComparableX509`
    :ivar str cert_chain_uri: URI found in the 'up' ``Link`` header
    :ivar tuple authzrs: `tuple` of `AuthorizationResource`.

    cert_chain_uriauthzrs.N)rJ   rY   rZ   r[   rH   ro   rb  r^   r_   rc  r   rV  rh   r6   r4   ra  ra  L  s?     %$**%56NC61;I1FGU(#-.Fr6   ra  c                       e Zd ZU dZ ej
                  dej                  ej                        Zej                  e
d<    ej
                  d      Zee
d<   y)
RevocationzRevocation message.

    :ivar jose.ComparableX509 certificate: `OpenSSL.crypto.X509` wrapped in
        `jose.ComparableX509`

    certificater[  reasonN)rJ   rY   rZ   r[   rH   ro   decode_certencode_certrf  r_  r_   rg  rb   rh   r6   r4   re  re  Y  sP     (2tzzt//9I9I(KK$$ K$**X&FC&r6   re  c                      e Zd ZU dZ ej
                  dd      Zee   e	d<    ej
                  de
j                  d      Ze
e	d<    ej
                  dd      Zee   e	d<    ej
                  dd      Zee	d<    ej
                  d	d      Zee	d	<    ej$                  d
d      Zej(                  e	d
<    ej
                  ddej                        Zee	d<   ej.                  deeeef      deedf   fd       Zy)Ordera_  Order Resource Body.

    :ivar identifiers: List of identifiers for the certificate.
    :vartype identifiers: `list` of `.Identifier`
    :ivar acme.messages.Status status:
    :ivar authorizations: URLs of authorizations.
    :vartype authorizations: `list` of `str`
    :ivar str certificate: URL to download certificate as a fullchain PEM.
    :ivar str finalize: URL to POST to to request issuance once all
        authorizations have "valid" status.
    :ivar datetime.datetime expires: When the order expires.
    :ivar ~.Error error: Any error that occurred during finalization, if applicable.
    identifiersTru   r  rx   authorizationsrf  finalizerM  r   r  rn   r.   .c                 &    t        d | D              S )Nc              3   F   K   | ]  }t         j                  |        y wr=   )rk   rM   )r|   rw   s     r4   r~   z$Order.identifiers.<locals>.<genexpr>  s     N*Z))*5Nr   r   r   s    r4   rl  zOrder.identifiers}  s    NNNNr6   N)rJ   rY   rZ   r[   rH   ro   rl  r   rk   r_   r   rM   r  rm  r^   rf  rn  r   rE  rM  rF  r1   r   rm   r   r   r   rh   r6   r4   rk  rk  e  s
    %/DJJ}$MKj!MTZZ&2B2BdSFFS *

+;t LNDIL!tzz-4@K@DJJzT:Hc:!/	T!JGXJ4::guOE5O O4S#X/ OE*c/4J O Or6   rk  c                   x   e Zd ZU dZ ej
                  dej                        Zee	d<    ej
                  ddd d       Z
ee	d<    ej
                  d	      Zee   e	d	<    ej
                  d
d      Zee	d
<    ej
                  dd      Zee   e	d<   ej$                  deeeef      deedf   fd       Zy)OrderResourcea  Order Resource.

    :ivar acme.messages.Order body:
    :ivar bytes csr_pem: The CSR this Order will be finalized with.
    :ivar authorizations: Fully-fetched AuthorizationResource objects.
    :vartype authorizations: `list` of `acme.messages.AuthorizationResource`
    :ivar str fullchain_pem: The fetched contents of the certificate URL
        produced once the order was finalized, if it's present.
    :ivar alternative_fullchains_pem: The fetched contents of alternative certificate
        chain URLs produced once the order was finalized, if present and requested during
        finalization.
    :vartype alternative_fullchains_pem: `list` of `str`
    r   rl   csr_pemTc                 $    | j                  d      S Nzutf-8r   )ss    r4   r   zOrderResource.<lambda>      !((72C r6   c                 $    | j                  d      S ru  )r   )bs    r4   r   zOrderResource.<lambda>  rw  r6   )rr   rm   r\  rm  fullchain_pemru   alternative_fullchains_pemrn   r.   .c                 &    t        d | D              S )Nc              3   F   K   | ]  }t         j                  |        y wr=   )rV  rM   )r|   authzs     r4   r~   z/OrderResource.authorizations.<locals>.<genexpr>  s     O*44U;Or   r   r   s    r4   rm  zOrderResource.authorizations  s    OOOOr6   N)rJ   rY   rZ   r[   rH   ro   rk  rM   r   r_   rs  bytesrm  r   rV  rz  r^   r{  rm   r   r   r   rh   r6   r4   rr  rr    s     $**VU__=D%=TZZ	T )D(C	EGU 	E 3=$**=M2NND./N#OtDM3D,6DJJ7SAE-GS	 G
 Pd4S>2 Pu=RTW=W7X P Pr6   rr  c                       e Zd ZdZy)NewOrderz
New order.Nr   rh   r6   r4   r  r    s    r6   r  )Fr[   collections.abcr   rF  r   typingr   r   r   r   r   r	   r
   r   r   r   josepyrH   acmer   r   r   r   r   r3   r   r   r   BaseExceptionra   r5   JSONDeSerializabler8   rf   IDENTIFIER_FQDNIDENTIFIER_IPr   rk   r1   r   STATUS_UNKNOWNrD  STATUS_PROCESSINGSTATUS_VALIDSTATUS_INVALIDSTATUS_REVOKEDSTATUS_READYSTATUS_DEACTIVATEDr   r   r   r   r   r   r   r-  r/  r1  r4  rH  rL  rR  rT  rV  rY  ra  re  rk  rr  r  )r:   descs   00r4   <module>r     s    $        !          ,Q  B	
 C T X _ 
  T   
N D  X!$ G%& <'( 4)* U+, dA@J?\?FM=B0;0A0A0C",$L4  
}  1'' 1:.Y .
 !'t$%** %TD%%v|| Tn.Y .
 	"	"<( g	"	"gM* 4'' 4n.t(( .!h !4,, % %& 3>J j7< j7Zl  
K? 
K>1L >1B  HL H6}  -  CO Cc22 c
G/ 
G	'** 	'OL O:#PO #PLu [s   J7