pubkey/include/nil/crypto3/pubkey/type_traits.hpp
Go to the documentation of this file.
1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2021 Mikhail Komarov <nemo@nil.foundation>
3 // Copyright (c) 2021 Ilias Khairullin <ilias@nil.foundation>
4 //
5 // MIT License
6 //
7 // Permission is hereby granted, free of charge, to any person obtaining a copy
8 // of this software and associated documentation files (the "Software"), to deal
9 // in the Software without restriction, including without limitation the rights
10 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 // copies of the Software, and to permit persons to whom the Software is
12 // furnished to do so, subject to the following conditions:
13 //
14 // The above copyright notice and this permission notice shall be included in all
15 // copies or substantial portions of the Software.
16 //
17 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 // SOFTWARE.
24 //---------------------------------------------------------------------------//
25 
26 #ifndef CRYPTO3_PUBKEY_TYPE_TRAITS_HPP
27 #define CRYPTO3_PUBKEY_TYPE_TRAITS_HPP
28 
29 #include <boost/type_traits.hpp>
30 #include <boost/tti/tti.hpp>
31 #include <boost/mpl/placeholders.hpp>
32 #include <boost/type_traits/is_same.hpp>
33 
34 namespace nil {
35  namespace crypto3 {
36  namespace pubkey {
37 
38  using namespace boost::mpl::placeholders;
39 
40  BOOST_TTI_HAS_STATIC_MEMBER_DATA(context)
41 
42  template<typename T>
43  struct is_eddsa_params {
44  static constexpr bool value = has_static_member_data_context<T, const typename T::context_type>::value;
45  typedef T type;
46  };
47 
48  template<typename PublicParams, template<typename, typename> class BlsVersion,
49  template<typename> class BlsScheme, typename CurveType>
50  struct bls;
51 
52  template<typename T>
53  struct is_bls : std::bool_constant<false> { };
54 
55  template<typename PublicParams, template<typename, typename> class BlsVersion,
56  template<typename> class BlsScheme, typename CurveType>
57  struct is_bls<bls<PublicParams, BlsVersion, BlsScheme, CurveType>> : std::bool_constant<true> { };
58 
59  template<typename Group>
60  struct shamir_sss;
61 
62  template<typename Group>
63  struct feldman_sss;
64 
65  template<typename Group>
66  struct pedersen_dkg;
67 
68  template<typename Group>
69  struct weighted_shamir_sss;
70 
71  template<typename T>
72  struct is_shamir_sss : std::bool_constant<false> { };
73 
74  template<typename Group>
75  struct is_shamir_sss<shamir_sss<Group>> : std::bool_constant<true> { };
76 
77  template<typename T>
78  struct is_feldman_sss : std::bool_constant<false> { };
79 
80  template<typename Group>
81  struct is_feldman_sss<feldman_sss<Group>> : std::bool_constant<true> { };
82 
83  template<typename T>
84  struct is_pedersen_dkg : std::bool_constant<false> { };
85 
86  template<typename Group>
87  struct is_pedersen_dkg<pedersen_dkg<Group>> : std::bool_constant<true> { };
88 
89  template<typename T>
90  struct is_weighted_shamir_sss : std::bool_constant<false> { };
91 
92  template<typename Group>
93  struct is_weighted_shamir_sss<weighted_shamir_sss<Group>> : std::bool_constant<true> { };
94 
95  } // namespace pubkey
96  } // namespace crypto3
97 } // namespace nil
98 
99 #endif // CRYPTO3_PUBKEY_TYPE_TRAITS_HPP
boost::mpl::apply< AccumulatorSet, tag::pubkey< ProcessingMode > >::type::result_type pubkey(const AccumulatorSet &acc)
Definition: accumulators/pubkey.hpp:106
Definition: pair.hpp:31
Definition: bls.hpp:339
Definition: feldman.hpp:37
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:53
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:43
T type
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:45
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:78
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:84
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:72
Definition: pubkey/include/nil/crypto3/pubkey/type_traits.hpp:90
Definition: pubkey/include/nil/crypto3/pubkey/secret_sharing/pedersen.hpp:40
Definition: shamir.hpp:58
Definition: weighted_shamir.hpp:35