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
28#include <string>
29
30namespace ripple {
31
32class Config;
33
38{
39public:
40 // Group all keys in a struct. Either all keys are valid or none are.
41 struct Keys
42 {
46
47 Keys() = delete;
49 PublicKey const& masterPublic_,
50 PublicKey const& public_,
51 SecretKey const& secret_)
52 : masterPublicKey(masterPublic_)
53 , publicKey(public_)
54 , secretKey(secret_)
55 {
56 }
57 };
58
59 // Note: The existence of keys cannot be used as a proxy for checking the
60 // validity of a configuration. It is possible to have a valid
61 // configuration while not setting the keys, as per the constructor of
62 // the ValidatorKeys class.
67
68 ValidatorKeys() = delete;
69 ValidatorKeys(Config const& config, beast::Journal j);
70
71 bool
73 {
74 return configInvalid_;
75 }
76
77private:
78 bool configInvalid_ = false; //< Set to true if config was invalid
79};
80
81} // namespace ripple
82
83#endif
A generic endpoint for log messages.
Definition: Journal.h:60
A public key.
Definition: PublicKey.h:62
A secret key.
Definition: SecretKey.h:38
Validator keys and manifest as set in configuration file.
Definition: ValidatorKeys.h:38
bool configInvalid() const
Definition: ValidatorKeys.h:72
std::optional< Keys > keys
Definition: ValidatorKeys.h:63
std::uint32_t sequence
Definition: ValidatorKeys.h:66
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:48