upated collection creating function send encrypted name
This commit is contained in:
parent
db8f9dd592
commit
0d4b87da55
2 changed files with 13 additions and 3 deletions
|
@ -203,12 +203,15 @@ class CollectionsService {
|
|||
Future<Collection> 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),
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Reference in a new issue