DartSSH 2
dartssh2 is a pure dart SSH implementation based on dartssh, with bug fixes, up-to-date dependencies and sound null safety.
dartssh2 providing first-class tunnelling primitives.
Feature support
| |
|---|
| Keys | Ed25519, ECDSA, RSA |
| KEX | X25519DH, ECDH, DHGEX, DH |
| Cipher | AES-CTR, AES-CBC |
| MAC | MD5, SHA |
| Compression | not yet supported |
| Forwarding | TCP/IP, Agent |
| Tunneling drop-ins for | Socket, WebSocket, package:http |
Try
# Install the `dartssh` command.
dart pub global activate dartssh2
# Then use `dartssh` as regular `ssh` command.
dartssh user@example.com
If the dartssh command can not be found after installation, you might need to set up your path.
Quick start – SSH client
Click to see more:
import 'package:dartssh2/dartssh2.dart';
Quick start – SSH server
Click to see more:
import 'package:dartssh2/dartssh2.dart';
Example
SSH client: example/dartssh.dart
SSH server: example/dartsshs.dart
Roadmap
- Fix broken tests
- Sound null safety
- Redesign API to allow starting multiple sessions. In progress…
- SFTP
References
RFC 4251 The Secure Shell (SSH) Protocol ArchitectureRFC 4252 The Secure Shell (SSH) Authentication ProtocolRFC 4253 The Secure Shell (SSH) Transport Layer ProtocolRFC 4254 The Secure Shell (SSH) Connection ProtocolRFC 4255 Using DNS to Securely Publish Secure Shell (SSH) Key FingerprintsRFC 4256 Generic Message Exchange Authentication for the Secure Shell Protocol (SSH)
Contribute on GitHub
SSH and SFTP client written in pure Dart, aiming to be feature-rich as well as easy to use.
https://github.com/vicajilau/dartssh2
112 forks.
261 stars.
1 open issues.
Recent commits:
- Merge pull request #249 from vicajilau/docs/web-support-readmeRelease 4.1.0, and lead the web section with what works, GitHub
- chore: release 4.1.0Dates the section and bumps pubspec from 4.0.1.Nothing is left open, and the web platform work is invisible to anyoneuntil this is published: pub.dev still serves 4.0.1 withoutplatform:web, so a search filtered to web still does not find thepackage., Victor C.
- docs: lead the web section with what worksThe section still read as a warning: sockets are unavailable, bring yourown transport, and by the way here is what used to be broken before4.0.0. That framing was right when web support was a caveat. It is notany more, now that pub.dev lists the platform and a browser runs ahandshake, a command, an aes256-gcm session and an SFTP round tripagainst a real OpenSSH server on every pull request.So it now says what works first, then the one thing a caller has tosupply, then the two things a browser genuinely cannot do. Thearchaeology about getUint64 moves out: that belongs in the changelog,which has it.Also points at tool/ws_bridge.dart and the test socket as a workedexample of the transport, since writing one is the only real work leftfor a web user, and mentions the platform in the features list., Victor C.
- Merge pull request #248 from vicajilau/feat/web-platformStop one dart:io type from hiding the package from web, GitHub
- feat(sftp): list the package as web-compatible, and prove it in CIpub.dev listed android, ios, windows, linux and macos and not web. Thatalso keeps the package out of any search narrowed to web, so it costsdiscoverability rather than a badge.The cause was one type. `SftpFile.downloadToRandomAccess` takes a`dart:io` `RandomAccessFile`, and naming it from the SFTP library madepana classify the whole package as unavailable there, even thougheverything else compiled and ran and 4.0.0 had already made the ciphersand SFTP work under dart2js.The method moves to an `SftpFileDownload` extension in its own library,exported conditionally the way `SSHSocket` and dynamic forwardingalready are. Nothing changes for a caller on the VM: same import from`package:dartssh2/dartssh2.dart`, same call. On the web the extension isabsent, along with the `RandomAccessFile` it would need.The extension reaches back through `isClosed`, already public, and`readChunk`, which was `_readChunk` and is now `@internal`. That onemethod is the entire seam. `_ReadCompletion` was used by nothing else soit moved too, and the two size constants are redeclared rather thanwidening the surface further.Saying `platform:web` on pub.dev is a stronger claim than a paragraph inthe README, so CI now checks it. Everything that ran under `-p chrome`until now proved the pieces compile and behave, and none of it put apacket on a wire, which is the gap that let every AEAD cipher and thewhole of SFTP sit broken on the web until 4.0.0 with a green suite thewhole time. So the browser now runs against the same sshd container theVM interop tests use, through `tool/ws_bridge.dart`, because a browserhas no TCP socket of its own. Four tests: a handshake, a command, asession pinned to aes256-gcm because its nonce counter is the code thatthrew under dart2js, and an SFTP round trip because every size andoffset on the wire is a 64-bit field. The socket they connect through isthe WebSocket one the README tells web users to write, so it doubles asa worked example.They skip when the bridge is not there, the way the VM interop testsskip without the server, decided by probing the bridge rather than by acompile-time define: `dart test` has neither `–define` nor`–dart2js-args`, and a browser has no `Platform.environment`.Verified: pana reports `platform:web` on this branch and not on main,and the four browser tests pass in CI against the real server. Projectcoverage is unchanged at 4978/6395, the lines codecov reports as newbeing the same error paths that were already uncovered before the move., Victor C.
Provides the list of the opensource Flutter apps collection with GitHub repository.