20#include <xrpld/app/misc/Manifest.h>
21#include <xrpld/app/misc/ValidatorKeys.h>
22#include <xrpld/core/Config.h>
23#include <xrpld/core/ConfigSections.h>
24#include <xrpl/basics/Log.h>
25#include <xrpl/basics/base64.h>
30 if (config.
exists(SECTION_VALIDATOR_TOKEN) &&
31 config.
exists(SECTION_VALIDATION_SEED))
34 JLOG(j.
fatal()) <<
"Cannot specify both [" SECTION_VALIDATION_SEED
35 "] and [" SECTION_VALIDATOR_TOKEN
"]";
39 if (config.
exists(SECTION_VALIDATOR_TOKEN))
49 if (!m || pk != m->signingKey)
53 <<
"Invalid token specified in [" SECTION_VALIDATOR_TOKEN
58 keys.emplace(m->masterKey, pk, token->validationSecret);
61 manifest = std::move(token->manifest);
68 <<
"Invalid token specified in [" SECTION_VALIDATOR_TOKEN
"]";
71 else if (config.
exists(SECTION_VALIDATION_SEED))
73 auto const seed = parseBase58<Seed>(
79 <<
"Invalid seed specified in [" SECTION_VALIDATION_SEED
"]";
85 keys.emplace(pk, pk, sk);
A generic endpoint for log messages.
bool exists(std::string const &name) const
Returns true if a section with the given name exists.
Section & section(std::string const &name)
Returns the section with the given name.
std::vector< std::string > const & lines() const
Returns all the lines in the section.
std::optional< Keys > keys
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.
std::string base64_decode(std::string_view data)
PublicKey derivePublicKey(KeyType type, SecretKey const &sk)
Derive the public key from a secret key.
SecretKey generateSecretKey(KeyType type, Seed const &seed)
Generate a new secret key deterministically.
NodeID calcNodeID(PublicKey const &)
Calculate the 160-bit node ID from a node public key.
std::optional< ValidatorToken > loadValidatorToken(std::vector< std::string > const &blob, beast::Journal journal)