Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-integration-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4
with:
repository: katzenpost/katzenpost
ref: 86d4dbc5f11d9162d52b371708f41c937566cf7f # courier/replica error-code disambiguation
ref: cdb88125ec6d3c54cc9f5413af39967edb9a51b4 # PR #1053: Poisson-gate ARQ follow-ups + remove SACK
path: katzenpost

- name: Set up Docker Buildx
Expand Down
4 changes: 0 additions & 4 deletions katzenpost_thinclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ async def main():
start_resending_encrypted_message,
start_resending_encrypted_message_return_box_exists,
start_resending_encrypted_message_no_retry,
write_stream,
read_stream,
cancel_resending_encrypted_message,
next_message_box_index,
get_message_box_index_counter,
Expand Down Expand Up @@ -187,8 +185,6 @@ async def main():
ThinClient.start_resending_encrypted_message = start_resending_encrypted_message
ThinClient.start_resending_encrypted_message_return_box_exists = start_resending_encrypted_message_return_box_exists
ThinClient.start_resending_encrypted_message_no_retry = start_resending_encrypted_message_no_retry
ThinClient.write_stream = write_stream
ThinClient.read_stream = read_stream
ThinClient.cancel_resending_encrypted_message = cancel_resending_encrypted_message
ThinClient.next_message_box_index = next_message_box_index
ThinClient.get_message_box_index_counter = get_message_box_index_counter
Expand Down
4 changes: 2 additions & 2 deletions katzenpost_thinclient/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ def __init__(self, replica_error_code: int = 0, failed_envelope_index: int = 0)


class PayloadTooLargeError(Exception):
"""A WriteStream plaintext or a ReadStream result exceeded the daemon's
configured maximum stream payload size."""
"""A request's payload exceeded the daemon's configured maximum payload
size."""
pass


Expand Down
79 changes: 0 additions & 79 deletions katzenpost_thinclient/pigeonhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,85 +404,6 @@ async def start_resending_encrypted_message(
)


async def write_stream(self, write_cap, start_index, payload, window=0):
"""
Writes a whole payload, of any size, to a channel using the daemon's
windowed selective-ack (SACK) ARQ. The daemon splits the payload into as
many BACAP boxes as it spans and keeps up to ``window`` boxes in flight at
once, retransmitting only those whose acknowledgements time out, so a
multi-box payload is no longer serialised one round trip per box. A
``window`` of zero asks the daemon to choose a default.

The daemon does all chunking and encryption; the caller supplies only the
cleartext payload, the write capability, and the start index.

Args:
write_cap: Write capability for the destination channel.
start_index: Message box index of the first box written.
payload: Cleartext payload to write.
window: Maximum boxes in flight at once (0 = daemon default).

Returns:
The message box index immediately after the last box written.
"""
query_id = self.new_query_id()
request = {
"write_stream": {
"query_id": query_id,
"write_cap": write_cap,
"start_index": start_index,
"payload": payload,
"window": window,
}
}
reply = await self._send_and_wait(query_id=query_id, request=request)
error_code = reply.get("error_code", 0)
if error_code != THIN_CLIENT_SUCCESS:
exc = error_code_to_exception(error_code)
if exc:
raise exc
raise Exception(f"write_stream failed: {thin_client_error_to_string(error_code)}")
return reply.get("next_message_box_index")


async def read_stream(self, read_cap, start_index, box_count, window=0):
"""
Reads ``box_count`` sequential boxes from a channel using the daemon's
windowed selective-ack (SACK) ARQ, the read counterpart of
``write_stream``. The daemon keeps up to ``window`` boxes in flight,
decrypts each, and reassembles them in order. A ``window`` of zero asks the
daemon to choose a default.

Args:
read_cap: Read capability for the source channel.
start_index: Message box index of the first box read.
box_count: Number of sequential boxes to read.
window: Maximum boxes in flight at once (0 = daemon default).

Returns:
A tuple ``(payload, next_message_box_index)``: the concatenation of the
decrypted boxes in order, and the index immediately after the last box.
"""
query_id = self.new_query_id()
request = {
"read_stream": {
"query_id": query_id,
"read_cap": read_cap,
"start_index": start_index,
"box_count": box_count,
"window": window,
}
}
reply = await self._send_and_wait(query_id=query_id, request=request)
error_code = reply.get("error_code", 0)
if error_code != THIN_CLIENT_SUCCESS:
exc = error_code_to_exception(error_code)
if exc:
raise exc
raise Exception(f"read_stream failed: {thin_client_error_to_string(error_code)}")
return reply.get("payload", b""), reply.get("next_message_box_index")


async def start_resending_encrypted_message_return_box_exists(
self,
read_cap: "bytes|None",
Expand Down
Loading
Loading