rippled
tokens.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 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_PROTOCOL_TOKENS_H_INCLUDED
21 #define RIPPLE_PROTOCOL_TOKENS_H_INCLUDED
22 
23 #include <cstdint>
24 #include <optional>
25 #include <string>
26 
27 namespace ripple {
28 
29 enum class TokenType : std::uint8_t {
30  None = 1, // unused
31  NodePublic = 28,
32  NodePrivate = 32,
33  AccountID = 0,
34  AccountPublic = 35,
35  AccountSecret = 34,
36  FamilyGenerator = 41, // unused
37  FamilySeed = 33
38 };
39 
40 template <class T>
42 parseBase58(std::string const& s);
43 
44 template <class T>
46 parseBase58(TokenType type, std::string const& s);
47 
60 encodeBase58Token(TokenType type, void const* token, std::size_t size);
61 
72 
73 } // namespace ripple
74 
75 #endif
std::string
STL class.
ripple::TokenType::FamilyGenerator
@ FamilyGenerator
ripple::decodeBase58Token
std::string decodeBase58Token(std::string const &s, TokenType type)
Decode a token of given type encoded using Base58Check and the XRPL alphabet.
Definition: tokens.cpp:223
ripple::TokenType::None
@ None
ripple::base_uint
Integers of any length that is a multiple of 32-bits.
Definition: base_uint.h:82
ripple::TokenType::FamilySeed
@ FamilySeed
ripple::TokenType
TokenType
Definition: tokens.h:29
cstdint
std::uint8_t
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::encodeBase58Token
std::string encodeBase58Token(TokenType type, void const *token, std::size_t size)
Encode data in Base58Check format using XRPL alphabet.
Definition: tokens.cpp:199
ripple::TokenType::AccountSecret
@ AccountSecret
ripple::TokenType::AccountPublic
@ AccountPublic
ripple::TokenType::NodePublic
@ NodePublic
optional
std::size_t
ripple::parseBase58
std::optional< AccountID > parseBase58(std::string const &s)
Parse AccountID from checked, base58 string.
Definition: AccountID.cpp:114
ripple::TokenType::NodePrivate
@ NodePrivate
string