1#ifndef XRPL_APP_MISC_MANIFEST_H_INCLUDED
2#define XRPL_APP_MISC_MANIFEST_H_INCLUDED
4#include <xrpl/basics/UnorderedContainers.h>
5#include <xrpl/beast/utility/Journal.h>
6#include <xrpl/protocol/PublicKey.h>
7#include <xrpl/protocol/SecretKey.h>
182 return !(lhs == rhs);
223 return "badMasterKey";
225 return "badEphemeralKey";
404 template <
class Function>
432 template <
class PreFun,
class EachFun>
A generic endpoint for log messages.
static Sink & getNullSink()
Returns a Sink which does nothing.
Remembers manifests with the highest sequence number.
std::optional< std::uint32_t > getSequence(PublicKey const &pk) const
Returns master key's current manifest sequence.
hash_map< PublicKey, PublicKey > signingToMasterKeys_
Master public keys stored by current ephemeral public key.
ManifestCache(beast::Journal j=beast::Journal(beast::Journal::getNullSink()))
std::optional< std::string > getManifest(PublicKey const &pk) const
Returns mainfest corresponding to a given public key.
std::optional< PublicKey > getSigningKey(PublicKey const &pk) const
Returns master key's current signing key.
std::uint32_t sequence() const
A monotonically increasing number used to detect new manifests.
void for_each_manifest(Function &&f) const
Invokes the callback once for every populated manifest.
ManifestDisposition applyManifest(Manifest m)
Add manifest to cache.
hash_map< PublicKey, Manifest > map_
Active manifests stored by master public key.
bool load(DatabaseCon &dbCon, std::string const &dbTable, std::string const &configManifest, std::vector< std::string > const &configRevocation)
Populate manifest cache with manifests in database and config.
std::atomic< std::uint32_t > seq_
void for_each_manifest(PreFun &&pf, EachFun &&f) const
Invokes the callback once for every populated manifest.
void save(DatabaseCon &dbCon, std::string const &dbTable, std::function< bool(PublicKey const &)> const &isTrusted)
Save cached manifests to database.
PublicKey getMasterKey(PublicKey const &pk) const
Returns ephemeral signing key's master public key.
std::optional< std::string > getDomain(PublicKey const &pk) const
Returns domain claimed by a given public key.
An immutable linear range of bytes.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::optional< Manifest > deserializeManifest(Slice s, beast::Journal journal)
Constructs Manifest from serialized string.
bool operator!=(Buffer const &lhs, Buffer const &rhs) noexcept
@ badMasterKey
The master key is not acceptable to us.
@ stale
Sequence is too old.
@ accepted
Manifest is valid.
@ badEphemeralKey
The ephemeral key is not acceptable to us.
@ invalid
Timely, but invalid signature.
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)
std::string to_string(base_uint< Bits, Tag > const &a)
std::optional< ValidatorToken > loadValidatorToken(std::vector< std::string > const &blob, beast::Journal journal)
constexpr bool operator==(base_uint< Bits, Tag > const &lhs, base_uint< Bits, Tag > const &rhs)
std::string serialized
The manifest in serialized form.
Manifest(std::string const &serialized_, PublicKey const &masterKey_, std::optional< PublicKey > const &signingKey_, std::uint32_t seq, std::string const &domain_)
std::uint32_t sequence
The sequence number of this manifest.
Manifest(Manifest &&other)=default
std::string domain
The domain, if one was specified in the manifest; empty otherwise.
bool revoked() const
Returns true if manifest revokes master key.
Manifest(Manifest const &other)=delete
bool verify() const
Returns true if manifest signature is valid.
Manifest & operator=(Manifest const &other)=delete
uint256 hash() const
Returns hash of serialized manifest data.
std::optional< Blob > getSignature() const
Returns manifest signature.
std::optional< PublicKey > signingKey
The ephemeral key associated with this manifest.
Blob getMasterSignature() const
Returns manifest master key signature.
PublicKey masterKey
The master key associated with this manifest.
Manifest & operator=(Manifest &&other)=default
SecretKey validationSecret