o
    6ab                     @   s  d 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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dlmZ d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/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@	ZedAdB e D ZeedCdB e D  dDedEe fdFdGZ!G dHdI dIej"ej#Z#G dJdK dKej$eZ%G dLdM 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 dVdW dWe%Z/e/d)Z0e/dXZ1G dYdZ dZej"Z2G d[d\ d\ej$Z3G d]d^ d^ej"Z4G d_d` d`e4Z5G dadb dbej"Z6G dcdd ddZ7G dedf dfe6Z8e3j9G dgdh dhee8Z:G didj djee8Z;G dkdl dle5Z<G dmdn dne6Z=G dodp dpe4Z>G dqdr dre6Z?e3j9G dsdt dtee?Z@G dudv dvee?ZAG dwdx dxe5ZBe3j9G dydz dzeej"ZCG d{d| d|e5ZDe3j9G d}d~ d~eej"ZEG dd de6ZFG dd de5ZGe3j9G dd deFZHdS )zACME protocol messages.    )HashableN)Any)Dict)Iterator)List)Mapping)MutableMapping)Tuple)Type)Optional
challenges)errors)fields)jws)util)ResourceMixinzurn:acme:error:z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externalAccountRequiredc                 c        | ]\}}t | |fV  qd S N)ERROR_PREFIX.0namedesc r4   //usr/lib/python3/dist-packages/acme/messages.py	<genexpr>;       
r6   c                 c   r-   r.   )OLD_ERROR_PREFIXr0   r4   r4   r5   r6   >   r7   errreturnc                 C   s,   t | tr| jdurt| jv pt| jv S dS )z#Check if argument is an ACME error.NF)
isinstanceErrortypr/   r8   )r9   r4   r4   r5   is_acme_errorB   s   r>   c                   @   s   e Zd ZdZejddddZejdddZejdddZe	d	e
d
edd fddZedee
 fddZedee
 fddZde
fddZdS )r<   zACME error.

    https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00

    :ivar unicode typ:
    :ivar unicode title:
    :ivar unicode detail:

    typeTzabout:blank	omitemptydefaulttitlerA   detailcodekwargsr:   c                 K   s.   |t vr
td| t| }| dd|i|S )zCreate an Error instance with an ACME Error code.

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

        z4The supplied code: %s is not a known ACME error coder=   Nr4   )ERROR_CODES
ValueErrorr/   )clsrF   rG   r=   r4   r4   r5   	with_codeW   s   zError.with_codec                 C   s   t | jS )zHardcoded error description based on its type.

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

        )ERROR_TYPE_DESCRIPTIONSgetr=   selfr4   r4   r5   descriptiong   s   zError.descriptionc                 C   s(   t | jjdddd }|tv r|S dS )zACME error code.

        Basically self.typ without the ERROR_PREFIX.

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

        :   )maxsplitN)strr=   rsplitrH   )rO   rF   r4   r4   r5   rF   q   s   
z
Error.codec                 C   s(   d dd | j| j| j| jfD  S )Ns    :: c                 s   s$    | ]}|d ur| ddV  qd S )Nasciibackslashreplace)encode)r1   partr4   r4   r5   r6      s    
z Error.__str__.<locals>.<genexpr>)joinr=   rP   rE   rC   decoderN   r4   r4   r5   __str__   s
   
zError.__str__N)__name__
__module____qualname____doc__joseFieldr=   rC   rE   classmethodrU   r   rK   propertyr   rP   rF   r]   r4   r4   r4   r5   r<   I   s    		r<   c                       s   e Zd ZU dZdZeZeed f e	d< deddf fddZ
defd	d
Zededd fddZdefddZdedefddZdefddZ  ZS )	_ConstantzACME constant.r2   POSSIBLE_NAMESr2   r:   Nc                    s   t    | | j|< || _d S r.   )super__init__rh   r2   rO   r2   	__class__r4   r5   rj      s   


z_Constant.__init__c                 C      | j S r.   rg   rN   r4   r4   r5   to_partial_json      z_Constant.to_partial_jsonjobjc                 C   s&   || j vrtd| j| j | S )Nz{0} not recognized)rh   rb   DeserializationErrorformatr^   rJ   rq   r4   r4   r5   	from_json   s
   


