Don't rely on cache that does not exist yet

This commit is contained in:
Vishnu Mohandas 2021-02-14 23:45:38 +05:30
parent 2920e5796f
commit db47586424
2 changed files with 6 additions and 5 deletions

View file

@ -203,7 +203,7 @@ class CollectionAttributes {
if (pathDecryptionNonce != null) {
map['pathDecryptionNonce'] = pathDecryptionNonce;
}
if (version != null) map['version'] = version;
map['version'] = version ?? 0;
return map;
}

View file

@ -260,9 +260,10 @@ class CollectionsService {
Sodium.bin2base64(encryptedPath.nonce),
CollectionType.folder,
CollectionAttributes(
encryptedPath: Sodium.bin2base64(encryptedPath.encryptedData),
pathDecryptionNonce: Sodium.bin2base64(encryptedPath.nonce),
version: 1),
encryptedPath: Sodium.bin2base64(encryptedPath.encryptedData),
pathDecryptionNonce: Sodium.bin2base64(encryptedPath.nonce),
version: 1,
),
null,
null,
));
@ -347,7 +348,7 @@ class CollectionsService {
String decryptCollectionPath(Collection collection) {
final key = collection.attributes.version == 1
? getCollectionKey(collection.id)
? _getDecryptedKey(collection)
: _config.getKey();
return utf8.decode(CryptoUtil.decryptSync(
Sodium.base642bin(collection.attributes.encryptedPath),