Skip to content

Commit 6d41ae7

Browse files
committed
PEP 748: materialize the server configuration
Ease reading the diff of the next commits.
1 parent b3229ec commit 6d41ae7

1 file changed

Lines changed: 63 additions & 2 deletions

File tree

peps/pep-0748.rst

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ backwards-compatibility purposes, new fields are only appended to these objects.
252252
Existing fields will never be removed, renamed, or reordered. They are split
253253
between client and server to minimize API confusion.
254254

255+
Client Configuration
256+
^^^^^^^^^^^^^^^^^^^^
257+
255258
The ``TLSClientConfiguration`` class would be defined by the following code:
256259

257260
.. code-block:: python
@@ -309,8 +312,66 @@ The ``TLSClientConfiguration`` class would be defined by the following code:
309312
def trust_store(self) -> TrustStore | None:
310313
return self._trust_store
311314
312-
The ``TLSServerConfiguration`` object is similar to the client one, except that
313-
it takes a ``Sequence[SigningChain]`` as the ``certificate_chain`` parameter.
315+
Server Configuration
316+
^^^^^^^^^^^^^^^^^^^^
317+
318+
The ``TLSServerConfiguration`` class would be defined by the following code:
319+
320+
.. code-block:: python
321+
322+
class TLSServerConfiguration:
323+
__slots__ = (
324+
"_certificate_chain",
325+
"_ciphers",
326+
"_inner_protocols",
327+
"_lowest_supported_version",
328+
"_highest_supported_version",
329+
"_trust_store",
330+
)
331+
332+
def __init__(
333+
self,
334+
certificate_chain: Sequence[SigningChain] | None = None,
335+
ciphers: Sequence[CipherSuite] | None = None,
336+
inner_protocols: Sequence[NextProtocol | bytes] | None = None,
337+
lowest_supported_version: TLSVersion | None = None,
338+
highest_supported_version: TLSVersion | None = None,
339+
trust_store: TrustStore | None = None,
340+
) -> None:
341+
if inner_protocols is None:
342+
inner_protocols = []
343+
344+
self._certificate_chain = certificate_chain
345+
self._ciphers = ciphers
346+
self._inner_protocols = inner_protocols
347+
self._lowest_supported_version = lowest_supported_version
348+
self._highest_supported_version = highest_supported_version
349+
self._trust_store = trust_store
350+
351+
@property
352+
def certificate_chain(self) -> Sequence[SigningChain] | None:
353+
return self._certificate_chain
354+
355+
@property
356+
def ciphers(self) -> Sequence[CipherSuite | int] | None:
357+
return self._ciphers
358+
359+
@property
360+
def inner_protocols(self) -> Sequence[NextProtocol | bytes]:
361+
return self._inner_protocols
362+
363+
@property
364+
def lowest_supported_version(self) -> TLSVersion | None:
365+
return self._lowest_supported_version
366+
367+
@property
368+
def highest_supported_version(self) -> TLSVersion | None:
369+
return self._highest_supported_version
370+
371+
@property
372+
def trust_store(self) -> TrustStore | None:
373+
return self._trust_store
374+
314375
315376
Context
316377
~~~~~~~

0 commit comments

Comments
 (0)