Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
signature.hpp
Go to the documentation of this file.
1#pragma once
9
10namespace fc { namespace crypto {
11 namespace config {
12 constexpr const char* signature_base_prefix = "SIG";
13 constexpr const char* signature_prefix[] = {
14 "K1",
15 "R1",
16 "WA",
17 "EM"
18 };
19 };
20
22 {
23 public:
24 using storage_type = std::variant<ecc::signature_shim, r1::signature_shim, webauthn::signature, em::signature_shim>;
25
26 signature() = default;
27 signature( signature&& ) = default;
28 signature( const signature& ) = default;
29 signature& operator= (const signature& ) = default;
30
31 // serialize to/from string
32 explicit signature(const string& base58str);
33 std::string to_string(const fc::yield_function_t& yield = fc::yield_function_t()) const;
34
35 size_t which() const;
36
37 size_t variable_size() const;
38
39 private:
40 storage_type _storage;
41
42 signature( storage_type&& other_storage )
43 :_storage(std::forward<storage_type>(other_storage))
44 {}
45
46 friend bool operator == ( const signature& p1, const signature& p2);
47 friend bool operator != ( const signature& p1, const signature& p2);
48 friend bool operator < ( const signature& p1, const signature& p2);
49 friend std::size_t hash_value(const signature& b); //not cryptographic; for containers
50 friend struct reflector<signature>;
51 friend class private_key;
52 friend class public_key;
53 }; // public_key
54
55 size_t hash_value(const signature& b);
56
57} } // fc::crypto
58
59namespace fc {
60 void to_variant(const crypto::signature& var, variant& vo, const fc::yield_function_t& yield = fc::yield_function_t());
61
62 void from_variant(const variant& var, crypto::signature& vo);
63} // namespace fc
64
65namespace std {
66 template <> struct hash<fc::crypto::signature> {
67 std::size_t operator()(const fc::crypto::signature& k) const {
68 return fc::crypto::hash_value(k);
69 }
70 };
71} // std
72
signature(signature &&)=default
signature & operator=(const signature &)=default
friend bool operator!=(const signature &p1, const signature &p2)
Definition signature.cpp:72
size_t which() const
Definition signature.cpp:38
std::variant< ecc::signature_shim, r1::signature_shim, webauthn::signature, em::signature_shim > storage_type
Definition signature.hpp:24
size_t variable_size() const
Definition signature.cpp:45
friend std::size_t hash_value(const signature &b)
Definition signature.cpp:81
std::string to_string(const fc::yield_function_t &yield=fc::yield_function_t()) const
Definition signature.cpp:56
friend bool operator==(const signature &p1, const signature &p2)
Definition signature.cpp:68
signature(const signature &)=default
friend bool operator<(const signature &p1, const signature &p2)
Definition signature.cpp:76
constexpr const char * signature_prefix[]
Definition signature.hpp:13
constexpr const char * signature_base_prefix
Definition signature.hpp:12
size_t hash_value(const signature &b)
Definition signature.cpp:81
namespace sysio::chain
Definition authority.cpp:3
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
Definition authority.cpp:4
Definition name.hpp:106
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
defines visit functions for T Unless this is specialized, visit() will not be defined for T.
Definition reflect.hpp:33
std::size_t operator()(const fc::crypto::signature &k) const
Definition signature.hpp:67