-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathStellar-types.x
137 lines (113 loc) · 2.97 KB
/
Stellar-types.x
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Copyright 2015 Stellar Development Foundation and contributors. Licensed
// under the Apache License, Version 2.0. See the COPYING file at the root
// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0
namespace stellar
{
typedef opaque Hash[32];
typedef opaque uint256[32];
typedef unsigned int uint32;
typedef int int32;
typedef unsigned hyper uint64;
typedef hyper int64;
typedef uint64 TimePoint;
typedef uint64 Duration;
// An ExtensionPoint is always marshaled as a 32-bit 0 value. At a
// later point, it can be replaced by a different union so as to
// extend a structure.
union ExtensionPoint switch (int v)
{
case 0:
void;
};
enum CryptoKeyType
{
KEY_TYPE_ED25519 = 0,
KEY_TYPE_PRE_AUTH_TX = 1,
KEY_TYPE_HASH_X = 2,
KEY_TYPE_ED25519_SIGNED_PAYLOAD = 3,
// MUXED enum values for supported type are derived from the enum values
// above by ORing them with 0x100
KEY_TYPE_MUXED_ED25519 = 0x100
};
enum PublicKeyType
{
PUBLIC_KEY_TYPE_ED25519 = KEY_TYPE_ED25519
};
enum SignerKeyType
{
SIGNER_KEY_TYPE_ED25519 = KEY_TYPE_ED25519,
SIGNER_KEY_TYPE_PRE_AUTH_TX = KEY_TYPE_PRE_AUTH_TX,
SIGNER_KEY_TYPE_HASH_X = KEY_TYPE_HASH_X,
SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD = KEY_TYPE_ED25519_SIGNED_PAYLOAD
};
union PublicKey switch (PublicKeyType type)
{
case PUBLIC_KEY_TYPE_ED25519:
uint256 ed25519;
};
union SignerKey switch (SignerKeyType type)
{
case SIGNER_KEY_TYPE_ED25519:
uint256 ed25519;
case SIGNER_KEY_TYPE_PRE_AUTH_TX:
/* SHA-256 Hash of TransactionSignaturePayload structure */
uint256 preAuthTx;
case SIGNER_KEY_TYPE_HASH_X:
/* Hash of random 256 bit preimage X */
uint256 hashX;
case SIGNER_KEY_TYPE_ED25519_SIGNED_PAYLOAD:
struct
{
/* Public key that must sign the payload. */
uint256 ed25519;
/* Payload to be raw signed by ed25519. */
opaque payload<64>;
} ed25519SignedPayload;
};
// variable size as the size depends on the signature scheme used
typedef opaque Signature<64>;
typedef opaque SignatureHint[4];
typedef PublicKey NodeID;
typedef PublicKey AccountID;
struct Curve25519Secret
{
opaque key[32];
};
struct Curve25519Public
{
opaque key[32];
};
struct HmacSha256Key
{
opaque key[32];
};
struct HmacSha256Mac
{
opaque mac[32];
};
struct ShortHashSeed
{
opaque seed[16];
};
enum BinaryFuseFilterType
{
BINARY_FUSE_FILTER_8_BIT = 0,
BINARY_FUSE_FILTER_16_BIT = 1,
BINARY_FUSE_FILTER_32_BIT = 2
};
struct SerializedBinaryFuseFilter
{
BinaryFuseFilterType type;
// Seed used to hash input to filter
ShortHashSeed inputHashSeed;
// Seed used for internal filter hash operations
ShortHashSeed filterSeed;
uint32 segmentLength;
uint32 segementLengthMask;
uint32 segmentCount;
uint32 segmentCountLength;
uint32 fingerprintLength; // Length in terms of element count, not bytes
// Array of uint8_t, uint16_t, or uint32_t depending on filter type
opaque fingerprints<>;
};
}