getAllKeys method
Retrieve all keys, decrypt them, and populate the cache
Implementation
Future<Map<String, String>> getAllKeys({String? password}) async {
final key = password ?? _defaultPassword;
final results = await _database.query(tableSharedKeys);
_sharedKeysCache.clear(); // Clear the cache
// Decrypt each shared key and store it in the cache
for (var row in results) {
final userId = row[columnUserId] as String;
final encryptedKey = row[columnSharedKey] as String;
final decryptedKey = _decryptSharedKey(encryptedKey, userId, key);
_sharedKeysCache[userId] = decryptedKey;
}
return _sharedKeysCache;
}