8#include "../converters.h"
10#include <QtCore/QMetaType>
11#include <QtCore/QStringBuilder>
34 MegolmV1AesSha2AlgoKey };
38 return std::ranges::find(SupportedAlgorithms, algorithm) != SupportedAlgorithms.cend();
47using byte_t = uint8_t;
56 QUOTIENT_API void checkForSpanShortfall(QByteArray::size_type inputSize,
int neededSize);
58 template <
typename SpanT>
59 inline auto spanFromBytes(
auto& byteArray)
62 Q_ASSERT_X(std::in_range<
int>(std::size(byteArray)),
__func__,
"Too long array for OpenSSL");
63 if constexpr (SpanT::extent != std::dynamic_extent) {
64 static_assert(std::in_range<
int>(SpanT::extent));
65 checkForSpanShortfall(std::size(byteArray),
static_cast<
int>(SpanT::extent));
67 return SpanT(std::bit_cast<
typename SpanT::pointer>(std::data(byteArray)),
68 std::min(SpanT::extent, unsignedSize(byteArray)));
84 return _impl::spanFromBytes<byte_view_t<N>>(buf);
204 explicit PicklingKey(InitOptions options) : FixedBuffer(options)
206 Q_ASSERT(options != FillWithZeros);
214 k.fillFrom(std::move(keySource));
Non-template base for owning byte span classes.
static PicklingKey fromByteArray(QByteArray &&keySource)
static PicklingKey mock()
static PicklingKey generate()
constexpr auto Ed25519Key
constexpr auto OlmV1Curve25519AesSha2AlgoKey
bool isSupportedAlgorithm(const QString &algorithm)
constexpr auto SignedCurve25519Key
constexpr auto RotationPeriodMsKeyL
constexpr auto AlgorithmKey
constexpr auto Curve25519Key
constexpr auto RotationPeriodMsgsKeyL
auto asCBytes(const auto &buf)
Obtain a std::span<const byte_t, N> looking into the passed buffer.
constexpr auto RotationPeriodMsgsKey
constexpr auto AlgorithmKeyL
QUOTIENT_API void fillFromSecureRng(std::span< byte_t > bytes)
Fill the buffer with the securely generated random bytes.
constexpr std::array SupportedAlgorithms
constexpr auto RotationPeriodMsKey