mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
#87 new: auto ask add system key (~/.ssh/id_rsa)
This commit is contained in:
@@ -77,13 +77,12 @@ String pathJoin(String path1, String path2) {
|
||||
return path1 + (path1.endsWith('/') ? '' : '/') + path2;
|
||||
}
|
||||
|
||||
String getHome() {
|
||||
String? home = "";
|
||||
Map<String, String> envVars = Platform.environment;
|
||||
if (isMacOS ||isLinux) {
|
||||
home = envVars['HOME'];
|
||||
String? getHomeDir() {
|
||||
final envVars = Platform.environment;
|
||||
if (isMacOS || isLinux) {
|
||||
return envVars['HOME'];
|
||||
} else if (isWindows) {
|
||||
home = envVars['UserProfile'];
|
||||
return envVars['UserProfile'];
|
||||
}
|
||||
return home??"";
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -32,14 +32,14 @@ enum GenSSHClientStatus {
|
||||
}
|
||||
|
||||
String getPrivateKey(String id) {
|
||||
final key = locator<PrivateKeyStore>().get(id);
|
||||
if (key == null) {
|
||||
final pki = locator<PrivateKeyStore>().get(id);
|
||||
if (pki == null) {
|
||||
throw SSHErr(
|
||||
type: SSHErrType.noPrivateKey,
|
||||
message: 'key [$id] not found',
|
||||
);
|
||||
}
|
||||
return key.privateKey;
|
||||
return pki.key;
|
||||
}
|
||||
|
||||
Future<SSHClient> genClient(
|
||||
|
||||
Reference in New Issue
Block a user