mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
34 lines
718 B
Dart
34 lines
718 B
Dart
import '../../core/persistant_store.dart';
|
|
import '../model/server/private_key_info.dart';
|
|
|
|
class PrivateKeyStore extends PersistentStore {
|
|
PrivateKeyStore() : super('key');
|
|
|
|
void put(PrivateKeyInfo info) {
|
|
box.put(info.id, info);
|
|
box.updateLastModified();
|
|
}
|
|
|
|
List<PrivateKeyInfo> fetch() {
|
|
final keys = box.keys;
|
|
final ps = <PrivateKeyInfo>[];
|
|
for (final key in keys) {
|
|
final s = box.get(key);
|
|
if (s != null && s is PrivateKeyInfo) {
|
|
ps.add(s);
|
|
}
|
|
}
|
|
return ps;
|
|
}
|
|
|
|
PrivateKeyInfo? get(String? id) {
|
|
if (id == null) return null;
|
|
return box.get(id);
|
|
}
|
|
|
|
void delete(PrivateKeyInfo s) {
|
|
box.delete(s.id);
|
|
box.updateLastModified();
|
|
}
|
|
}
|