Skip to content

Refactor KEX handling to async and offload X25519 crypto#159

Open
vicajilau wants to merge 1 commit intomasterfrom
fix/issue-23-async-kex-compute
Open

Refactor KEX handling to async and offload X25519 crypto#159
vicajilau wants to merge 1 commit intomasterfrom
fix/issue-23-async-kex-compute

Conversation

@vicajilau
Copy link
Copy Markdown
Collaborator

@vicajilau vicajilau commented Apr 16, 2026

Summary

Related issue #23

  • make SSH transport packet handling asynchronous while preserving message order
  • convert KEX message handlers to async
  • offload X25519 keypair creation and shared-secret computation to isolate-backed compute helpers
  • keep non-isolate fallback implementation for unsupported platforms

Why

Addresses UI/main-isolate blocking reported in issue #23 by moving the heaviest X25519 operations off the main isolate and allowing async handling in the transport path.

Testing

  • dart test test/src/kex test/src/ssh_transport_version_test.dart test/src/ssh_client_test.dart test/src/ssh_client_run_with_result_test.dart test/src/ssh_transport_aead_test.dart

@vicajilau vicajilau requested a review from xtyxtyx April 16, 2026 09:19
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

❌ Patch coverage is 65.33333% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.99%. Comparing base (f9fa680) to head (3c07467).

Files with missing lines Patch % Lines
lib/src/ssh_transport.dart 56.25% 14 Missing ⚠️
lib/src/kex/kex_x25519.dart 70.00% 6 Missing ⚠️
lib/src/utils/compute_io.dart 71.42% 6 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
+ Coverage   52.80%   52.99%   +0.19%     
==========================================
  Files          63       65       +2     
  Lines        5121     5168      +47     
==========================================
+ Hits         2704     2739      +35     
- Misses       2417     2429      +12     
Flag Coverage Δ
unittests 52.99% <65.33%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
lib/src/utils/compute.dart 100.00% <100.00%> (ø)
lib/src/kex/kex_x25519.dart 77.14% <70.00%> (-11.75%) ⬇️
lib/src/utils/compute_io.dart 71.42% <71.42%> (ø)
lib/src/ssh_transport.dart 51.45% <56.25%> (+0.58%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vicajilau
Copy link
Copy Markdown
Collaborator Author

I changed SSH transport packet processing to be asynchronous, and I moved X25519 key exchange off the main isolate to avoid UI blocking. This changes the timing of handshake and packet handling; other key exchange algorithms still run synchronously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant