Marco Ricci commited on 2026-06-16 22:19:26
Zeige 1 geänderte Dateien mit 8 Einfügungen und 0 Löschungen.
When calling `bytes` on the SSH agent protocol number enums, return their corresponding serialization as request codes or response codes. (A follow-up to 57e3b1ed832e865e9f9e8316f930b1beae3714f0.)
| ... | ... |
@@ -687,6 +687,10 @@ class SSH_AGENTC(int, enum.Enum): # noqa: N801 |
| 687 | 687 |
EXTENSION = 27 |
| 688 | 688 |
"""""" |
| 689 | 689 |
|
| 690 |
+ def __bytes__(self) -> bytes: |
|
| 691 |
+ """Return the corresponding request code.""" |
|
| 692 |
+ return int.to_bytes(self, 1, "big", signed=False) |
|
| 693 |
+ |
|
| 690 | 694 |
|
| 691 | 695 |
class SSH_AGENT(int, enum.Enum): # noqa: N801 |
| 692 | 696 |
"""SSH agent protocol numbers: server replies. |
| ... | ... |
@@ -720,6 +724,10 @@ class SSH_AGENT(int, enum.Enum): # noqa: N801 |
| 720 | 724 |
EXTENSION_RESPONSE = 29 |
| 721 | 725 |
"""""" |
| 722 | 726 |
|
| 727 |
+ def __bytes__(self) -> bytes: |
|
| 728 |
+ """Return the corresponding response code.""" |
|
| 729 |
+ return int.to_bytes(self, 1, "big", signed=False) |
|
| 730 |
+ |
|
| 723 | 731 |
|
| 724 | 732 |
class StoreroomKeyPair(NamedTuple, Generic[T_Buffer]): |
| 725 | 733 |
"""A pair of AES256 keys, one for encryption and one for signing. |
| 726 | 734 |