Skip to content

Commit 2f29d52

Browse files
committed
Handoff serialization to jupyter-client
1 parent 6007e9b commit 2f29d52

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

ipykernel/heartbeat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ def __init__(self, context, addr=None, curve_publickey=None, curve_secretkey=Non
3636
addr : tuple, optional
3737
(transport, ip, port)
3838
curve_publickey : bytes, optional
39-
Z85-encoded CurveZMQ public key. When provided together with
39+
CurveZMQ public key (Z85). When provided together with
4040
*curve_secretkey*, the heartbeat socket will operate as a
4141
CurveZMQ server so that only authenticated clients can connect.
4242
curve_secretkey : bytes, optional
43-
Z85-encoded CurveZMQ secret key (paired with *curve_publickey*).
43+
CurveZMQ secret key (Z85, paired with *curve_publickey*).
4444
"""
4545
if addr is None:
4646
addr = ("tcp", localhost(), 0)

ipykernel/kernelapp.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,9 @@ def write_connection_file(self, **kwargs: Any) -> None:
299299
control_port=self.control_port,
300300
)
301301
if self.enable_curve and self._curve_publickey is not None:
302-
# Store Z85-encoded keys as ASCII strings alongside the HMAC key.
303-
# Clients that understand CurveZMQ will use these to configure
304-
# their sockets; legacy clients ignore the unknown fields.
305-
connection_info["curve_publickey"] = self._curve_publickey.decode("ascii")
306-
connection_info["curve_secretkey"] = self._curve_secretkey.decode("ascii") # type: ignore[union-attr]
302+
# write_connection_file() in jupyter-client handles JSON-safe key serialization
303+
connection_info["curve_publickey"] = self._curve_publickey
304+
connection_info["curve_secretkey"] = self._curve_secretkey
307305
if Path(cf).exists():
308306
# If the file exists, merge our info into it. For example, if the
309307
# original file had port number 0, we update with the actual port

0 commit comments

Comments
 (0)