Messages¶
ACME protocol messages.
- acme.messages.is_acme_error(err: BaseException) bool [source]¶
Check if argument is an ACME error.
- class acme.messages.Identifier(**kwargs: Any)[source]¶
ACME identifier.
- Variables:
typ (IdentifierType) –
value (str) –
- exception acme.messages.Error(**kwargs: Any)[source]¶
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.
- Variables:
- classmethod with_code(code: str, **kwargs: Any) Error [source]¶
Create an Error instance with an ACME Error code.
- Str code:
An ACME error code, like ‘dnssec’.
- Kwargs:
kwargs to pass to Error.
- class acme.messages.Directory(jobj: Mapping[str, Any])[source]¶
Directory.
Directory resources must be accessed by the exact field name in RFC8555 (section 9.7.5).
- to_partial_json() Dict[str, Any] [source]¶
Partially serialize.
Following the example, partial serialization means the following:
assert isinstance(Bar().to_partial_json()[0], Foo) assert isinstance(Bar().to_partial_json()[1], Foo) # in particular... assert Bar().to_partial_json() != ['foo', 'foo']
- Raises:
josepy.errors.SerializationError – in case of any serialization error.
- Returns:
Partially serializable object.
- classmethod from_json(jobj: MutableMapping[str, Any]) Directory [source]¶
Deserialize a decoded JSON document.
- Parameters:
jobj – Python object, composed of only other basic data types, as decoded from JSON document. Not necessarily
dict
(as decoded from “JSON object” document).- Raises:
josepy.errors.DeserializationError – if decoding was unsuccessful, e.g. in case of unparseable X509 certificate, or wrong padding in JOSE base64 encoded string, etc.
- class acme.messages.Resource(**kwargs: Any)[source]¶
ACME Resource.
- Variables:
body (acme.messages.ResourceBody) – Resource body.
- class acme.messages.ResourceWithURI(**kwargs: Any)[source]¶
ACME Resource with URI.
- Variables:
uri (str) – Location of the resource.
- class acme.messages.Registration(**kwargs: Any)[source]¶
Registration Resource Body.
- Variables:
- classmethod from_data(phone: Optional[str] = None, email: Optional[str] = None, external_account_binding: Optional[Dict[str, Any]] = None, **kwargs: Any) GenericRegistration [source]¶
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 emptytuple
.
- class acme.messages.RegistrationResource(**kwargs: Any)[source]¶
Registration Resource.
- Variables:
body (acme.messages.Registration) –
new_authzr_uri (str) – Deprecated. Do not use.
terms_of_service (str) – URL for the CA TOS.
- class acme.messages.ChallengeBody(**kwargs: Any)[source]¶
Challenge Resource Body.
- Variables:
acme.challenges.Challenge – Wrapped challenge. Conveniently, all challenge fields are proxied, i.e. you can call
challb.x
to getchallb.chall.x
contents.status (acme.messages.Status) –
validated (datetime.datetime) –
error (messages.Error) –
- encode(name: str) Any [source]¶
Encode a single field.
- Parameters:
name (str) – Name of the field to be encoded.
- Raises:
errors.SerializationError – if field cannot be serialized
errors.Error – if field could not be found
- to_partial_json() Dict[str, Any] [source]¶
Partially serialize.
Following the example, partial serialization means the following:
assert isinstance(Bar().to_partial_json()[0], Foo) assert isinstance(Bar().to_partial_json()[1], Foo) # in particular... assert Bar().to_partial_json() != ['foo', 'foo']
- Raises:
josepy.errors.SerializationError – in case of any serialization error.
- Returns:
Partially serializable object.
- class acme.messages.ChallengeResource(**kwargs: Any)[source]¶
Challenge Resource.
- Variables:
body (acme.messages.ChallengeBody) –
authzr_uri (str) – URI found in the ‘up’
Link
header.
- class acme.messages.Authorization(**kwargs: Any)[source]¶
Authorization Resource Body.
- Variables:
identifier (acme.messages.Identifier) –
challenges (list) –
list
ofChallengeBody
status (acme.messages.Status) –
expires (datetime.datetime) –
- class acme.messages.AuthorizationResource(**kwargs: Any)[source]¶
Authorization Resource.
- Variables:
body (acme.messages.Authorization) –
new_cert_uri (str) – Deprecated. Do not use.
- class acme.messages.CertificateRequest(**kwargs: Any)[source]¶
ACME newOrder request.
- Variables:
csr (jose.ComparableX509) –
OpenSSL.crypto.X509Req
wrapped inComparableX509
- class acme.messages.CertificateResource(**kwargs: Any)[source]¶
Certificate Resource.
- Variables:
body (josepy.util.ComparableX509) –
OpenSSL.crypto.X509
wrapped inComparableX509
cert_chain_uri (str) – URI found in the ‘up’
Link
headerauthzrs (tuple) –
tuple
ofAuthorizationResource
.
- class acme.messages.Revocation(**kwargs: Any)[source]¶
Revocation message.
- Variables:
certificate (jose.ComparableX509) –
OpenSSL.crypto.X509
wrapped injose.ComparableX509
- class acme.messages.Order(**kwargs: Any)[source]¶
Order Resource Body.
- Variables:
identifiers (
list
ofIdentifier
) – List of identifiers for the certificate.status (acme.messages.Status) –
certificate (str) – URL to download certificate as a fullchain PEM.
finalize (str) – URL to POST to to request issuance once all authorizations have “valid” status.
expires (datetime.datetime) – When the order expires.
error (Error) – Any error that occurred during finalization, if applicable.
- class acme.messages.OrderResource(**kwargs: Any)[source]¶
Order Resource.
- Variables:
body (acme.messages.Order) –
csr_pem (bytes) – The CSR this Order will be finalized with.
authorizations (
list
ofacme.messages.AuthorizationResource
) – Fully-fetched AuthorizationResource objects.fullchain_pem (str) – The fetched contents of the certificate URL produced once the order was finalized, if it’s present.
alternative_fullchains_pem (
list
ofstr
) – The fetched contents of alternative certificate chain URLs produced once the order was finalized, if present and requested during finalization.