#87 new: auto ask add system key (~/.ssh/id_rsa)

This commit is contained in:
lollipopkit
2023-08-04 21:46:44 +08:00
parent 60507ea4bc
commit 91967e6ce3
19 changed files with 129 additions and 76 deletions

View File

@@ -1,10 +1,7 @@
import 'dart:async';
import 'package:toolbox/core/persistant_store.dart';
import 'package:toolbox/data/model/server/private_key_info.dart';
import 'package:toolbox/core/utils/platform.dart';
class PrivateKeyStore extends PersistentStore {
late SystemPrivateKeyInfo systemPrivateKeyInfo;
void put(PrivateKeyInfo info) {
box.put(info.id, info);
}
@@ -18,19 +15,10 @@ class PrivateKeyStore extends PersistentStore {
ps.add(s);
}
}
if (isLinux || isMacOS) {
SystemPrivateKeyInfo sysPk = SystemPrivateKeyInfo();
unawaited(sysPk.getKey());
systemPrivateKeyInfo = sysPk;
ps.add(sysPk);
}
return ps;
}
PrivateKeyInfo? get(String? id) {
if (id == "System private key") {
return this.systemPrivateKeyInfo;
}
if (id == null) return null;
return box.get(id);
}