add version check in decryptCollectionPath to get correct decryptionKey

This commit is contained in:
Abhinav-grd 2021-01-22 14:04:49 +05:30
parent fd322dac33
commit bc0718d806

View file

@ -320,9 +320,12 @@ class CollectionsService {
}
String decryptCollectionPath(Collection collection) {
final key = collection.attributes.version != null
? getCollectionKey(collection.id)
: _config.getKey();
return utf8.decode(CryptoUtil.decryptSync(
Sodium.base642bin(collection.attributes.encryptedPath),
_config.getKey(),
key,
Sodium.base642bin(collection.attributes.pathDecryptionNonce)));
}
}