changed path encryption key and added versioning

This commit is contained in:
Abhinav-grd 2021-01-22 14:00:51 +05:30
parent 0d4b87da55
commit fd322dac33

View file

@ -226,8 +226,7 @@ class CollectionsService {
}
final key = CryptoUtil.generateKey();
final encryptedKeyData = CryptoUtil.encryptSync(key, _config.getKey());
final encryptedPath =
CryptoUtil.encryptSync(utf8.encode(path), _config.getKey());
final encryptedPath = CryptoUtil.encryptSync(utf8.encode(path), key);
final collection = await createAndCacheCollection(Collection(
null,
null,
@ -239,7 +238,8 @@ class CollectionsService {
CollectionType.folder,
CollectionAttributes(
encryptedPath: Sodium.bin2base64(encryptedPath.encryptedData),
pathDecryptionNonce: Sodium.bin2base64(encryptedPath.nonce)),
pathDecryptionNonce: Sodium.bin2base64(encryptedPath.nonce),
version: 1),
null,
null,
));