mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-18 07:44:26 +01:00
DRAFT:Add support of reading system privatekey (.ssh/id_rsa)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:toolbox/core/utils/misc.dart' show getHome, pathJoin;
|
||||
import 'package:toolbox/data/model/app/error.dart';
|
||||
import 'package:hive_flutter/hive_flutter.dart';
|
||||
|
||||
part 'private_key_info.g.dart';
|
||||
@@ -29,3 +32,15 @@ class PrivateKeyInfo {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class SystemPrivateKeyInfo extends PrivateKeyInfo {
|
||||
SystemPrivateKeyInfo() : super("System private key", "", "");
|
||||
|
||||
Future getKey() async {
|
||||
File idRsaFile = File(pathJoin(getHome(), ".ssh/id_rsa"));
|
||||
if (!await idRsaFile.exists()) {
|
||||
this.privateKey="";
|
||||
}
|
||||
this.privateKey= await idRsaFile.readAsString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user