Repository navigation
Expand file tree
/
Copy pathPrefixes.h
More file actions
65 lines (51 loc) · 1.54 KB
/
Copy pathPrefixes.h
File metadata and controls
65 lines (51 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright © 2017-2020 Trust Wallet.
//
// This file is part of Trust. The full Trust copyright notice, including
// terms governing use, modification, and redistribution, is contained in the
// file LICENSE at the root of the source code distribution tree.
#pragma once
#include <string>
namespace TW::EOS {
enum class Type {
Legacy,
ModernK1,
ModernR1,
};
namespace Legacy {
static const std::string prefix = "EOS";
};
namespace Modern {
static const std::string pubBasePrefix = "PUB";
static const std::string sigBasePrefix = "SIG";
namespace K1 {
static const std::string prefix = "K1";
static const std::string fullPubPrefix = pubBasePrefix + "_" + Modern::K1::prefix + "_";
static const std::string fullSigPrefix = sigBasePrefix + "_" + Modern::K1::prefix + "_";
};
namespace R1 {
static const std::string prefix = "R1";
static const std::string fullPubPrefix = pubBasePrefix + "_" + Modern::R1::prefix + "_";
static const std::string fullSigPrefix = sigBasePrefix + "_" + Modern::R1::prefix + "_";
};
};
inline std::string pubPrefixForType(Type t) {
switch (t) {
case Type::Legacy:
return Legacy::prefix;
case Type::ModernK1:
return Modern::K1::fullPubPrefix;
case Type::ModernR1:
return Modern::R1::fullPubPrefix;
}
}
inline std::string sigPrefixForType(Type t) {
switch (t) {
case Type::Legacy:
return Legacy::prefix;
case Type::ModernK1:
return Modern::K1::fullSigPrefix;
case Type::ModernR1:
return Modern::R1::fullSigPrefix;
}
}
} // namespace TW::EOS