xrpld
Toggle main menu visibility
Loading...
Searching...
No Matches
include
xrpl
protocol
KeyType.h
1
#pragma once
2
3
#include <
optional
>
4
#include <
string
>
5
6
namespace
xrpl
{
7
8
enum class
KeyType
{
9
Secp256k1
= 0,
10
Ed25519
= 1,
11
};
12
13
inline
std::optional<KeyType>
14
keyTypeFromString
(
std::string
const
& s)
15
{
16
if
(s ==
"secp256k1"
)
17
return
KeyType::Secp256k1
;
18
19
if
(s ==
"ed25519"
)
20
return
KeyType::Ed25519
;
21
22
return
{};
23
}
24
25
inline
char
const
*
26
to_string
(
KeyType
type)
27
{
28
if
(type ==
KeyType::Secp256k1
)
29
return
"secp256k1"
;
30
31
if
(type ==
KeyType::Ed25519
)
32
return
"ed25519"
;
33
34
return
"INVALID"
;
35
}
36
37
template
<
class
Stream>
38
inline
Stream&
39
operator<<
(Stream& s,
KeyType
type)
40
{
41
return
s <<
to_string
(type);
42
}
43
44
}
// namespace xrpl
std::string
xrpl
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition
algorithm.h:5
xrpl::KeyType
KeyType
Definition
KeyType.h:8
xrpl::KeyType::Secp256k1
@ Secp256k1
Definition
KeyType.h:9
xrpl::KeyType::Ed25519
@ Ed25519
Definition
KeyType.h:10
xrpl::keyTypeFromString
std::optional< KeyType > keyTypeFromString(std::string const &s)
Definition
KeyType.h:14
xrpl::operator<<
std::ostream & operator<<(std::ostream &out, BaseUInt< Bits, Tag > const &u)
Definition
base_uint.h:672
xrpl::to_string
std::string to_string(BaseUInt< Bits, Tag > const &a)
Definition
base_uint.h:657
optional
string
Generated by
1.17.0