z_Constant.from_jsonc                 C   s   d | jj| jS )Nz{0}({1}))rs   rm   r^   r2   rN   r4   r4   r5   __repr__      z_Constant.__repr__otherc                 C   s   t |t| o|j| jkS r.   )r;   r?   r2   )rO   rx   r4   r4   r5   __eq__   s   z_Constant.__eq__c                 C   s   t | j| jfS r.   )hashrm   r2   rN   r4   r4   r5   __hash__   s   z_Constant.__hash__)r^   r_   r`   ra   	__slots__NotImplementedrh   r   rU   __annotations__rj   ro   rd   ru   rv   r   boolry   intr{   __classcell__r4   r4   rl   r5   rf      s   
 rf   c                   @   &   e Zd ZU dZi Zeed f ed< dS )StatuszACME "status" field.rh   Nr^   r_   r`   ra   rh   r   rU   r~   r4   r4   r4   r5   r         
 r   unknownpending
processingvalidinvalidrevokedreadydeactivatedc                   @   r   )IdentifierTypezACME identifier type.rh   Nr   r4   r4   r4   r5   r      r   r   ipc                   @   s*   e Zd ZdZejdejdZedZ	dS )
IdentifierzNACME identifier.

    :ivar IdentifierType typ:
    :ivar unicode value:

    r?   decodervalueN)
r^   r_   r`   ra   rb   rc   r   ru   r=   r   r4   r4   r4   r5   r      s    r   c                   @   s   e Zd ZU dZi Zeeed  f ed< G dd de	j
ZededefddZed	ed  ded  fd
dZdeeef ddfddZdedefddZdedefddZdeeef fddZedeeef dd fddZdS )	Directoryz
Directory._REGISTERED_TYPESc                       s   e Zd ZdZejdddZejdddZejdddZejdddZ	ejdddZ
d	ed
df fddZed
efddZd
ee f fddZded
efddZ  ZS )zDirectory.MetazDirectory Meta.zterms-of-serviceTrD   termsOfServicewebsitecaaIdentitiesr,   rG   r:   Nc                    ,    fdd|  D }t jdi | d S )Nc                       i | ]
\}}  ||qS r4   _internal_namer1   kvrN   r4   r5   
<dictcomp>       z+Directory.Meta.__init__.<locals>.<dictcomp>r4   itemsri   rj   rO   rG   rl   rN   r5   rj         zDirectory.Meta.__init__c                 C      | j p| jS )zURL for the CA TOS)_terms_of_service_terms_of_service_v2rN   r4   r4   r5   terms_of_service      zDirectory.Meta.terms_of_servicec                 #   0    t   D ]}|dkr|dd  n|V  qd S )Nr   rR   ri   __iter__rk   rl   r4   r5   r         zDirectory.Meta.__iter__r2   c                 C      |dkrd| S |S )Nr   _r4   rk   r4   r4   r5   r         zDirectory.Meta._internal_name)r^   r_   r`   ra   rb   rc   r   r   r   caa_identitiesexternal_account_requiredr   rj   re   rU   r   r   r   r   r   r4   r4   rl   r5   Meta   s    r   keyr:   c                 C   s   t |d|S )Nresource_type)getattr)rJ   r   r4   r4   r5   
_canon_key   s   zDirectory._canon_keyresource_body_clsc                 C   s"   |j }|| jvs
J || j|< |S )zRegister resource.)r   r   )rJ   r   r   r4   r4   r5   register   s   
zDirectory.registerrq   Nc                 C   s   t || j}|| _d S r.   )r   map_keysr   _jobj)rO   rq   
canon_jobjr4   r4   r5   rj      s   
zDirectory.__init__r2   c              
   C   s8   z	| | dd W S  ty } ztt|d }~ww )Nr   -)replaceKeyErrorAttributeErrorrU   )rO   r2   errorr4   r4   r5   __getattr__   s   zDirectory.__getattr__c                 C   s8   z	| j | | W S  ty   td| | d w )NzDirectory field "z" not found)r   r   r   rk   r4   r4   r5   __getitem__   s
   zDirectory.__getitem__c                 C   rn   r.   )r   rN   r4   r4   r5   ro     rp   zDirectory.to_partial_jsonc                 C   s    | j |di |d< | |S )Nmeta)r   ru   poprt   r4   r4   r5   ru     s   zDirectory.from_json)r^   r_   r`   ra   r   r   rU   r
   r~   rb   JSONObjectWithFieldsr   rd   r   r   r   r   rj   r   r   ro   r   ru   r4   r4   r4   r5   r      s   
  r   c                   @      e Zd ZdZedZdS )ResourcezOACME Resource.

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

    bodyN)r^   r_   r`   ra   rb   rc   r   r4   r4   r4   r5   r         r   c                   @   r   )ResourceWithURIzQACME Resource with URI.

    :ivar unicode ~.uri: Location of the resource.

    uriN)r^   r_   r`   ra   rb   rc   r   r4   r4   r4   r5   r     r   r   c                   @   s   e Zd ZdZdS )ResourceBodyzACME Resource Body.N)r^   r_   r`   ra   r4   r4   r4   r5   r      s    r   c                   @   s<   e Zd ZdZedejdededede	ee
