Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing SSHClient on onAuthenticated callback and Environment Variables feature #118

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

busslina
Copy link

@busslina busslina commented Jan 7, 2025

Before this, I have to do this trick with a Completer as we can't use client on its own definition:

final socket = await SSHSocket.connect(_remoteSshHost, 22);
final authenticatedCompleter = Completer();
final client = SSHClient(
  socket,
  username: _remoteSshUser,
  identities: SSHKeyPair.fromPem(
    cc.read(sshPrivateKeyFileCapsule).readAsStringSync(),
  ),
  onAuthenticated: () {
    authenticatedCompleter.complete();
  },
);
print('Authenticating to SSH repository');

await authenticatedCompleter.future;

Before this, I have to do this trick with a `Completer`:
```dart
final socket = await SSHSocket.connect(_remoteSshHost, 22);
final authenticatedCompleter = Completer();
final client = SSHClient(
  socket,
  username: _remoteSshUser,
  identities: SSHKeyPair.fromPem(
    cc.read(sshPrivateKeyFileCapsule).readAsStringSync(),
  ),
  onAuthenticated: () {
    authenticatedCompleter.complete();
  },
);
print('Authenticating to SSH repository');

await authenticatedCompleter.future;
```
Sending a map of environment variables on channel creation
@busslina busslina changed the title Providing SSHClient on onAuthenticated callback Providing SSHClient on onAuthenticated callback and Environment Variables feature Jan 7, 2025
@busslina
Copy link
Author

busslina commented Jan 7, 2025

The authenticated feature was coded before knowing I have client.authenticated way to achieve my goal but I think it's also productive to have available the client there.

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