| 137 | } |
| 138 | |
| 139 | std::vector<std::string> |
| 140 | CryptoModule::getOneTimeKeysForPublishing(size_t oneTimeKeysAmount) { |
| 141 | try { |
| 142 | // Get current unpublished keys |
| 143 | auto oneTimeKeysVec = this->vodozemacAccount->one_time_keys(); |
| 144 | size_t numUnpublishedKeys = oneTimeKeysVec.size(); |
| 145 | |
| 146 | // Generate more if needed |
| 147 | if (numUnpublishedKeys < oneTimeKeysAmount) { |
| 148 | this->generateOneTimeKeys(oneTimeKeysAmount - numUnpublishedKeys); |
| 149 | } |
| 150 | |
| 151 | this->publishOneTimeKeys(); |
| 152 | |
| 153 | return this->keys.oneTimeKeys; |
| 154 | } catch (const std::exception &e) { |
| 155 | throw std::runtime_error( |
| 156 | "error getOneTimeKeysForPublishing => " + std::string(e.what())); |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | std::string CryptoModule::getPrekey() { |
| 161 | try { |
no test coverage detected