-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmuxedaccount.x
53 lines (45 loc) · 1.09 KB
/
muxedaccount.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
typedef unsigned hyper uint64;
typedef opaque uint256[32];
enum CryptoKeyType
{
KEY_TYPE_ED25519 = 0,
KEY_TYPE_MUXED_ED25519 = 256,
KEY_TYPE_PRE_AUTH_TX = 1,
KEY_TYPE_HASH_X = 2
};
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
};
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;
};
// Source or destination of a payment operation
union MuxedAccount switch (CryptoKeyType type) {
case KEY_TYPE_ED25519:
uint256 ed25519;
case KEY_TYPE_MUXED_ED25519:
struct {
uint64 id;
uint256 ed25519;
} med25519;
};