mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt: auto rm pwd in key page for safe
This commit is contained in:
@@ -8,12 +8,22 @@ import '../../data/store/private_key.dart';
|
||||
import '../../locator.dart';
|
||||
|
||||
/// Must put this func out of any Class.
|
||||
///
|
||||
/// Because of this function is called by [compute] in [ServerProvider.genClient].
|
||||
///
|
||||
/// https://stackoverflow.com/questions/51998995/invalid-arguments-illegal-argument-in-isolate-message-object-is-a-closure
|
||||
List<SSHKeyPair> loadIndentity(String key) {
|
||||
return SSHKeyPair.fromPem(key);
|
||||
}
|
||||
|
||||
/// [args] : [key, pwd]
|
||||
String decyptPem(List<String> args) {
|
||||
/// skip when the key is not encrypted, or will throw exception
|
||||
if (!SSHKeyPair.isEncryptedPem(args[0])) return args[0];
|
||||
final sshKey = SSHKeyPair.fromPem(args[0], args[1]);
|
||||
return sshKey.first.toPem();
|
||||
}
|
||||
|
||||
Future<SSHClient> genClient(ServerPrivateInfo spi) async {
|
||||
final socket = await SSHSocket.connect(
|
||||
spi.ip,
|
||||
|
||||
Reference in New Issue
Block a user