Skip to content

Commit

Permalink
Merge pull request #439 from atsign-foundation/fix/sendSshPublicKey
Browse files Browse the repository at this point in the history
fix: send ssh public key
  • Loading branch information
gkc committed Sep 8, 2023
2 parents 7a82f67 + 0cdabd2 commit 4259bb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/sshnoports/lib/sshnp/sshnp_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ class SSHNPImpl implements SSHNP {
..key = 'sshpublickey'
..sharedBy = clientAtSign
..sharedWith = sshnpdAtSign
..namespace = namespace
..metadata = (Metadata()
..ttr = -1
..ttl = 10000);
Expand Down
8 changes: 3 additions & 5 deletions packages/sshnoports/lib/sshnpd/sshnpd_impl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,6 @@ class SSHNPDImpl implements SSHNPD {

late final String sshPublicKey;
try {
var sshHomeDirectory = '$homeDirectory/.ssh/';
if (Platform.isWindows) {
sshHomeDirectory = '$homeDirectory\\.ssh\\';
}
logger.info(
'ssh Public Key received from ${notification.from} notification id : ${notification.id}');
sshPublicKey = notification.value!;
Expand All @@ -309,7 +305,9 @@ class SSHNPDImpl implements SSHNPD {
}

// Check to see if the ssh Publickey is already in the file if not append to the ~/.ssh/authorized_keys file
var authKeys = File('${sshHomeDirectory}authorized_keys');
var authKeysFilePath = [homeDirectory, '.ssh', 'authorized_keys']
.join(Platform.pathSeparator);
var authKeys = File(authKeysFilePath);

var authKeysContent = await authKeys.readAsString();

Expand Down

0 comments on commit 4259bb2

Please sign in to comment.