20#ifndef RIPPLE_PROTOCOL_PUBLICKEY_H_INCLUDED
21#define RIPPLE_PROTOCOL_PUBLICKEY_H_INCLUDED
23#include <xrpl/basics/Slice.h>
24#include <xrpl/protocol/KeyType.h>
25#include <xrpl/protocol/STExchange.h>
26#include <xrpl/protocol/UintTypes.h>
27#include <xrpl/protocol/json_get_or_throw.h>
28#include <xrpl/protocol/tokens.h>
154template <
class Hasher>
242 PublicKey
const& publicKey,
245 bool mustBeFullyCanonical =
true) noexcept;
253 PublicKey const& publicKey,
256 bool mustBeFullyCanonical = true) noexcept;
277 std::string const b58 = getOrThrow<std::string>(v, field);
282 for (
auto const tokenType :
285 if (
auto const pk = parseBase58<PublicKey>(tokenType, b58))
288 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< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
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
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
NodeID calcNodeID(PublicKey const &)
Calculate the 160-bit node ID from a node public key.
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.