Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
public_key.hpp
Go to the documentation of this file.
1#pragma once
10
11namespace fc { namespace crypto {
12 namespace config {
13 constexpr const char* public_key_legacy_prefix = "SYS";
14 constexpr const char* public_key_base_prefix = "PUB";
15 constexpr const char* public_key_prefix[] = {
16 "K1",
17 "R1",
18 "WA",
19 "EM"
20 };
21 };
22
24 {
25 public:
26 using storage_type = std::variant<ecc::public_key_shim, r1::public_key_shim, webauthn::public_key, em::public_key_shim>;
27
28 public_key() = default;
29 public_key( public_key&& ) = default;
30 public_key( const public_key& ) = default;
31 public_key& operator= (const public_key& ) = default;
32
33 public_key( const signature& c, const sha256& digest, bool check_canonical = true );
34
35 public_key( storage_type&& other_storage )
36 :_storage(forward<storage_type>(other_storage))
37 {}
38
39 bool valid()const;
40
41 size_t which()const;
42
43 // serialize to/from string
44 explicit public_key(const string& base58str);
45 std::string to_string(const fc::yield_function_t& yield = fc::yield_function_t()) const;
46
48
49 private:
50 friend std::ostream& operator<< (std::ostream& s, const public_key& k);
51 friend bool operator == ( const public_key& p1, const public_key& p2);
52 friend bool operator != ( const public_key& p1, const public_key& p2);
53 friend bool operator < ( const public_key& p1, const public_key& p2);
54 friend struct reflector<public_key>;
55 friend class private_key;
56 }; // public_key
57
58} } // fc::crypto
59
60namespace fc {
61 void to_variant(const crypto::public_key& var, variant& vo, const fc::yield_function_t& yield = fc::yield_function_t());
62
63 void from_variant(const variant& var, crypto::public_key& vo);
64} // namespace fc
65
public_key(const public_key &)=default
friend bool operator!=(const public_key &p1, const public_key &p2)
public_key(public_key &&)=default
friend bool operator<(const public_key &p1, const public_key &p2)
std::variant< ecc::public_key_shim, r1::public_key_shim, webauthn::public_key, em::public_key_shim > storage_type
public_key & operator=(const public_key &)=default
friend bool operator==(const public_key &p1, const public_key &p2)
size_t which() const
public_key(storage_type &&other_storage)
friend std::ostream & operator<<(std::ostream &s, const public_key &k)
std::string to_string(const fc::yield_function_t &yield=fc::yield_function_t()) const
constexpr const char * public_key_base_prefix
constexpr const char * public_key_prefix[]
constexpr const char * public_key_legacy_prefix
namespace sysio::chain
Definition authority.cpp:3
fc::sha256 digest(const T &value)
Definition digest.hpp:9
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
#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
char * s