rippled
Loading...
Searching...
No Matches
ValidatorKeys.h
1//------------------------------------------------------------------------------
2/*
3 This file is part of rippled: https://github.com/ripple/rippled
4 Copyright (c) 2012-2017 Ripple Labs Inc.
5
6 Permission to use, copy, modify, and/or distribute this software for any
7 purpose with or without fee is hereby granted, provided that the above
8 copyright notice and this permission notice appear in all copies.
9
10 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*/
18//==============================================================================
19
20#ifndef RIPPLE_APP_MISC_VALIDATOR_KEYS_H_INCLUDED
21#define RIPPLE_APP_MISC_VALIDATOR_KEYS_H_INCLUDED
22
23#include <xrpl/beast/utility/Journal.h>
24#include <xrpl/protocol/PublicKey.h>
25#include <xrpl/protocol/SecretKey.h>
26#include <xrpl/protocol/UintTypes.h>
27#include <string>
28
29namespace ripple {
30
31class Config;
32
37{
38public:
39 // Group all keys in a struct. Either all keys are valid or none are.
40 struct Keys
41 {
45
46 Keys() = delete;
48 PublicKey const& masterPublic_,
49 PublicKey const& public_,
50 SecretKey const& secret_)
51 : masterPublicKey(masterPublic_)
52 , publicKey(public_)
53 , secretKey(secret_)
54 {
55 }
56 };
57
58 // Note: The existence of keys cannot be used as a proxy for checking the
59 // validity of a configuration. It is possible to have a valid
60 // configuration while not setting the keys, as per the constructor of
61 // the ValidatorKeys class.
66
67 ValidatorKeys() = delete;
68 ValidatorKeys(Config const& config, beast::Journal j);
69
70 bool
72 {
73 return configInvalid_;
74 }
75
76private:
77 bool configInvalid_ = false; //< Set to true if config was invalid
78};
79
80} // namespace ripple
81
82#endif
A generic endpoint for log messages.
Definition: Journal.h:59
A public key.
Definition: PublicKey.h:62
A secret key.
Definition: SecretKey.h:37
Validator keys and manifest as set in configuration file.
Definition: ValidatorKeys.h:37
bool configInvalid() const
Definition: ValidatorKeys.h:71
std::optional< Keys > keys
Definition: ValidatorKeys.h:62
std::uint32_t sequence
Definition: ValidatorKeys.h:65
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: algorithm.h:26
Keys(PublicKey const &masterPublic_, PublicKey const &public_, SecretKey const &secret_)
Definition: ValidatorKeys.h:47