mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
feat: use OkHttp and fix mTLS (#15230)
This commit is contained in:
parent
4cd2cc223a
commit
6de4921b99
22 changed files with 560 additions and 236 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue