2024-07-26 14:59:02 +01:00
|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:typed_data';
|
|
|
|
|
2025-02-20 00:57:32 +05:30
|
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
2025-02-20 00:35:24 +05:30
|
|
|
import 'package:immich_mobile/domain/services/store.service.dart';
|
2023-02-09 18:32:08 +01:00
|
|
|
|
2025-02-20 00:35:24 +05:30
|
|
|
// ignore: non_constant_identifier_names
|
|
|
|
final Store = StoreService.I;
|
2023-02-09 18:32:08 +01:00
|
|
|
|
2024-07-26 14:59:02 +01:00
|
|
|
class SSLClientCertStoreVal {
|
|
|
|
final Uint8List data;
|
|
|
|
final String? password;
|
|
|
|
|
|
|
|
SSLClientCertStoreVal(this.data, this.password);
|
|
|
|
|
|
|
|
void save() {
|
|
|
|
final b64Str = base64Encode(data);
|
|
|
|
Store.put(StoreKey.sslClientCertData, b64Str);
|
|
|
|
if (password != null) {
|
|
|
|
Store.put(StoreKey.sslClientPasswd, password!);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static SSLClientCertStoreVal? load() {
|
|
|
|
final b64Str = Store.tryGet<String>(StoreKey.sslClientCertData);
|
|
|
|
if (b64Str == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
final Uint8List certData = base64Decode(b64Str);
|
|
|
|
final passwd = Store.tryGet<String>(StoreKey.sslClientPasswd);
|
|
|
|
return SSLClientCertStoreVal(certData, passwd);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void delete() {
|
|
|
|
Store.delete(StoreKey.sslClientCertData);
|
|
|
|
Store.delete(StoreKey.sslClientPasswd);
|
|
|
|
}
|
|
|
|
}
|