UNPKG

2.9 kBJavaScriptView Raw
1/*
2
3These are used as defaults usually if the API consumer does not provide their
4own. For security purposes someone should at some point inspect the default
5values.
6
7*/
8
9let values = Object.freeze({
10 //
11 // used in many places to add or remove this value
12 //
13 zeroX: '0x',
14 //
15 // eth-lib/nat
16 // whatever that is it uses these values extensively
17 //
18 nat: {
19 zero: '0x0',
20 one: '0x1'
21 },
22 //
23 // utils.toHex
24 // randomHex
25 //
26 hex: {
27 zero: '0x00',
28 one: '0x01',
29 // used for creating accounts
30 // 32 bytes was used for the eth module
31 // SECURITY: is this secure enough?
32 randomHexSize: 32
33 },
34 //
35 // Aion solidity
36 //
37 maxIntSize: 128,
38 rpc: {
39 url: 'http://127.0.0.1:8545'
40 },
41 addresses: {
42 // addresses start with 0xAO identifier
43 identifier: new Buffer('a0', 'hex'),
44 // without 0x
45 nonNumericLength: 64,
46 // with 0x
47 numericLength: 66,
48 bytesLength: 32
49 },
50 //
51 // crypto defaults
52 // mostly taken from ethereum web3
53 // SECURITY: should have a look some time
54 //
55 crypto: {
56 saltLength: 32,
57 ivLength: 16,
58 kdf: 'script',
59 dklen: 32,
60 pbkdf2: {
61 c: 262144,
62 prf: 'hmac-sha256',
63 digest: 'sha256'
64 },
65 scrypt: {
66 n: 8192,
67 r: 8,
68 p: 2
69 },
70 cipherIvAlgorithm: 'aes-128-ctr',
71 uuidRandomBytes: 16
72 },
73 //
74 // solidity types
75 //
76 solidity: {
77 //
78 // utils.solidityPack
79 //
80 pack: {
81 zero: '00',
82 one: '01'
83 },
84
85 dimensionStartChar: '[',
86 dimensionEndChar: ']',
87 dimensionsDynamic: '[]',
88 /*
89
90 solidity type-specific information
91
92 */
93 types: {
94 function: {
95 // encoded(hashed) signature is short
96 byteLengthEncoded: 4,
97 bytelength: 16
98 },
99 bool: {
100 pad: 'left',
101 byteLength: 16,
102 stringLength: 32,
103 zero: '00000000000000000000000000000000',
104 one: '00000000000000000000000000000001'
105 },
106 uint: {
107 pad: 'left',
108 byteLength: 16,
109 stringLength: 32,
110 numeric: true
111 },
112 int: {
113 pad: 'left',
114 byteLength: 16,
115 stringLength: 32,
116 numeric: true
117 },
118 fixed: {
119 pad: 'left',
120 byteLength: 16,
121 stringLength: 32,
122 numeric: true
123 },
124 ufixed: {
125 pad: 'left',
126 byteLength: 16,
127 stringLength: 32,
128 numeric: true
129 },
130 address: {
131 // acts as uint256
132 // the only exception
133 pad: 'left',
134 byteLength: 32,
135 stringLength: 64
136 },
137 bytes: {
138 pad: 'right',
139 dynamic: true,
140 byteLength: 32,
141 stringLength: 64
142 },
143 string: {
144 pad: 'right',
145 dynamic: true,
146 byteLength: 32,
147 stringLength: 64
148 }
149 },
150 numericTypes: ['uint', 'int', 'fixed', 'ufixed']
151 }
152})
153
154module.exports = values