// SPDX-FileCopyrightText: 2021 Carl Schwan // // SPDX-License-Identifier: LGPL-2.1-or-later #ifdef Quotient_E2EE_ENABLED #include "crypto/qolmutils.h" #include #include using namespace Quotient; QByteArray Quotient::toKey(const Quotient::PicklingMode &mode) { if (std::holds_alternative(mode)) { return {}; } return std::get(mode).key; } QByteArray Quotient::getRandom(size_t bufferSize) { QByteArray buffer(bufferSize, '0'); RAND_bytes(reinterpret_cast(buffer.data()), buffer.size()); return buffer; } #endif