f f
ddZd	S )
ExternalAccountBindingzACME External Account Bindingaccount_public_keykidhmac_key	directoryr:   c           	      C   sR   t |  }tj|}|d }tj	|tj
j|dtjjd||}| S )zLCreate External Account Binding Resource from contact details, kid and hmac.
newAccount)r   N)jsondumpsro   rY   rb   b64	b64decoder   JWSsignjwkJWKOctjwaHS256)	rJ   r   r   r   r   key_jsondecoded_hmac_keyurleabr4   r4   r5   	from_data'  s   z ExternalAccountBinding.from_dataN)r^   r_   r`   ra   rd   rb   JWKrU   r   r   r   r   r4   r4   r4   r5   r   $  s    
r   c                       st  e Zd ZdZejddejjdZejddddZ	ejddd	Z
ejd
dd	Zejddd	Zejddd	Zejddd	ZdZdZe		d)dee dee dee dedd f
ddZdeddf fddZdedeedf fddZdeeef deeef fdd Zdeeef f fd!d"Zdeeef f fd#d$Zedeedf fd%d&Zedeedf fd'd(Z   Z!S )*RegistrationzRegistration Resource Body.

    :ivar josepy.jwk.JWK key: Public key.
    :ivar tuple contact: Contact information following ACME spec,
        `tuple` of `unicode`.
    :ivar unicode agreement:

    r   TrA   r   contactr4   r@   	agreementrD   statustermsOfServiceAgreedonlyReturnExistingexternalAccountBindingztel:zmailto:Nphoneemailexternal_account_bindingrG   r:   c                    s   d|v }t |dd}|dur| j|  |dur+| fdd|dD  |s/|r5t||d< |r;||d<  di |S )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   r4   Nc                    s   g | ]} j | qS r4   )email_prefix)r1   mailrJ   r4   r5   
<listcomp>d  s    z*Registration.from_data.<locals>.<listcomp>,r   )listr   appendphone_prefixextendsplittuple)rJ   r   r   r   rG   contact_provideddetailsr4   r   r5   r   P  s   zRegistration.from_datac                    s8   d|v r|d durt | dd t jdi | dS )z;Note if the user provides a value for the `contact` member.r   N_add_contactTr4   )object__setattr__ri   rj   r   rl   r4   r5   rj   p  s   zRegistration.__init__prefix.c                    s   t  fdd| jD S )Nc                 3   s*    | ]}|  r|t d  V  qd S r.   )
startswithlen)r1   rE   r   r4   r5   r6   x  s    
z/Registration._filter_contact.<locals>.<genexpr>)r   r   )rO   r   r4   r  r5   _filter_contactw  s   zRegistration._filter_contactrq   c                 C   s   t | ddr| 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   )r   rY   rO   rq   r4   r4   r5   _add_contact_if_appropriate|  s   z(Registration._add_contact_if_appropriatec                       t   }| |S )z2Modify josepy.JSONDeserializable.to_partial_json())ri   ro   r  r  rl   r4   r5   ro        

zRegistration.to_partial_jsonc                    r  )z;Modify josepy.JSONObjectWithFields.fields_to_partial_json())ri   fields_to_partial_jsonr  r  rl   r4   r5   r	    r  z#Registration.fields_to_partial_jsonc                 C      |  | jS )z*All phones found in the ``contact`` field.)r  r   rN   r4   r4   r5   phones  r   zRegistration.phonesc                 C   r
  )z*All emails found in the ``contact`` field.)r  r   rN   r4   r4   r5   emails  r   zRegistration.emails)NNN)"r^   r_   r`   ra   rb   rc   r   ru   r   r   r   r   terms_of_service_agreedonly_return_existingr   r   r   rd   r   rU   r   r   r   rj   r	   r  r   r  ro   r	  re   r  r  r   r4   r4   rl   r5   r   7  s<    
