diff --git a/lib/services/collections_service.dart b/lib/services/collections_service.dart index a3dc2eaa6..9ed711880 100644 --- a/lib/services/collections_service.dart +++ b/lib/services/collections_service.dart @@ -203,12 +203,15 @@ class CollectionsService { Future createAlbum(String albumName) async { final key = CryptoUtil.generateKey(); final encryptedKeyData = CryptoUtil.encryptSync(key, _config.getKey()); + final encryptedName = CryptoUtil.encryptSync(utf8.encode(albumName), key); final collection = await createAndCacheCollection(Collection( null, null, Sodium.bin2base64(encryptedKeyData.encryptedData), Sodium.bin2base64(encryptedKeyData.nonce), - albumName, + null, + Sodium.bin2base64(encryptedName.encryptedData), + Sodium.bin2base64(encryptedName.nonce), CollectionType.album, CollectionAttributes(), null, @@ -230,7 +233,9 @@ class CollectionsService { null, Sodium.bin2base64(encryptedKeyData.encryptedData), Sodium.bin2base64(encryptedKeyData.nonce), - path, + null, + Sodium.bin2base64(encryptedPath.encryptedData), + Sodium.bin2base64(encryptedPath.nonce), CollectionType.folder, CollectionAttributes( encryptedPath: Sodium.bin2base64(encryptedPath.encryptedData), diff --git a/lib/services/favorites_service.dart b/lib/services/favorites_service.dart index 32b0d2aed..59312b619 100644 --- a/lib/services/favorites_service.dart +++ b/lib/services/favorites_service.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter_sodium/flutter_sodium.dart'; import 'package:photos/core/configuration.dart'; import 'package:photos/core/event_bus.dart'; @@ -74,13 +76,16 @@ class FavoritesService { } final key = CryptoUtil.generateKey(); final encryptedKeyData = CryptoUtil.encryptSync(key, _config.getKey()); + final encryptedName = CryptoUtil.encryptSync(utf8.encode("Favorites"), key); final collection = await _collectionsService.createAndCacheCollection(Collection( null, null, Sodium.bin2base64(encryptedKeyData.encryptedData), Sodium.bin2base64(encryptedKeyData.nonce), - "Favorites", + null, + Sodium.bin2base64(encryptedName.encryptedData), + Sodium.bin2base64(encryptedName.nonce), CollectionType.favorites, CollectionAttributes(), null,