π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Bind mobile Contacts through a domain interface
Manav Rathia2a4688b4362
diff --git a/mobile/apps/locker/lib/services/contacts.dart b/mobile/apps/locker/lib/services/contacts.dartindex 7a6ed64c12..d1f975da86 100644--- a/mobile/apps/locker/lib/services/contacts.dart+++ b/mobile/apps/locker/lib/services/contacts.dart@@ -1 +1,85 @@-export 'package:locker/src/rust/third_party/ente_frb_lib/contacts.dart';+import 'package:ente_contacts/contacts_api.dart';+import 'package:ente_frb/contacts.dart';+import 'package:locker/src/rust/third_party/ente_frb_lib/contacts.dart'+ as contacts;+import 'package:locker/src/rust/third_party/ente_frb_lib/session.dart';++class LockerContactsApi implements ContactsApi {+ const LockerContactsApi(this._session);++ final Session _session;++ @override+ Future<ContactRecordOutput> createContact({+ WrappedRootContactKey? wrappedRootContactKey,+ required ContactData data,+ }) => contacts.createContact(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ data: data,+ );++ @override+ Future<ContactDiffOutput> getDiff({+ WrappedRootContactKey? wrappedRootContactKey,+ required int sinceTime,+ required int limit,+ }) => contacts.getDiff(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ sinceTime: sinceTime,+ limit: limit,+ );++ @override+ Future<ContactRecordOutput> updateContact({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required ContactData data,+ }) => contacts.updateContact(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ data: data,+ );++ @override+ Future<void> deleteContact({required String contactId}) =>+ contacts.deleteContact(session: _session, contactId: contactId);++ @override+ Future<ContactRecordOutput> setAttachment({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required AttachmentType attachmentType,+ required List<int> attachmentBytes,+ }) => contacts.setAttachment(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ attachmentType: attachmentType,+ attachmentBytes: attachmentBytes,+ );++ @override+ Future<ContactRecordOutput> deleteAttachment({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required AttachmentType attachmentType,+ }) => contacts.deleteAttachment(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ attachmentType: attachmentType,+ );++ @override+ Future<ProfilePictureOutput> getProfilePicture({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ }) => contacts.getProfilePicture(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ );+}diff --git a/mobile/apps/locker/lib/services/contacts_display_service.dart b/mobile/apps/locker/lib/services/contacts_display_service.dartindex a8ed2d7045..7a49ce0655 100644--- a/mobile/apps/locker/lib/services/contacts_display_service.dart+++ b/mobile/apps/locker/lib/services/contacts_display_service.dart@@ -13,49 +13,10 @@ class LockerContactsDisplayService {static Future<void> init({required SharedPreferences preferences}) async {contacts.ContactsDisplayService.instance.init(- contactsServiceFactory: () {- final session = authenticatedSession();- return contacts.ContactsService(- preferences: preferences,- createContact: (key, data) => createContact(- session: session,- wrappedRootContactKey: key,- data: data,- ),- getDiff: (key, sinceTime, limit) => getDiff(- session: session,- wrappedRootContactKey: key,- sinceTime: sinceTime,- limit: limit,- ),- updateContact: (key, contactId, data) => updateContact(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- data: data,- ),- deleteContact: (contactId) =>- deleteContact(session: session, contactId: contactId),- setAttachment: (key, contactId, type, bytes) => setAttachment(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- attachmentType: type,- attachmentBytes: bytes,- ),- deleteAttachment: (key, contactId, type) => deleteAttachment(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- attachmentType: type,- ),- getProfilePicture: (key, contactId) => getProfilePicture(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- ),- );- },+ contactsServiceFactory: () => contacts.ContactsService(+ preferences: preferences,+ api: LockerContactsApi(authenticatedSession()),+ ),);scheduleEnsureReady();}diff --git a/mobile/apps/locker/lib/services/legacy_api.dart b/mobile/apps/locker/lib/services/legacy.dartsimilarity index 100%rename from mobile/apps/locker/lib/services/legacy_api.dartrename to mobile/apps/locker/lib/services/legacy.dartdiff --git a/mobile/apps/locker/lib/ui/utils/legacy_utils.dart b/mobile/apps/locker/lib/ui/utils/legacy_utils.dartindex 51d98ce354..4b0f1c4420 100644--- a/mobile/apps/locker/lib/ui/utils/legacy_utils.dart+++ b/mobile/apps/locker/lib/ui/utils/legacy_utils.dart@@ -5,7 +5,7 @@ import "package:ente_lock_screen/local_authentication_service.dart";import "package:ente_strings/ente_strings.dart";import "package:flutter/material.dart";import "package:locker/services/configuration.dart";-import "package:locker/services/legacy_api.dart";+import "package:locker/services/legacy.dart";import "package:logging/logging.dart";const _legacy = LockerLegacyApi();diff --git a/mobile/apps/photos/lib/services/contacts.dart b/mobile/apps/photos/lib/services/contacts.dartindex e870df623e..39138afe56 100644--- a/mobile/apps/photos/lib/services/contacts.dart+++ b/mobile/apps/photos/lib/services/contacts.dart@@ -1 +1,85 @@-export 'package:photos/src/rust/third_party/ente_frb_lib/contacts.dart';+import 'package:ente_contacts/contacts_api.dart';+import 'package:ente_frb/contacts.dart';+import 'package:photos/src/rust/third_party/ente_frb_lib/contacts.dart'+ as contacts;+import 'package:photos/src/rust/third_party/ente_frb_lib/session.dart';++class PhotosContactsApi implements ContactsApi {+ const PhotosContactsApi(this._session);++ final Session _session;++ @override+ Future<ContactRecordOutput> createContact({+ WrappedRootContactKey? wrappedRootContactKey,+ required ContactData data,+ }) => contacts.createContact(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ data: data,+ );++ @override+ Future<ContactDiffOutput> getDiff({+ WrappedRootContactKey? wrappedRootContactKey,+ required int sinceTime,+ required int limit,+ }) => contacts.getDiff(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ sinceTime: sinceTime,+ limit: limit,+ );++ @override+ Future<ContactRecordOutput> updateContact({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required ContactData data,+ }) => contacts.updateContact(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ data: data,+ );++ @override+ Future<void> deleteContact({required String contactId}) =>+ contacts.deleteContact(session: _session, contactId: contactId);++ @override+ Future<ContactRecordOutput> setAttachment({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required AttachmentType attachmentType,+ required List<int> attachmentBytes,+ }) => contacts.setAttachment(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ attachmentType: attachmentType,+ attachmentBytes: attachmentBytes,+ );++ @override+ Future<ContactRecordOutput> deleteAttachment({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required AttachmentType attachmentType,+ }) => contacts.deleteAttachment(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ attachmentType: attachmentType,+ );++ @override+ Future<ProfilePictureOutput> getProfilePicture({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ }) => contacts.getProfilePicture(+ session: _session,+ wrappedRootContactKey: wrappedRootContactKey,+ contactId: contactId,+ );+}diff --git a/mobile/apps/photos/lib/services/photos_contacts_service.dart b/mobile/apps/photos/lib/services/photos_contacts_service.dartindex b521b5b6ac..e182a54006 100644--- a/mobile/apps/photos/lib/services/photos_contacts_service.dart+++ b/mobile/apps/photos/lib/services/photos_contacts_service.dart@@ -13,49 +13,10 @@ import "package:photos/services/contacts.dart";class PhotosContactsService {PhotosContactsService._privateConstructor(): _store = contacts.ContactDirectory(- contactsServiceFactory: () {- final session = authenticatedSession();- return contacts.ContactsService(- preferences: ServiceLocator.instance.prefs,- createContact: (key, data) => createContact(- session: session,- wrappedRootContactKey: key,- data: data,- ),- getDiff: (key, sinceTime, limit) => getDiff(- session: session,- wrappedRootContactKey: key,- sinceTime: sinceTime,- limit: limit,- ),- updateContact: (key, contactId, data) => updateContact(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- data: data,- ),- deleteContact: (contactId) =>- deleteContact(session: session, contactId: contactId),- setAttachment: (key, contactId, type, bytes) => setAttachment(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- attachmentType: type,- attachmentBytes: bytes,- ),- deleteAttachment: (key, contactId, type) => deleteAttachment(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- attachmentType: type,- ),- getProfilePicture: (key, contactId) => getProfilePicture(- session: session,- wrappedRootContactKey: key,- contactId: contactId,- ),- );- },+ contactsServiceFactory: () => contacts.ContactsService(+ preferences: ServiceLocator.instance.prefs,+ api: PhotosContactsApi(authenticatedSession()),+ ),onContactsChanged: _notifyContactsChanged,profilePictureFailureTtl: Duration.zero,) {diff --git a/mobile/packages/contacts/lib/contacts.dart b/mobile/packages/contacts/lib/contacts.dartindex 35677e03be..c9a0f9a8e8 100644--- a/mobile/packages/contacts/lib/contacts.dart+++ b/mobile/packages/contacts/lib/contacts.dart@@ -2,6 +2,7 @@ library;export 'package:ente_frb/contacts.dart';+export 'contacts_api.dart';export 'src/db/contacts_database.dart';export 'src/service/contact_directory.dart';export 'src/service/contacts_display_service.dart';diff --git a/mobile/packages/contacts/lib/contacts_api.dart b/mobile/packages/contacts/lib/contacts_api.dartnew file mode 100644index 0000000000..0c8364330c--- /dev/null+++ b/mobile/packages/contacts/lib/contacts_api.dart@@ -0,0 +1,40 @@+import 'package:ente_frb/contacts.dart';++abstract interface class ContactsApi {+ Future<ContactRecordOutput> createContact({+ WrappedRootContactKey? wrappedRootContactKey,+ required ContactData data,+ });++ Future<ContactDiffOutput> getDiff({+ WrappedRootContactKey? wrappedRootContactKey,+ required int sinceTime,+ required int limit,+ });++ Future<ContactRecordOutput> updateContact({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required ContactData data,+ });++ Future<void> deleteContact({required String contactId});++ Future<ContactRecordOutput> setAttachment({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required AttachmentType attachmentType,+ required List<int> attachmentBytes,+ });++ Future<ContactRecordOutput> deleteAttachment({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ required AttachmentType attachmentType,+ });++ Future<ProfilePictureOutput> getProfilePicture({+ WrappedRootContactKey? wrappedRootContactKey,+ required String contactId,+ });+}diff --git a/mobile/packages/contacts/lib/src/service/contacts_service.dart b/mobile/packages/contacts/lib/src/service/contacts_service.dartindex 134cd0c64c..7c04faff18 100644--- a/mobile/packages/contacts/lib/src/service/contacts_service.dart+++ b/mobile/packages/contacts/lib/src/service/contacts_service.dart@@ -1,81 +1,27 @@import 'dart:math';import 'dart:typed_data';+import 'package:ente_contacts/contacts_api.dart';import 'package:ente_contacts/src/db/contacts_database.dart';import 'package:ente_frb/contacts.dart';import 'package:logging/logging.dart';import 'package:shared_preferences/shared_preferences.dart';-typedef CreateContact =- Future<ContactRecordOutput> Function(- WrappedRootContactKey? wrappedRootContactKey,- ContactData data,- );-typedef GetContactDiff =- Future<ContactDiffOutput> Function(- WrappedRootContactKey? wrappedRootContactKey,- int sinceTime,- int limit,- );-typedef UpdateContact =- Future<ContactRecordOutput> Function(- WrappedRootContactKey? wrappedRootContactKey,- String contactId,- ContactData data,- );-typedef DeleteContact = Future<void> Function(String contactId);-typedef SetContactAttachment =- Future<ContactRecordOutput> Function(- WrappedRootContactKey? wrappedRootContactKey,- String contactId,- AttachmentType attachmentType,- Uint8List attachmentBytes,- );-typedef DeleteContactAttachment =- Future<ContactRecordOutput> Function(- WrappedRootContactKey? wrappedRootContactKey,- String contactId,- AttachmentType attachmentType,- );-typedef GetContactProfilePicture =- Future<ProfilePictureOutput> Function(- WrappedRootContactKey? wrappedRootContactKey,- String contactId,- );-class ContactsService {static const _serverMaxSyncLimit = 5000;static const _syncLimit = _serverMaxSyncLimit;ContactsService({required SharedPreferences preferences,- required CreateContact createContact,- required GetContactDiff getDiff,- required UpdateContact updateContact,- required DeleteContact deleteContact,- required SetContactAttachment setAttachment,- required DeleteContactAttachment deleteAttachment,- required GetContactProfilePicture getProfilePicture,+ required ContactsApi api,ContactsDatabase? database,}) : _preferences = preferences,_database = database ?? ContactsDatabase(),- _createRemoteContact = createContact,- _getRemoteDiff = getDiff,- _updateRemoteContact = updateContact,- _deleteRemoteContact = deleteContact,- _setRemoteAttachment = setAttachment,- _deleteRemoteAttachment = deleteAttachment,- _getRemoteProfilePicture = getProfilePicture;+ _api = api;final SharedPreferences _preferences;final ContactsDatabase _database;- final CreateContact _createRemoteContact;- final GetContactDiff _getRemoteDiff;- final UpdateContact _updateRemoteContact;- final DeleteContact _deleteRemoteContact;- final SetContactAttachment _setRemoteAttachment;- final DeleteContactAttachment _deleteRemoteAttachment;- final GetContactProfilePicture _getRemoteProfilePicture;+ final ContactsApi _api;final Logger _logger = Logger('ContactsService');WrappedRootContactKey? _wrappedRootContactKey;@@ -97,10 +43,10 @@ class ContactsService {var previousSinceTime = -1;List<String>? previousPageIds;while (true) {- final output = await _getRemoteDiff(- _wrappedRootContactKey,- sinceTime,- limit,+ final output = await _api.getDiff(+ wrappedRootContactKey: _wrappedRootContactKey,+ sinceTime: sinceTime,+ limit: limit,);await _saveWrappedRootContactKey(output.wrappedRootContactKey);final diff = output.records;@@ -159,7 +105,10 @@ class ContactsService {Future<ContactRecord> createContact(ContactData data) async {_requireOpen();- final output = await _createRemoteContact(_wrappedRootContactKey, data);+ final output = await _api.createContact(+ wrappedRootContactKey: _wrappedRootContactKey,+ data: data,+ );await _saveWrappedRootContactKey(output.wrappedRootContactKey);final created = output.record;await _database.upsertContacts([created]);@@ -171,10 +120,10 @@ class ContactsService {ContactData data,) async {_requireOpen();- final output = await _updateRemoteContact(- _wrappedRootContactKey,- contactId,- data,+ final output = await _api.updateContact(+ wrappedRootContactKey: _wrappedRootContactKey,+ contactId: contactId,+ data: data,);await _saveWrappedRootContactKey(output.wrappedRootContactKey);final updated = output.record;@@ -184,8 +133,12 @@ class ContactsService {Future<void> deleteContact(String contactId) async {_requireOpen();- await _deleteRemoteContact(contactId);- final output = await _getRemoteDiff(_wrappedRootContactKey, 0, _syncLimit);+ await _api.deleteContact(contactId: contactId);+ final output = await _api.getDiff(+ wrappedRootContactKey: _wrappedRootContactKey,+ sinceTime: 0,+ limit: _syncLimit,+ );await _saveWrappedRootContactKey(output.wrappedRootContactKey);final deleted = output.records;final matching = deleted@@ -219,11 +172,11 @@ class ContactsService {contactId,))?.profilePictureAttachmentId;_requireOpen();- final output = await _setRemoteAttachment(- _wrappedRootContactKey,- contactId,- attachmentType,- bytes,+ final output = await _api.setAttachment(+ wrappedRootContactKey: _wrappedRootContactKey,+ contactId: contactId,+ attachmentType: attachmentType,+ attachmentBytes: bytes,);await _saveWrappedRootContactKey(output.wrappedRootContactKey);final updated = output.record;@@ -250,9 +203,9 @@ class ContactsService {return cached;}_requireOpen();- final output = await _getRemoteProfilePicture(- _wrappedRootContactKey,- contactId,+ final output = await _api.getProfilePicture(+ wrappedRootContactKey: _wrappedRootContactKey,+ contactId: contactId,);await _saveWrappedRootContactKey(output.wrappedRootContactKey);final bytes = output.bytes;@@ -268,10 +221,10 @@ class ContactsService {contactId,))?.profilePictureAttachmentId;_requireOpen();- final output = await _deleteRemoteAttachment(- _wrappedRootContactKey,- contactId,- attachmentType,+ final output = await _api.deleteAttachment(+ wrappedRootContactKey: _wrappedRootContactKey,+ contactId: contactId,+ attachmentType: attachmentType,);await _saveWrappedRootContactKey(output.wrappedRootContactKey);final updated = output.record;diff --git a/mobile/packages/contacts/test/contacts_display_service_test.dart b/mobile/packages/contacts/test/contacts_display_service_test.dartindex 02d761ffee..8b23ba12d7 100644--- a/mobile/packages/contacts/test/contacts_display_service_test.dart+++ b/mobile/packages/contacts/test/contacts_display_service_test.dart@@ -261,7 +261,7 @@ ContactRecord _contact({updatedAt: updatedAt,);-class FakeContacts {+class FakeContacts extends Fake implements ContactsApi {static const _key = WrappedRootContactKey(encryptedKey: 'enc-key',header: 'enc-header',@@ -280,22 +280,13 @@ class FakeContacts {ContactsService service(SharedPreferences preferences,ContactsDatabase database,- ) => ContactsService(- preferences: preferences,- database: database,- createContact: createContact,- getDiff: getDiff,- getProfilePicture: getProfilePicture,- updateContact: (_, _, _) => throw UnimplementedError(),- deleteContact: (_) => throw UnimplementedError(),- setAttachment: (_, _, _, _) => throw UnimplementedError(),- deleteAttachment: (_, _, _) => throw UnimplementedError(),- );+ ) => ContactsService(preferences: preferences, database: database, api: this);- Future<ContactRecordOutput> createContact(+ @override+ Future<ContactRecordOutput> createContact({WrappedRootContactKey? wrappedRootContactKey,- ContactData data,- ) async {+ required ContactData data,+ }) async {return ContactRecordOutput(record: ContactRecord(id: 'ct_created',@@ -311,11 +302,12 @@ class FakeContacts {);}- Future<ContactDiffOutput> getDiff(+ @override+ Future<ContactDiffOutput> getDiff({WrappedRootContactKey? wrappedRootContactKey,- int sinceTime,- int limit,- ) async {+ required int sinceTime,+ required int limit,+ }) async {getDiffCalls += 1;final barrier = diffBarrier;if (barrier != null) {@@ -335,10 +327,11 @@ class FakeContacts {return ContactDiffOutput(records: first, wrappedRootContactKey: _key);}- Future<ProfilePictureOutput> getProfilePicture(+ @override+ Future<ProfilePictureOutput> getProfilePicture({WrappedRootContactKey? wrappedRootContactKey,- String contactId,- ) async {+ required String contactId,+ }) async {getProfilePictureCalls += 1;final barrier = profilePictureBarrier;if (barrier != null) {diff --git a/mobile/packages/contacts/test/contacts_service_test.dart b/mobile/packages/contacts/test/contacts_service_test.dartindex 75f160de17..9157609c88 100644--- a/mobile/packages/contacts/test/contacts_service_test.dart+++ b/mobile/packages/contacts/test/contacts_service_test.dart@@ -24,13 +24,7 @@ void main() {database = ContactsDatabase(directoryResolver: () async => tempDir);service = ContactsService(preferences: preferences,- createContact: remote.createContact,- getDiff: remote.getDiff,- updateContact: remote.updateContact,- deleteContact: remote.deleteContact,- setAttachment: remote.setAttachment,- deleteAttachment: remote.deleteAttachment,- getProfilePicture: remote.getProfilePicture,+ api: remote,database: database,);});@@ -282,7 +276,7 @@ void main() {});}-class FakeContacts {+class FakeContacts implements ContactsApi {static const _key = WrappedRootContactKey(encryptedKey: 'enc-key',header: 'enc-header',@@ -299,10 +293,11 @@ class FakeContacts {int getProfilePictureCalls = 0;String nextAttachmentId = 'att_profile';- Future<ContactRecordOutput> createContact(+ @override+ Future<ContactRecordOutput> createContact({WrappedRootContactKey? wrappedRootContactKey,- ContactData data,- ) async {+ required ContactData data,+ }) async {final record = ContactRecord(id: 'ct_created',contactUserId: data.contactUserId,@@ -317,7 +312,8 @@ class FakeContacts {return ContactRecordOutput(record: record, wrappedRootContactKey: _key);}- Future<void> deleteContact(String contactId) async {+ @override+ Future<void> deleteContact({required String contactId}) async {final existing = records[contactId];if (existing != null) {records[contactId] = ContactRecord(@@ -333,11 +329,12 @@ class FakeContacts {}}- Future<ContactRecordOutput> deleteAttachment(+ @override+ Future<ContactRecordOutput> deleteAttachment({WrappedRootContactKey? wrappedRootContactKey,- String contactId,- AttachmentType attachmentType,- ) async {+ required String contactId,+ required AttachmentType attachmentType,+ }) async {final existing = records[contactId]!;final updated = ContactRecord(id: existing.id,@@ -357,11 +354,12 @@ class FakeContacts {return ContactRecordOutput(record: updated, wrappedRootContactKey: _key);}- Future<ContactDiffOutput> getDiff(+ @override+ Future<ContactDiffOutput> getDiff({WrappedRootContactKey? wrappedRootContactKey,- int sinceTime,- int limit,- ) async {+ required int sinceTime,+ required int limit,+ }) async {lastWrappedRootContactKey = wrappedRootContactKey;diffSinceTimes.add(sinceTime);diffLimits.add(limit);@@ -384,10 +382,11 @@ class FakeContacts {return ContactDiffOutput(records: first, wrappedRootContactKey: _key);}- Future<ProfilePictureOutput> getProfilePicture(+ @override+ Future<ProfilePictureOutput> getProfilePicture({WrappedRootContactKey? wrappedRootContactKey,- String contactId,- ) async {+ required String contactId,+ }) async {getProfilePictureCalls += 1;final picture = profilePictures[contactId];if (picture != null) {@@ -400,12 +399,13 @@ class FakeContacts {);}- Future<ContactRecordOutput> setAttachment(+ @override+ Future<ContactRecordOutput> setAttachment({WrappedRootContactKey? wrappedRootContactKey,- String contactId,- AttachmentType attachmentType,- Uint8List attachmentBytes,- ) async {+ required String contactId,+ required AttachmentType attachmentType,+ required List<int> attachmentBytes,+ }) async {final existing = records[contactId]!;final updated = ContactRecord(id: existing.id,@@ -418,16 +418,18 @@ class FakeContacts {updatedAt: existing.updatedAt + 1,);records[contactId] = updated;- attachments[nextAttachmentId] = attachmentBytes;- profilePictures[contactId] = attachmentBytes;+ final bytes = Uint8List.fromList(attachmentBytes);+ attachments[nextAttachmentId] = bytes;+ profilePictures[contactId] = bytes;return ContactRecordOutput(record: updated, wrappedRootContactKey: _key);}- Future<ContactRecordOutput> updateContact(+ @override+ Future<ContactRecordOutput> updateContact({WrappedRootContactKey? wrappedRootContactKey,- String contactId,- ContactData data,- ) async {+ required String contactId,+ required ContactData data,+ }) async {final existing = records[contactId]!;final updated = ContactRecord(id: existing.id,