" r   c                   @      e Zd ZdZdZeeZdS )NewRegistrationzNew registration.znew-regNr^   r_   r`   ra   r   r   r   resourcer4   r4   r4   r5   r        r  c                   @   r  )UpdateRegistrationzUpdate registration.regNr  r4   r4   r4   r5   r        r  c                   @   s<   e Zd ZdZejdejdZejdddZ	ejdddZ
dS )	RegistrationResourcezRegistration Resource.

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

    r   r   new_authzr_uriTrD   r   N)r^   r_   r`   ra   rb   rc   r   ru   r   r  r   r4   r4   r4   r5   r    s
    r  c                       s*  e Zd ZdZdZejddddZejddddZejde	j
ded	Zejd
ddZejdej
ddd	Zdeddf fddZdedef fddZdeeef f fddZedeeef deeef f fddZedefddZdedefddZdee f fddZdedefdd Z   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   TNr@   r   r   )r   rA   rB   	validatedrD   r   rG   r:   c                    r   )Nc                    r   r4   r   r   rN   r4   r5   r     r   z*ChallengeBody.__init__.<locals>.<dictcomp>r4   r   r   rl   rN   r5   rj     r   zChallengeBody.__init__r2   c                    s   t  | |S r.   )ri   rY   r   rk   rl   r4   r5   rY     rw   zChallengeBody.encodec                    s   t   }|| j  |S r.   )ri   ro   updater  r  rl   r4   r5   ro     s   
zChallengeBody.to_partial_jsonrq   c                    s    t  |}tj||d< |S )Nr  )ri   fields_from_jsonr   	Challengeru   )rJ   rq   jobj_fieldsrl   r4   r5   r    s   zChallengeBody.fields_from_jsonc                 C   r   )zThe URL of this challenge.)_url_urirN   r4   r4   r5   r     r   zChallengeBody.uric                 C   s   t | j|S r.   )r   r  rk   r4   r4   r5   r     s   zChallengeBody.__getattr__c                 #   r   )Nr!  rR   r   rk   rl   r4   r5   r     r   zChallengeBody.__iter__c                 C   r   )Nr   r   r4   rk   r4   r4   r5   r     r   zChallengeBody._internal_name)"r^   r_   r`   ra   r|   rb   rc   r!  r   r   ru   STATUS_PENDINGr   r   RFC3339Fieldr  r<   r   r   rj   rU   rY   r   ro   rd   r   r  re   r   r   r   r   r   r   r4   r4   rl   r5   r    s,    

(r  c                   @   s<   e Zd ZdZejdejdZedZ	e
defddZdS )	ChallengeResourcezChallenge Resource.

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

    r   r   
authzr_urir:   c                 C   s   | j jS )zThe URL of the challenge body.)r   r   rN   r4   r4   r5   r     s   zChallengeResource.uriN)r^   r_   r`   ra   rb   rc   r  ru   r   r%  re   rU   r   r4   r4   r4   r5   r$    s    
r$  c                   @   s   e Zd ZdZejdejddZejdddZ	ejdddZ
ejddejd	Zejd
ddZejdddZe	jdeeeef  deedf fddZ	edeeeeef df df fddZdS )Authorizationa^  Authorization Resource Body.

    :ivar acme.messages.Identifier identifier:
    :ivar list challenges: `list` of `.ChallengeBody`
    :ivar tuple combinations: Challenge combinations (`tuple` of `tuple`
        of `int`, as opposed to `list` of `list` from the spec).
    :ivar acme.messages.Status status:
    :ivar datetime.datetime expires:

    
identifierTr   rA   r   rD   combinationsr   r   expireswildcardr   r:   .c                 C      t dd | D S )Nc                 s       | ]}t |V  qd S r.   )r  ru   )r1   r  r4   r4   r5   r6   )      z+Authorization.challenges.<locals>.<genexpr>r   r   r4   r4   r5   r   '     zAuthorization.challengesc                    s   t  fdd jD S )z0Combinations with challenges instead of indices.c                 3   s&    | ]}t  fd d|D V  qdS )c                 3   s    | ]} j | V  qd S r.   r   )r1   idxrN   r4   r5   r6   .  r.  z@Authorization.resolved_combinations.<locals>.<genexpr>.<genexpr>Nr/  )r1   comborN   r4   r5   r6   .  s    z6Authorization.resolved_combinations.<locals>.<genexpr>)r   r)  rN   r4   rN   r5   resolved_combinations+  s   z#Authorization.resolved_combinationsN)r^   r_   r`   ra   rb   rc   r   ru   r'  r   r)  r   r   r   r#  r*  r+  r   r   r   rU   r   r	   r  re   r   r4  r4   r4   r4   r5   r&    s    
(,r&  c                   @   r  )NewAuthorizationzNew authorization.z	new-authzNr  r4   r4   r4   r5   r5  2  r  r5  c                   @   r  )UpdateAuthorizationzUpdate authorization.authzNr  r4   r4   r4   r5   r6  9  r  r6  c                   @   s.   e Zd ZdZejdejdZejdddZ	dS )AuthorizationResourcezAuthorization Resource.

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

    r   r   new_cert_uriTrD   N)
