rippled
ripple
app
misc
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 <ripple/beast/utility/Journal.h>
24
#include <ripple/protocol/PublicKey.h>
25
#include <ripple/protocol/SecretKey.h>
26
#include <ripple/protocol/UintTypes.h>
27
#include <
string
>
28
29
namespace
ripple
{
30
31
class
Config;
32
36
class
ValidatorKeys
37
{
38
public
:
39
// Group all keys in a struct. Either all keys are valid or none are.
40
struct
Keys
41
{
42
PublicKey
masterPublicKey
;
43
PublicKey
publicKey
;
44
SecretKey
secretKey
;
45
46
Keys
() =
delete
;
47
Keys
(
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.
62
std::optional<Keys>
keys
;
63
NodeID
nodeID
;
64
std::string
manifest
;
65
std::uint32_t
sequence
= 0;
66
67
ValidatorKeys
() =
delete
;
68
ValidatorKeys
(
Config
const
& config,
beast::Journal
j);
69
70
bool
71
configInvalid
()
const
72
{
73
return
configInvalid_
;
74
}
75
76
private
:
77
bool
configInvalid_
=
false
;
//< Set to true if config was invalid
78
};
79
80
}
// namespace ripple
81
82
#endif
ripple::ValidatorKeys::Keys::Keys
Keys()=delete
std::string
STL class.
ripple::ValidatorKeys::ValidatorKeys
ValidatorKeys()=delete
ripple::ValidatorKeys::Keys::publicKey
PublicKey publicKey
Definition:
ValidatorKeys.h:43
ripple::ValidatorKeys::nodeID
NodeID nodeID
Definition:
ValidatorKeys.h:63
ripple::ValidatorKeys
Validator keys and manifest as set in configuration file.
Definition:
ValidatorKeys.h:36
ripple::base_uint< 160, detail::NodeIDTag >
ripple::ValidatorKeys::Keys::masterPublicKey
PublicKey masterPublicKey
Definition:
ValidatorKeys.h:42
ripple::PublicKey
A public key.
Definition:
PublicKey.h:61
ripple::Config
Definition:
Config.h:92
ripple::ValidatorKeys::keys
std::optional< Keys > keys
Definition:
ValidatorKeys.h:62
ripple::ValidatorKeys::Keys
Definition:
ValidatorKeys.h:40
ripple::ValidatorKeys::configInvalid
bool configInvalid() const
Definition:
ValidatorKeys.h:71
beast::Journal
A generic endpoint for log messages.
Definition:
Journal.h:58
std::uint32_t
ripple::SecretKey
A secret key.
Definition:
SecretKey.h:36
ripple::ValidatorKeys::Keys::Keys
Keys(PublicKey const &masterPublic_, PublicKey const &public_, SecretKey const &secret_)
Definition:
ValidatorKeys.h:47
ripple::ValidatorKeys::Keys::secretKey
SecretKey secretKey
Definition:
ValidatorKeys.h:44
ripple::ValidatorKeys::configInvalid_
bool configInvalid_
Definition:
ValidatorKeys.h:77
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition:
RCLCensorshipDetector.h:29
std::optional
ripple::ValidatorKeys::sequence
std::uint32_t sequence
Definition:
ValidatorKeys.h:65
ripple::ValidatorKeys::manifest
std::string manifest
Definition:
ValidatorKeys.h:64
string
Generated by
1.8.17