| 3660 | } |
| 3661 | |
| 3662 | QByteArray Account::readBotStorage(PeerId botId) { |
| 3663 | if (!_botStoragesNotReadMap.remove(botId)) { |
| 3664 | return {}; |
| 3665 | } |
| 3666 | |
| 3667 | const auto j = _botStoragesMap.find(botId); |
| 3668 | if (j == _botStoragesMap.cend()) { |
| 3669 | return {}; |
| 3670 | } |
| 3671 | FileReadDescriptor storage; |
| 3672 | if (!ReadEncryptedFile(storage, j->second, _basePath, _localKey)) { |
| 3673 | ClearKey(j->second, _basePath); |
| 3674 | _botStoragesMap.erase(j); |
| 3675 | writeMapDelayed(); |
| 3676 | return {}; |
| 3677 | } |
| 3678 | |
| 3679 | auto result = QByteArray(); |
| 3680 | storage.stream >> result; |
| 3681 | if (storage.stream.status() != QDataStream::Ok) { |
| 3682 | ClearKey(j->second, _basePath); |
| 3683 | _botStoragesMap.erase(j); |
| 3684 | writeMapDelayed(); |
| 3685 | return {}; |
| 3686 | } |
| 3687 | return result; |
| 3688 | } |
| 3689 | |
| 3690 | bool Account::encrypt( |
| 3691 | const void *src, |
no test coverage detected