r^   r_   r`   ra   rb   rc   r&  ru   r   r9  r4   r4   r4   r5   r8  ?  s    r8  c                   @   s2   e Zd ZdZdZeeZej	dej
ejdZdS )CertificateRequestzACME new-cert request.

    :ivar josepy.util.ComparableX509 csr:
        `OpenSSL.crypto.X509Req` wrapped in `.ComparableX509`

    znew-certcsrr   encoderN)r^   r_   r`   ra   r   r   r   r  rb   rc   
decode_csr
encode_csrr;  r4   r4   r4   r5   r:  J  s
    
r:  c                   @   s$   e Zd ZdZedZedZdS )CertificateResourcea  Certificate Resource.

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

    cert_chain_uriauthzrsN)r^   r_   r`   ra   rb   rc   rA  rB  r4   r4   r4   r5   r@  W  s    
r@  c                   @   s<   e Zd ZdZdZeeZej	dej
ejdZe	dZdS )
Revocationz|Revocation message.

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

    zrevoke-certcertificater<  reasonN)r^   r_   r`   ra   r   r   r   r  rb   rc   decode_certencode_certrD  rE  r4   r4   r4   r5   rC  d  s    

rC  c                   @   s   e Zd ZdZejdddZejdejddZ	ejdddZ
ejdddZejd	ddZejd
ddZejddejdZejdeeeef  deedf fddZdS )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.
    identifiersTrD   r   r(  authorizationsrD  finalizer*  r   r   r   r:   .c                 C   r,  )Nc                 s   r-  r.   )r   ru   )r1   r'  r4   r4   r5   r6     r.  z$Order.identifiers.<locals>.<genexpr>r/  r0  r4   r4   r5   rI    r1  zOrder.identifiersN)r^   r_   r`   ra   rb   rc   rI  r   ru   r   rJ  rD  rK  r   r#  r*  r<   r   r   r   r   rU   r   r	   r   r4   r4   r4   r5   rH  s  s    
,rH  c                   @   sT   e Zd ZdZejdejdZejdddZ	edZ
ejdddZejd	ddZd
S )OrderResourcea  Order Resource.

    :ivar acme.messages.Order body:
    :ivar str 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   r   csr_pemTrD   rJ  fullchain_pemalternative_fullchains_pemN)r^   r_   r`   ra   rb   rc   rH  ru   r   rM  rJ  rN  rO  r4   r4   r4   r5   rL    s    
rL  c                   @   s   e Zd ZdZdZdS )NewOrderz
New order.z	new-orderN)r^   r_   r`   ra   r   r4   r4   r4   r5   rP    s    rP  )Ira   collections.abcr   r   typingr   r   r   r   r   r   r	   r
   r   josepyrb   acmer   r   r   r   r   acme.mixinsr   r8   r/   rH   dictr   rL   r  BaseExceptionr   r>   r   r<   JSONDeSerializablerf   r   STATUS_UNKNOWNr"  STATUS_PROCESSINGSTATUS_VALIDSTATUS_INVALIDSTATUS_REVOKEDSTATUS_READYSTATUS_DEACTIVATEDr   IDENTIFIER_FQDNIDENTIFIER_IPr   r   r   r   r   r   r   r   r  r  r  r  r$  r&  r5  r6  r8  r:  r@  rC  rH  rL  rP  r4   r4   r4   r5   <module>   s    	!
>F		kB$