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