@@ -182,25 +182,19 @@ def get_server_public_key(
182182) -> bytes :
183183 """Retrieve the CURVE public key of a DISCOS RPC server.
184184
185- The server public key can be obtained either from a predefined
186- telescope configuration or from an explicit key file.
187-
188- Exactly one of the following must be provided:
189- - ``telescope``: loads the key from the package resources
190- (``discos_client/servers/<telescope>/server.key``)
191- - ``server_public_key_file``: loads the key from a user-specified path
185+ If ``server_public_key_file`` is provided, it overrides the default
186+ server key associated with ``telescope``. Otherwise, the bundled key
187+ for the given telescope is used.
192188
193189 :param telescope: The telescope name used to locate a bundled server key.
194190 :param server_public_key_file: Path to a server public key file.
191+ If provided, it overrides the default key associated with
192+ ``telescope``.
195193 :return: The server public key.
196- :raises ValueError: If both or neither arguments are provided.
197- :raises OSError: If the key file cannot be found or loaded.
194+ :raises ValueError: If neither ``telescope`` nor
195+ ``server_public_key_file`` is provided.
196+ :raises OSError: If the selected key file cannot be found or loaded.
198197 """
199- if telescope is not None and server_public_key_file is not None :
200- raise ValueError (
201- "Use either 'telescope' or 'server_public_key_file', not both."
202- )
203-
204198 if server_public_key_file is not None :
205199 server_public , _ = load_certificate (Path (server_public_key_file ))
206200 return server_public
@@ -224,21 +218,20 @@ def get_auth_keys(
224218) -> tuple [bytes , bytes , bytes ]:
225219 """Retrieve CURVE authentication keys for both client and server.
226220
227- This function loads:
228- - the client key pair associated with the given ``identity``
229- - the server public key, either from a telescope profile or an
230- explicit file
231-
232- The server key selection follows these rules:
233- - if ``server_public_key_file`` is provided, it is used
234- - otherwise, ``telescope`` must be provided to load a bundled key
221+ The client key pair is loaded from the user configuration associated
222+ with ``identity``. The server public key is loaded from
223+ ``server_public_key_file`` if provided; otherwise, the bundled key
224+ for ``telescope`` is used.
235225
236226 :param identity: The name of the client identity (key file prefix).
237227 :param telescope: The telescope name used to locate a bundled server key.
238228 :param server_public_key_file: Path to a server public key file.
229+ If provided, it overrides the default key associated with
230+ ``telescope``.
239231 :return: A tuple containing (client_public, client_secret, server_public).
240- :raises ValueError: If neither or both server key sources are provided.
241- :raises OSError: If any key file cannot be found or loaded.
232+ :raises ValueError: If neither ``telescope`` nor
233+ ``server_public_key_file`` is provided.
234+ :raises OSError: If any selected key file cannot be found or loaded.
242235 """
243236 client_public , client_secret = get_client_auth_keys (identity )
244237 server_public = get_server_public_key (telescope , server_public_key_file )
0 commit comments