diff --git a/lib/services/collections_service.dart b/lib/services/collections_service.dart index a3dc2eaa6c5e8f43837ecf9ad450f960abf770c4..9ed71188024140f4c0c4d434f65d6cb9ebaf629a 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 32b0d2aed5e2d3fb5f208f1e2521fb4287d00c8e..59312b61942050b1191bb437ede1753008a0f003 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,