Skip to content

Refactor KEX handling to async and offload X25519 crypto#159

Merged
vicajilau merged 9 commits into
masterfrom
fix/issue-23-async-kex-compute
Jun 30, 2026
Merged

Refactor KEX handling to async and offload X25519 crypto#159
vicajilau merged 9 commits into
masterfrom
fix/issue-23-async-kex-compute

Conversation

@vicajilau

@vicajilau vicajilau commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

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

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.50000% with 27 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.52%. Comparing base (c094d40) to head (d1306be).
⚠️ Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
lib/src/ssh_transport.dart 42.85% 24 Missing ⚠️
lib/src/kex/kex_nist.dart 92.85% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
+ Coverage   53.90%   54.52%   +0.61%     
==========================================
  Files          64       66       +2     
  Lines        5272     5357      +85     
==========================================
+ Hits         2842     2921      +79     
- Misses       2430     2436       +6     
Flag Coverage Δ
unittests 54.52% <77.50%> (+0.61%) ⬆️

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

Files with missing lines Coverage Δ
lib/src/kex/kex_dh.dart 100.00% <100.00%> (ø)
lib/src/kex/kex_x25519.dart 93.75% <100.00%> (+4.86%) ⬆️
lib/src/ssh_key_pair.dart 79.32% <ø> (ø)
lib/src/utils/compute.dart 100.00% <100.00%> (ø)
lib/src/utils/compute_io.dart 100.00% <100.00%> (ø)
lib/src/kex/kex_nist.dart 94.54% <92.85%> (-5.46%) ⬇️
lib/src/ssh_transport.dart 50.92% <42.85%> (+0.32%) ⬆️
🚀 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.

@vicajilau vicajilau closed this Jun 30, 2026
@vicajilau vicajilau reopened this Jun 30, 2026
@vicajilau vicajilau merged commit 28f5435 into master Jun 30, 2026
1 check passed
@vicajilau vicajilau deleted the fix/issue-23-async-kex-compute branch June 30, 2026 16:15
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