20#ifndef RIPPLE_PROTOCOL_PUBLICKEY_H_INCLUDED 
   21#define RIPPLE_PROTOCOL_PUBLICKEY_H_INCLUDED 
   23#include <xrpl/basics/Slice.h> 
   24#include <xrpl/beast/net/IPEndpoint.h> 
   25#include <xrpl/protocol/KeyType.h> 
   26#include <xrpl/protocol/STExchange.h> 
   27#include <xrpl/protocol/UintTypes.h> 
   28#include <xrpl/protocol/json_get_or_throw.h> 
   29#include <xrpl/protocol/tokens.h> 
  155template <
class Hasher>
 
  243    PublicKey 
const& publicKey,
 
  246    bool mustBeFullyCanonical = 
true) noexcept;
 
  254    PublicKey const& publicKey,
 
  257    bool mustBeFullyCanonical = true) noexcept;
 
  270    beast::IP::Endpoint const& address,
 
  272    std::optional<
std::
string> const& 
id = 
std::nullopt)
 
  275    ss << 
"IP Address: " << address;
 
  276    if (publicKey.has_value())
 
  282        ss << 
", Id: " << 
id.value();
 
 
  296    std::string const b58 = getOrThrow<std::string>(v, field);
 
  297    if (
auto pubKeyBlob = strUnHex(b58); publicKeyType(makeSlice(*pubKeyBlob)))
 
  299        return PublicKey{makeSlice(*pubKeyBlob)};
 
  301    for (
auto const tokenType :
 
  302         {TokenType::NodePublic, TokenType::AccountPublic})
 
  304        if (
auto const pk = parseBase58<PublicKey>(tokenType, b58))
 
  307    Throw<JsonTypeMismatchError>(field.getJsonName(), 
"PublicKey");
 
 
std::uint8_t const * data() const noexcept
 
std::uint8_t const  * const_iterator
 
std::size_t size() const noexcept
 
static constexpr std::size_t size_
 
const_iterator begin() const noexcept
 
const_iterator cbegin() const noexcept
 
const_iterator cend() const noexcept
 
const_iterator end() const noexcept
 
Slice slice() const noexcept
 
PublicKey & operator=(PublicKey const &other)
 
std::uint8_t const * data() const
 
An immutable linear range of bytes.
 
T lexicographical_compare(T... args)
 
JSON (JavaScript Object Notation).
 
ripple::AccountID getOrThrow(Json::Value const &v, ripple::SField const &field)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
base_uint< 160, detail::AccountIDTag > AccountID
A 160-bit unsigned that uniquely identifies an account.
 
std::optional< ECDSACanonicality > ecdsaCanonicality(Slice const &sig)
Determines the canonicality of a signature.
 
void hash_append(Hasher &h, Slice const &v)
 
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
 
bool verifyDigest(PublicKey const &publicKey, uint256 const &digest, Slice const &sig, bool mustBeFullyCanonical=true) noexcept
Verify a secp256k1 signature on the digest of a message.
 
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
 
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical=true) noexcept
Verify a signature on a message.
 
base_uint< 160, detail::NodeIDTag > NodeID
NodeID is a 160-bit hash representing one node.
 
std::ostream & operator<<(std::ostream &out, base_uint< Bits, Tag > const &u)
 
std::string encodeBase58Token(TokenType type, void const *token, std::size_t size)
Encode data in Base58Check format using XRPL alphabet.
 
AccountID calcAccountID(PublicKey const &pk)
 
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
 
static Hasher::result_type digest(void const *data, std::size_t size) noexcept
 
NodeID calcNodeID(PublicKey const &)
Calculate the 160-bit node ID from a node public key.
 
std::string getFingerprint(beast::IP::Endpoint const &address, std::optional< PublicKey > const &publicKey=std::nullopt, std::optional< std::string > const &id=std::nullopt)
 
bool operator<(Slice const &lhs, Slice const &rhs) noexcept
 
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
 
static void get(std::optional< value_type > &t, STBlob const &u)
 
static std::unique_ptr< STBlob > set(SField const &f, PublicKey const &t)
 
Convert between serialized type U and C++ type T.