Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
fc::crypto::public_key Class Reference

#include <public_key.hpp>

Public Types

using storage_type = std::variant<ecc::public_key_shim, r1::public_key_shim, webauthn::public_key, em::public_key_shim>
 

Public Member Functions

 public_key ()=default
 
 public_key (public_key &&)=default
 
 public_key (const public_key &)=default
 
public_keyoperator= (const public_key &)=default
 
 public_key (const signature &c, const sha256 &digest, bool check_canonical=true)
 
 public_key (storage_type &&other_storage)
 
bool valid () const
 
size_t which () const
 
 public_key (const string &base58str)
 
std::string to_string (const fc::yield_function_t &yield=fc::yield_function_t()) const
 

Public Attributes

storage_type _storage
 

Friends

struct reflector< public_key >
 
class private_key
 
std::ostream & operator<< (std::ostream &s, const public_key &k)
 
bool operator== (const public_key &p1, const public_key &p2)
 
bool operator!= (const public_key &p1, const public_key &p2)
 
bool operator< (const public_key &p1, const public_key &p2)
 

Detailed Description

Definition at line 23 of file public_key.hpp.

Member Typedef Documentation

◆ storage_type

Constructor & Destructor Documentation

◆ public_key() [1/6]

fc::crypto::public_key::public_key ( )
default

◆ public_key() [2/6]

fc::crypto::public_key::public_key ( public_key && )
default

◆ public_key() [3/6]

fc::crypto::public_key::public_key ( const public_key & )
default

◆ public_key() [4/6]

fc::crypto::public_key::public_key ( const signature & c,
const sha256 & digest,
bool check_canonical = true )

Definition at line 22 of file public_key.cpp.

23 :_storage(std::visit(recovery_visitor(digest, check_canonical), c._storage))
24 {
25 }
fc::sha256 digest(const T &value)
Definition digest.hpp:9

◆ public_key() [5/6]

fc::crypto::public_key::public_key ( storage_type && other_storage)
inline

Definition at line 35 of file public_key.hpp.

36 :_storage(forward<storage_type>(other_storage))
37 {}

◆ public_key() [6/6]

fc::crypto::public_key::public_key ( const string & base58str)
explicit

Definition at line 59 of file public_key.cpp.

60 :_storage(parse_base58(base58str))
61 {}

Member Function Documentation

◆ operator=()

public_key & fc::crypto::public_key::operator= ( const public_key & )
default

◆ to_string()

std::string fc::crypto::public_key::to_string ( const fc::yield_function_t & yield = fc::yield_function_t()) const

Definition at line 75 of file public_key.cpp.

76 {
77 auto data_str = std::visit(base58str_visitor<storage_type, config::public_key_prefix, 0>(yield), _storage);
78
79 auto which = _storage.index();
80 if (which == 0) {
81 return std::string(config::public_key_legacy_prefix) + data_str;
82 } else {
83 return std::string(config::public_key_base_prefix) + "_" + data_str;
84 }
85 }
size_t which() const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ valid()

bool fc::crypto::public_key::valid ( ) const

Definition at line 70 of file public_key.cpp.

71 {
72 return std::visit(is_valid_visitor(), _storage);
73 }

◆ which()

size_t fc::crypto::public_key::which ( ) const

Definition at line 27 of file public_key.cpp.

27 {
28 return _storage.index();
29 }
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const public_key & p1,
const public_key & p2 )
friend

Definition at line 96 of file public_key.cpp.

96 {
97 return !(p1 == p2);
98 }

◆ operator<

bool operator< ( const public_key & p1,
const public_key & p2 )
friend

Definition at line 100 of file public_key.cpp.

101 {
102 return less_comparator<public_key::storage_type>::apply(p1._storage, p2._storage);
103 }
static bool apply(const T &a, const T &b)
Definition common.hpp:147

◆ operator<<

std::ostream & operator<< ( std::ostream & s,
const public_key & k )
friend

Definition at line 87 of file public_key.cpp.

87 {
88 s << "public_key(" << k.to_string() << ')';
89 return s;
90 }
char * s

◆ operator==

bool operator== ( const public_key & p1,
const public_key & p2 )
friend

Definition at line 92 of file public_key.cpp.

92 {
93 return eq_comparator<public_key::storage_type>::apply(p1._storage, p2._storage);
94 }
static bool apply(const T &a, const T &b)
Definition common.hpp:119

◆ private_key

friend class private_key
friend

Definition at line 55 of file public_key.hpp.

◆ reflector< public_key >

friend struct reflector< public_key >
friend

Definition at line 53 of file public_key.hpp.

Member Data Documentation

◆ _storage

storage_type fc::crypto::public_key::_storage

Definition at line 47 of file public_key.hpp.


The documentation for this class was generated from the following files: