feat: use OkHttp and fix mTLS (#15230)

This commit is contained in:
Denys Vitali 2025-10-08 13:55:04 +02:00
parent 4cd2cc223a
commit 6de4921b99
No known key found for this signature in database
GPG key ID: 37CE2BFB2D6D249D
22 changed files with 560 additions and 236 deletions

View file

@ -1,6 +1,3 @@
import 'dart:convert';
import 'dart:typed_data';
import 'package:immich_mobile/domain/models/store.model.dart';
import 'package:immich_mobile/domain/services/store.service.dart';
@ -8,31 +5,19 @@ import 'package:immich_mobile/domain/services/store.service.dart';
final Store = StoreService.I;
class SSLClientCertStoreVal {
final Uint8List data;
final String? password;
const SSLClientCertStoreVal(this.data, this.password);
final String privateKeyAlias;
const SSLClientCertStoreVal(this.privateKeyAlias);
Future<void> save() async {
final b64Str = base64Encode(data);
await Store.put(StoreKey.sslClientCertData, b64Str);
if (password != null) {
await Store.put(StoreKey.sslClientPasswd, password!);
}
await Store.put(StoreKey.mTlsSelectedPrivateKey, privateKeyAlias);
}
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);
final privateKeyAlias = Store.tryGet<String>(StoreKey.mTlsSelectedPrivateKey) ?? "";
return SSLClientCertStoreVal(privateKeyAlias);
}
static Future<void> delete() async {
await Store.delete(StoreKey.sslClientCertData);
await Store.delete(StoreKey.sslClientPasswd);
await Store.delete(StoreKey.mTlsSelectedPrivateKey);
}
}