libkazv
crypto-util-p.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 #pragma once
8 #include <libkazv-config.hpp>
9 #include <array>
10 #include <vector>
11 #include <cstdint>
12 #include <maybe.hpp>
13 
14 namespace Kazv
15 {
16  static const std::array<std::uint8_t, 32> VODOZEMAC_PICKLE_KEY = {};
17  static const std::vector<std::uint8_t> OLM_PICKLE_KEY = {'x', 'x', 'x'};
18 
19  template<class Func>
20  static auto checkVodozemacError(Func &&func) -> Maybe<std::invoke_result_t<Func>>
21  {
22  try {
23  return std::forward<Func>(func)();
24  } catch (const std::exception &e) {
25  return NotBut(e.what());
26  }
27  }
28 }
Definition: location.hpp:10