@zubari/sdk 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/TransactionService-CxwB1kpN.d.mts +205 -0
  2. package/dist/TransactionService-DdL6H6M-.d.ts +205 -0
  3. package/dist/{WalletManager-TiAdzqrn.d.ts → WalletManager-CYJNiww6.d.ts} +49 -132
  4. package/dist/{WalletManager-DJjdq89b.d.mts → WalletManager-Dmmcbtiw.d.mts} +49 -132
  5. package/dist/{index-BLuxEdLp.d.mts → index-DhluuR9H.d.mts} +1 -1
  6. package/dist/{index-BLuxEdLp.d.ts → index-DhluuR9H.d.ts} +1 -1
  7. package/dist/{index-DO3T2HVe.d.ts → index-OxzgPoRG.d.ts} +2 -2
  8. package/dist/{index-fXVD8_D0.d.mts → index-poGbMJzn.d.mts} +2 -2
  9. package/dist/index.d.mts +5 -6
  10. package/dist/index.d.ts +5 -6
  11. package/dist/index.js +3057 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +3055 -3
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/protocols/index.d.mts +1 -1
  16. package/dist/protocols/index.d.ts +1 -1
  17. package/dist/react/index.d.mts +4 -5
  18. package/dist/react/index.d.ts +4 -5
  19. package/dist/react/index.js +2649 -3
  20. package/dist/react/index.js.map +1 -1
  21. package/dist/react/index.mjs +2649 -3
  22. package/dist/react/index.mjs.map +1 -1
  23. package/dist/services/index.d.mts +87 -3
  24. package/dist/services/index.d.ts +87 -3
  25. package/dist/services/index.js +3065 -2
  26. package/dist/services/index.js.map +1 -1
  27. package/dist/services/index.mjs +3062 -3
  28. package/dist/services/index.mjs.map +1 -1
  29. package/dist/wallet/index.d.mts +4 -5
  30. package/dist/wallet/index.d.ts +4 -5
  31. package/dist/wallet/index.js +2650 -2
  32. package/dist/wallet/index.js.map +1 -1
  33. package/dist/wallet/index.mjs +2650 -2
  34. package/dist/wallet/index.mjs.map +1 -1
  35. package/package.json +6 -1
  36. package/dist/SwapService-C0G8IXW2.d.mts +0 -35
  37. package/dist/SwapService-DZD0OJI_.d.ts +0 -35
package/dist/index.js CHANGED
@@ -3,8 +3,2465 @@
3
3
  var ethers = require('ethers');
4
4
  var viem = require('viem');
5
5
  var chains = require('viem/chains');
6
+ var bip39 = require('@scure/bip39');
7
+ require('@scure/bip39/wordlists/english');
8
+ var bip32 = require('@scure/bip32');
9
+ var base = require('@scure/base');
10
+ var sha256 = require('@noble/hashes/sha256');
11
+ var ripemd160 = require('@noble/hashes/ripemd160');
6
12
  var react = require('react');
7
13
 
14
+ var __create = Object.create;
15
+ var __defProp = Object.defineProperty;
16
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
17
+ var __getOwnPropNames = Object.getOwnPropertyNames;
18
+ var __getProtoOf = Object.getPrototypeOf;
19
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
20
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
21
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
22
+ }) : x)(function(x) {
23
+ if (typeof require !== "undefined") return require.apply(this, arguments);
24
+ throw Error('Dynamic require of "' + x + '" is not supported');
25
+ });
26
+ var __commonJS = (cb, mod) => function __require2() {
27
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
45
+
46
+ // ../../node_modules/tweetnacl/nacl-fast.js
47
+ var require_nacl_fast = __commonJS({
48
+ "../../node_modules/tweetnacl/nacl-fast.js"(exports$1, module) {
49
+ (function(nacl) {
50
+ var gf = function(init) {
51
+ var i, r = new Float64Array(16);
52
+ if (init) for (i = 0; i < init.length; i++) r[i] = init[i];
53
+ return r;
54
+ };
55
+ var randombytes = function() {
56
+ throw new Error("no PRNG");
57
+ };
58
+ var _0 = new Uint8Array(16);
59
+ var _9 = new Uint8Array(32);
60
+ _9[0] = 9;
61
+ var gf0 = gf(), gf1 = gf([1]), _121665 = gf([56129, 1]), D = gf([30883, 4953, 19914, 30187, 55467, 16705, 2637, 112, 59544, 30585, 16505, 36039, 65139, 11119, 27886, 20995]), D2 = gf([61785, 9906, 39828, 60374, 45398, 33411, 5274, 224, 53552, 61171, 33010, 6542, 64743, 22239, 55772, 9222]), X = gf([54554, 36645, 11616, 51542, 42930, 38181, 51040, 26924, 56412, 64982, 57905, 49316, 21502, 52590, 14035, 8553]), Y = gf([26200, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214, 26214]), I = gf([41136, 18958, 6951, 50414, 58488, 44335, 6150, 12099, 55207, 15867, 153, 11085, 57099, 20417, 9344, 11139]);
62
+ function ts64(x, i, h, l) {
63
+ x[i] = h >> 24 & 255;
64
+ x[i + 1] = h >> 16 & 255;
65
+ x[i + 2] = h >> 8 & 255;
66
+ x[i + 3] = h & 255;
67
+ x[i + 4] = l >> 24 & 255;
68
+ x[i + 5] = l >> 16 & 255;
69
+ x[i + 6] = l >> 8 & 255;
70
+ x[i + 7] = l & 255;
71
+ }
72
+ function vn(x, xi, y, yi, n) {
73
+ var i, d = 0;
74
+ for (i = 0; i < n; i++) d |= x[xi + i] ^ y[yi + i];
75
+ return (1 & d - 1 >>> 8) - 1;
76
+ }
77
+ function crypto_verify_16(x, xi, y, yi) {
78
+ return vn(x, xi, y, yi, 16);
79
+ }
80
+ function crypto_verify_32(x, xi, y, yi) {
81
+ return vn(x, xi, y, yi, 32);
82
+ }
83
+ function core_salsa20(o, p, k, c) {
84
+ var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24;
85
+ var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u;
86
+ for (var i = 0; i < 20; i += 2) {
87
+ u = x0 + x12 | 0;
88
+ x4 ^= u << 7 | u >>> 32 - 7;
89
+ u = x4 + x0 | 0;
90
+ x8 ^= u << 9 | u >>> 32 - 9;
91
+ u = x8 + x4 | 0;
92
+ x12 ^= u << 13 | u >>> 32 - 13;
93
+ u = x12 + x8 | 0;
94
+ x0 ^= u << 18 | u >>> 32 - 18;
95
+ u = x5 + x1 | 0;
96
+ x9 ^= u << 7 | u >>> 32 - 7;
97
+ u = x9 + x5 | 0;
98
+ x13 ^= u << 9 | u >>> 32 - 9;
99
+ u = x13 + x9 | 0;
100
+ x1 ^= u << 13 | u >>> 32 - 13;
101
+ u = x1 + x13 | 0;
102
+ x5 ^= u << 18 | u >>> 32 - 18;
103
+ u = x10 + x6 | 0;
104
+ x14 ^= u << 7 | u >>> 32 - 7;
105
+ u = x14 + x10 | 0;
106
+ x2 ^= u << 9 | u >>> 32 - 9;
107
+ u = x2 + x14 | 0;
108
+ x6 ^= u << 13 | u >>> 32 - 13;
109
+ u = x6 + x2 | 0;
110
+ x10 ^= u << 18 | u >>> 32 - 18;
111
+ u = x15 + x11 | 0;
112
+ x3 ^= u << 7 | u >>> 32 - 7;
113
+ u = x3 + x15 | 0;
114
+ x7 ^= u << 9 | u >>> 32 - 9;
115
+ u = x7 + x3 | 0;
116
+ x11 ^= u << 13 | u >>> 32 - 13;
117
+ u = x11 + x7 | 0;
118
+ x15 ^= u << 18 | u >>> 32 - 18;
119
+ u = x0 + x3 | 0;
120
+ x1 ^= u << 7 | u >>> 32 - 7;
121
+ u = x1 + x0 | 0;
122
+ x2 ^= u << 9 | u >>> 32 - 9;
123
+ u = x2 + x1 | 0;
124
+ x3 ^= u << 13 | u >>> 32 - 13;
125
+ u = x3 + x2 | 0;
126
+ x0 ^= u << 18 | u >>> 32 - 18;
127
+ u = x5 + x4 | 0;
128
+ x6 ^= u << 7 | u >>> 32 - 7;
129
+ u = x6 + x5 | 0;
130
+ x7 ^= u << 9 | u >>> 32 - 9;
131
+ u = x7 + x6 | 0;
132
+ x4 ^= u << 13 | u >>> 32 - 13;
133
+ u = x4 + x7 | 0;
134
+ x5 ^= u << 18 | u >>> 32 - 18;
135
+ u = x10 + x9 | 0;
136
+ x11 ^= u << 7 | u >>> 32 - 7;
137
+ u = x11 + x10 | 0;
138
+ x8 ^= u << 9 | u >>> 32 - 9;
139
+ u = x8 + x11 | 0;
140
+ x9 ^= u << 13 | u >>> 32 - 13;
141
+ u = x9 + x8 | 0;
142
+ x10 ^= u << 18 | u >>> 32 - 18;
143
+ u = x15 + x14 | 0;
144
+ x12 ^= u << 7 | u >>> 32 - 7;
145
+ u = x12 + x15 | 0;
146
+ x13 ^= u << 9 | u >>> 32 - 9;
147
+ u = x13 + x12 | 0;
148
+ x14 ^= u << 13 | u >>> 32 - 13;
149
+ u = x14 + x13 | 0;
150
+ x15 ^= u << 18 | u >>> 32 - 18;
151
+ }
152
+ x0 = x0 + j0 | 0;
153
+ x1 = x1 + j1 | 0;
154
+ x2 = x2 + j2 | 0;
155
+ x3 = x3 + j3 | 0;
156
+ x4 = x4 + j4 | 0;
157
+ x5 = x5 + j5 | 0;
158
+ x6 = x6 + j6 | 0;
159
+ x7 = x7 + j7 | 0;
160
+ x8 = x8 + j8 | 0;
161
+ x9 = x9 + j9 | 0;
162
+ x10 = x10 + j10 | 0;
163
+ x11 = x11 + j11 | 0;
164
+ x12 = x12 + j12 | 0;
165
+ x13 = x13 + j13 | 0;
166
+ x14 = x14 + j14 | 0;
167
+ x15 = x15 + j15 | 0;
168
+ o[0] = x0 >>> 0 & 255;
169
+ o[1] = x0 >>> 8 & 255;
170
+ o[2] = x0 >>> 16 & 255;
171
+ o[3] = x0 >>> 24 & 255;
172
+ o[4] = x1 >>> 0 & 255;
173
+ o[5] = x1 >>> 8 & 255;
174
+ o[6] = x1 >>> 16 & 255;
175
+ o[7] = x1 >>> 24 & 255;
176
+ o[8] = x2 >>> 0 & 255;
177
+ o[9] = x2 >>> 8 & 255;
178
+ o[10] = x2 >>> 16 & 255;
179
+ o[11] = x2 >>> 24 & 255;
180
+ o[12] = x3 >>> 0 & 255;
181
+ o[13] = x3 >>> 8 & 255;
182
+ o[14] = x3 >>> 16 & 255;
183
+ o[15] = x3 >>> 24 & 255;
184
+ o[16] = x4 >>> 0 & 255;
185
+ o[17] = x4 >>> 8 & 255;
186
+ o[18] = x4 >>> 16 & 255;
187
+ o[19] = x4 >>> 24 & 255;
188
+ o[20] = x5 >>> 0 & 255;
189
+ o[21] = x5 >>> 8 & 255;
190
+ o[22] = x5 >>> 16 & 255;
191
+ o[23] = x5 >>> 24 & 255;
192
+ o[24] = x6 >>> 0 & 255;
193
+ o[25] = x6 >>> 8 & 255;
194
+ o[26] = x6 >>> 16 & 255;
195
+ o[27] = x6 >>> 24 & 255;
196
+ o[28] = x7 >>> 0 & 255;
197
+ o[29] = x7 >>> 8 & 255;
198
+ o[30] = x7 >>> 16 & 255;
199
+ o[31] = x7 >>> 24 & 255;
200
+ o[32] = x8 >>> 0 & 255;
201
+ o[33] = x8 >>> 8 & 255;
202
+ o[34] = x8 >>> 16 & 255;
203
+ o[35] = x8 >>> 24 & 255;
204
+ o[36] = x9 >>> 0 & 255;
205
+ o[37] = x9 >>> 8 & 255;
206
+ o[38] = x9 >>> 16 & 255;
207
+ o[39] = x9 >>> 24 & 255;
208
+ o[40] = x10 >>> 0 & 255;
209
+ o[41] = x10 >>> 8 & 255;
210
+ o[42] = x10 >>> 16 & 255;
211
+ o[43] = x10 >>> 24 & 255;
212
+ o[44] = x11 >>> 0 & 255;
213
+ o[45] = x11 >>> 8 & 255;
214
+ o[46] = x11 >>> 16 & 255;
215
+ o[47] = x11 >>> 24 & 255;
216
+ o[48] = x12 >>> 0 & 255;
217
+ o[49] = x12 >>> 8 & 255;
218
+ o[50] = x12 >>> 16 & 255;
219
+ o[51] = x12 >>> 24 & 255;
220
+ o[52] = x13 >>> 0 & 255;
221
+ o[53] = x13 >>> 8 & 255;
222
+ o[54] = x13 >>> 16 & 255;
223
+ o[55] = x13 >>> 24 & 255;
224
+ o[56] = x14 >>> 0 & 255;
225
+ o[57] = x14 >>> 8 & 255;
226
+ o[58] = x14 >>> 16 & 255;
227
+ o[59] = x14 >>> 24 & 255;
228
+ o[60] = x15 >>> 0 & 255;
229
+ o[61] = x15 >>> 8 & 255;
230
+ o[62] = x15 >>> 16 & 255;
231
+ o[63] = x15 >>> 24 & 255;
232
+ }
233
+ function core_hsalsa20(o, p, k, c) {
234
+ var j0 = c[0] & 255 | (c[1] & 255) << 8 | (c[2] & 255) << 16 | (c[3] & 255) << 24, j1 = k[0] & 255 | (k[1] & 255) << 8 | (k[2] & 255) << 16 | (k[3] & 255) << 24, j2 = k[4] & 255 | (k[5] & 255) << 8 | (k[6] & 255) << 16 | (k[7] & 255) << 24, j3 = k[8] & 255 | (k[9] & 255) << 8 | (k[10] & 255) << 16 | (k[11] & 255) << 24, j4 = k[12] & 255 | (k[13] & 255) << 8 | (k[14] & 255) << 16 | (k[15] & 255) << 24, j5 = c[4] & 255 | (c[5] & 255) << 8 | (c[6] & 255) << 16 | (c[7] & 255) << 24, j6 = p[0] & 255 | (p[1] & 255) << 8 | (p[2] & 255) << 16 | (p[3] & 255) << 24, j7 = p[4] & 255 | (p[5] & 255) << 8 | (p[6] & 255) << 16 | (p[7] & 255) << 24, j8 = p[8] & 255 | (p[9] & 255) << 8 | (p[10] & 255) << 16 | (p[11] & 255) << 24, j9 = p[12] & 255 | (p[13] & 255) << 8 | (p[14] & 255) << 16 | (p[15] & 255) << 24, j10 = c[8] & 255 | (c[9] & 255) << 8 | (c[10] & 255) << 16 | (c[11] & 255) << 24, j11 = k[16] & 255 | (k[17] & 255) << 8 | (k[18] & 255) << 16 | (k[19] & 255) << 24, j12 = k[20] & 255 | (k[21] & 255) << 8 | (k[22] & 255) << 16 | (k[23] & 255) << 24, j13 = k[24] & 255 | (k[25] & 255) << 8 | (k[26] & 255) << 16 | (k[27] & 255) << 24, j14 = k[28] & 255 | (k[29] & 255) << 8 | (k[30] & 255) << 16 | (k[31] & 255) << 24, j15 = c[12] & 255 | (c[13] & 255) << 8 | (c[14] & 255) << 16 | (c[15] & 255) << 24;
235
+ var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, x15 = j15, u;
236
+ for (var i = 0; i < 20; i += 2) {
237
+ u = x0 + x12 | 0;
238
+ x4 ^= u << 7 | u >>> 32 - 7;
239
+ u = x4 + x0 | 0;
240
+ x8 ^= u << 9 | u >>> 32 - 9;
241
+ u = x8 + x4 | 0;
242
+ x12 ^= u << 13 | u >>> 32 - 13;
243
+ u = x12 + x8 | 0;
244
+ x0 ^= u << 18 | u >>> 32 - 18;
245
+ u = x5 + x1 | 0;
246
+ x9 ^= u << 7 | u >>> 32 - 7;
247
+ u = x9 + x5 | 0;
248
+ x13 ^= u << 9 | u >>> 32 - 9;
249
+ u = x13 + x9 | 0;
250
+ x1 ^= u << 13 | u >>> 32 - 13;
251
+ u = x1 + x13 | 0;
252
+ x5 ^= u << 18 | u >>> 32 - 18;
253
+ u = x10 + x6 | 0;
254
+ x14 ^= u << 7 | u >>> 32 - 7;
255
+ u = x14 + x10 | 0;
256
+ x2 ^= u << 9 | u >>> 32 - 9;
257
+ u = x2 + x14 | 0;
258
+ x6 ^= u << 13 | u >>> 32 - 13;
259
+ u = x6 + x2 | 0;
260
+ x10 ^= u << 18 | u >>> 32 - 18;
261
+ u = x15 + x11 | 0;
262
+ x3 ^= u << 7 | u >>> 32 - 7;
263
+ u = x3 + x15 | 0;
264
+ x7 ^= u << 9 | u >>> 32 - 9;
265
+ u = x7 + x3 | 0;
266
+ x11 ^= u << 13 | u >>> 32 - 13;
267
+ u = x11 + x7 | 0;
268
+ x15 ^= u << 18 | u >>> 32 - 18;
269
+ u = x0 + x3 | 0;
270
+ x1 ^= u << 7 | u >>> 32 - 7;
271
+ u = x1 + x0 | 0;
272
+ x2 ^= u << 9 | u >>> 32 - 9;
273
+ u = x2 + x1 | 0;
274
+ x3 ^= u << 13 | u >>> 32 - 13;
275
+ u = x3 + x2 | 0;
276
+ x0 ^= u << 18 | u >>> 32 - 18;
277
+ u = x5 + x4 | 0;
278
+ x6 ^= u << 7 | u >>> 32 - 7;
279
+ u = x6 + x5 | 0;
280
+ x7 ^= u << 9 | u >>> 32 - 9;
281
+ u = x7 + x6 | 0;
282
+ x4 ^= u << 13 | u >>> 32 - 13;
283
+ u = x4 + x7 | 0;
284
+ x5 ^= u << 18 | u >>> 32 - 18;
285
+ u = x10 + x9 | 0;
286
+ x11 ^= u << 7 | u >>> 32 - 7;
287
+ u = x11 + x10 | 0;
288
+ x8 ^= u << 9 | u >>> 32 - 9;
289
+ u = x8 + x11 | 0;
290
+ x9 ^= u << 13 | u >>> 32 - 13;
291
+ u = x9 + x8 | 0;
292
+ x10 ^= u << 18 | u >>> 32 - 18;
293
+ u = x15 + x14 | 0;
294
+ x12 ^= u << 7 | u >>> 32 - 7;
295
+ u = x12 + x15 | 0;
296
+ x13 ^= u << 9 | u >>> 32 - 9;
297
+ u = x13 + x12 | 0;
298
+ x14 ^= u << 13 | u >>> 32 - 13;
299
+ u = x14 + x13 | 0;
300
+ x15 ^= u << 18 | u >>> 32 - 18;
301
+ }
302
+ o[0] = x0 >>> 0 & 255;
303
+ o[1] = x0 >>> 8 & 255;
304
+ o[2] = x0 >>> 16 & 255;
305
+ o[3] = x0 >>> 24 & 255;
306
+ o[4] = x5 >>> 0 & 255;
307
+ o[5] = x5 >>> 8 & 255;
308
+ o[6] = x5 >>> 16 & 255;
309
+ o[7] = x5 >>> 24 & 255;
310
+ o[8] = x10 >>> 0 & 255;
311
+ o[9] = x10 >>> 8 & 255;
312
+ o[10] = x10 >>> 16 & 255;
313
+ o[11] = x10 >>> 24 & 255;
314
+ o[12] = x15 >>> 0 & 255;
315
+ o[13] = x15 >>> 8 & 255;
316
+ o[14] = x15 >>> 16 & 255;
317
+ o[15] = x15 >>> 24 & 255;
318
+ o[16] = x6 >>> 0 & 255;
319
+ o[17] = x6 >>> 8 & 255;
320
+ o[18] = x6 >>> 16 & 255;
321
+ o[19] = x6 >>> 24 & 255;
322
+ o[20] = x7 >>> 0 & 255;
323
+ o[21] = x7 >>> 8 & 255;
324
+ o[22] = x7 >>> 16 & 255;
325
+ o[23] = x7 >>> 24 & 255;
326
+ o[24] = x8 >>> 0 & 255;
327
+ o[25] = x8 >>> 8 & 255;
328
+ o[26] = x8 >>> 16 & 255;
329
+ o[27] = x8 >>> 24 & 255;
330
+ o[28] = x9 >>> 0 & 255;
331
+ o[29] = x9 >>> 8 & 255;
332
+ o[30] = x9 >>> 16 & 255;
333
+ o[31] = x9 >>> 24 & 255;
334
+ }
335
+ function crypto_core_salsa20(out, inp, k, c) {
336
+ core_salsa20(out, inp, k, c);
337
+ }
338
+ function crypto_core_hsalsa20(out, inp, k, c) {
339
+ core_hsalsa20(out, inp, k, c);
340
+ }
341
+ var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]);
342
+ function crypto_stream_salsa20_xor(c, cpos, m, mpos, b, n, k) {
343
+ var z = new Uint8Array(16), x = new Uint8Array(64);
344
+ var u, i;
345
+ for (i = 0; i < 16; i++) z[i] = 0;
346
+ for (i = 0; i < 8; i++) z[i] = n[i];
347
+ while (b >= 64) {
348
+ crypto_core_salsa20(x, z, k, sigma);
349
+ for (i = 0; i < 64; i++) c[cpos + i] = m[mpos + i] ^ x[i];
350
+ u = 1;
351
+ for (i = 8; i < 16; i++) {
352
+ u = u + (z[i] & 255) | 0;
353
+ z[i] = u & 255;
354
+ u >>>= 8;
355
+ }
356
+ b -= 64;
357
+ cpos += 64;
358
+ mpos += 64;
359
+ }
360
+ if (b > 0) {
361
+ crypto_core_salsa20(x, z, k, sigma);
362
+ for (i = 0; i < b; i++) c[cpos + i] = m[mpos + i] ^ x[i];
363
+ }
364
+ return 0;
365
+ }
366
+ function crypto_stream_salsa20(c, cpos, b, n, k) {
367
+ var z = new Uint8Array(16), x = new Uint8Array(64);
368
+ var u, i;
369
+ for (i = 0; i < 16; i++) z[i] = 0;
370
+ for (i = 0; i < 8; i++) z[i] = n[i];
371
+ while (b >= 64) {
372
+ crypto_core_salsa20(x, z, k, sigma);
373
+ for (i = 0; i < 64; i++) c[cpos + i] = x[i];
374
+ u = 1;
375
+ for (i = 8; i < 16; i++) {
376
+ u = u + (z[i] & 255) | 0;
377
+ z[i] = u & 255;
378
+ u >>>= 8;
379
+ }
380
+ b -= 64;
381
+ cpos += 64;
382
+ }
383
+ if (b > 0) {
384
+ crypto_core_salsa20(x, z, k, sigma);
385
+ for (i = 0; i < b; i++) c[cpos + i] = x[i];
386
+ }
387
+ return 0;
388
+ }
389
+ function crypto_stream(c, cpos, d, n, k) {
390
+ var s = new Uint8Array(32);
391
+ crypto_core_hsalsa20(s, n, k, sigma);
392
+ var sn = new Uint8Array(8);
393
+ for (var i = 0; i < 8; i++) sn[i] = n[i + 16];
394
+ return crypto_stream_salsa20(c, cpos, d, sn, s);
395
+ }
396
+ function crypto_stream_xor(c, cpos, m, mpos, d, n, k) {
397
+ var s = new Uint8Array(32);
398
+ crypto_core_hsalsa20(s, n, k, sigma);
399
+ var sn = new Uint8Array(8);
400
+ for (var i = 0; i < 8; i++) sn[i] = n[i + 16];
401
+ return crypto_stream_salsa20_xor(c, cpos, m, mpos, d, sn, s);
402
+ }
403
+ var poly1305 = function(key) {
404
+ this.buffer = new Uint8Array(16);
405
+ this.r = new Uint16Array(10);
406
+ this.h = new Uint16Array(10);
407
+ this.pad = new Uint16Array(8);
408
+ this.leftover = 0;
409
+ this.fin = 0;
410
+ var t0, t1, t2, t3, t4, t5, t6, t7;
411
+ t0 = key[0] & 255 | (key[1] & 255) << 8;
412
+ this.r[0] = t0 & 8191;
413
+ t1 = key[2] & 255 | (key[3] & 255) << 8;
414
+ this.r[1] = (t0 >>> 13 | t1 << 3) & 8191;
415
+ t2 = key[4] & 255 | (key[5] & 255) << 8;
416
+ this.r[2] = (t1 >>> 10 | t2 << 6) & 7939;
417
+ t3 = key[6] & 255 | (key[7] & 255) << 8;
418
+ this.r[3] = (t2 >>> 7 | t3 << 9) & 8191;
419
+ t4 = key[8] & 255 | (key[9] & 255) << 8;
420
+ this.r[4] = (t3 >>> 4 | t4 << 12) & 255;
421
+ this.r[5] = t4 >>> 1 & 8190;
422
+ t5 = key[10] & 255 | (key[11] & 255) << 8;
423
+ this.r[6] = (t4 >>> 14 | t5 << 2) & 8191;
424
+ t6 = key[12] & 255 | (key[13] & 255) << 8;
425
+ this.r[7] = (t5 >>> 11 | t6 << 5) & 8065;
426
+ t7 = key[14] & 255 | (key[15] & 255) << 8;
427
+ this.r[8] = (t6 >>> 8 | t7 << 8) & 8191;
428
+ this.r[9] = t7 >>> 5 & 127;
429
+ this.pad[0] = key[16] & 255 | (key[17] & 255) << 8;
430
+ this.pad[1] = key[18] & 255 | (key[19] & 255) << 8;
431
+ this.pad[2] = key[20] & 255 | (key[21] & 255) << 8;
432
+ this.pad[3] = key[22] & 255 | (key[23] & 255) << 8;
433
+ this.pad[4] = key[24] & 255 | (key[25] & 255) << 8;
434
+ this.pad[5] = key[26] & 255 | (key[27] & 255) << 8;
435
+ this.pad[6] = key[28] & 255 | (key[29] & 255) << 8;
436
+ this.pad[7] = key[30] & 255 | (key[31] & 255) << 8;
437
+ };
438
+ poly1305.prototype.blocks = function(m, mpos, bytes) {
439
+ var hibit = this.fin ? 0 : 1 << 11;
440
+ var t0, t1, t2, t3, t4, t5, t6, t7, c;
441
+ var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9;
442
+ var h0 = this.h[0], h1 = this.h[1], h2 = this.h[2], h3 = this.h[3], h4 = this.h[4], h5 = this.h[5], h6 = this.h[6], h7 = this.h[7], h8 = this.h[8], h9 = this.h[9];
443
+ var r0 = this.r[0], r1 = this.r[1], r2 = this.r[2], r3 = this.r[3], r4 = this.r[4], r5 = this.r[5], r6 = this.r[6], r7 = this.r[7], r8 = this.r[8], r9 = this.r[9];
444
+ while (bytes >= 16) {
445
+ t0 = m[mpos + 0] & 255 | (m[mpos + 1] & 255) << 8;
446
+ h0 += t0 & 8191;
447
+ t1 = m[mpos + 2] & 255 | (m[mpos + 3] & 255) << 8;
448
+ h1 += (t0 >>> 13 | t1 << 3) & 8191;
449
+ t2 = m[mpos + 4] & 255 | (m[mpos + 5] & 255) << 8;
450
+ h2 += (t1 >>> 10 | t2 << 6) & 8191;
451
+ t3 = m[mpos + 6] & 255 | (m[mpos + 7] & 255) << 8;
452
+ h3 += (t2 >>> 7 | t3 << 9) & 8191;
453
+ t4 = m[mpos + 8] & 255 | (m[mpos + 9] & 255) << 8;
454
+ h4 += (t3 >>> 4 | t4 << 12) & 8191;
455
+ h5 += t4 >>> 1 & 8191;
456
+ t5 = m[mpos + 10] & 255 | (m[mpos + 11] & 255) << 8;
457
+ h6 += (t4 >>> 14 | t5 << 2) & 8191;
458
+ t6 = m[mpos + 12] & 255 | (m[mpos + 13] & 255) << 8;
459
+ h7 += (t5 >>> 11 | t6 << 5) & 8191;
460
+ t7 = m[mpos + 14] & 255 | (m[mpos + 15] & 255) << 8;
461
+ h8 += (t6 >>> 8 | t7 << 8) & 8191;
462
+ h9 += t7 >>> 5 | hibit;
463
+ c = 0;
464
+ d0 = c;
465
+ d0 += h0 * r0;
466
+ d0 += h1 * (5 * r9);
467
+ d0 += h2 * (5 * r8);
468
+ d0 += h3 * (5 * r7);
469
+ d0 += h4 * (5 * r6);
470
+ c = d0 >>> 13;
471
+ d0 &= 8191;
472
+ d0 += h5 * (5 * r5);
473
+ d0 += h6 * (5 * r4);
474
+ d0 += h7 * (5 * r3);
475
+ d0 += h8 * (5 * r2);
476
+ d0 += h9 * (5 * r1);
477
+ c += d0 >>> 13;
478
+ d0 &= 8191;
479
+ d1 = c;
480
+ d1 += h0 * r1;
481
+ d1 += h1 * r0;
482
+ d1 += h2 * (5 * r9);
483
+ d1 += h3 * (5 * r8);
484
+ d1 += h4 * (5 * r7);
485
+ c = d1 >>> 13;
486
+ d1 &= 8191;
487
+ d1 += h5 * (5 * r6);
488
+ d1 += h6 * (5 * r5);
489
+ d1 += h7 * (5 * r4);
490
+ d1 += h8 * (5 * r3);
491
+ d1 += h9 * (5 * r2);
492
+ c += d1 >>> 13;
493
+ d1 &= 8191;
494
+ d2 = c;
495
+ d2 += h0 * r2;
496
+ d2 += h1 * r1;
497
+ d2 += h2 * r0;
498
+ d2 += h3 * (5 * r9);
499
+ d2 += h4 * (5 * r8);
500
+ c = d2 >>> 13;
501
+ d2 &= 8191;
502
+ d2 += h5 * (5 * r7);
503
+ d2 += h6 * (5 * r6);
504
+ d2 += h7 * (5 * r5);
505
+ d2 += h8 * (5 * r4);
506
+ d2 += h9 * (5 * r3);
507
+ c += d2 >>> 13;
508
+ d2 &= 8191;
509
+ d3 = c;
510
+ d3 += h0 * r3;
511
+ d3 += h1 * r2;
512
+ d3 += h2 * r1;
513
+ d3 += h3 * r0;
514
+ d3 += h4 * (5 * r9);
515
+ c = d3 >>> 13;
516
+ d3 &= 8191;
517
+ d3 += h5 * (5 * r8);
518
+ d3 += h6 * (5 * r7);
519
+ d3 += h7 * (5 * r6);
520
+ d3 += h8 * (5 * r5);
521
+ d3 += h9 * (5 * r4);
522
+ c += d3 >>> 13;
523
+ d3 &= 8191;
524
+ d4 = c;
525
+ d4 += h0 * r4;
526
+ d4 += h1 * r3;
527
+ d4 += h2 * r2;
528
+ d4 += h3 * r1;
529
+ d4 += h4 * r0;
530
+ c = d4 >>> 13;
531
+ d4 &= 8191;
532
+ d4 += h5 * (5 * r9);
533
+ d4 += h6 * (5 * r8);
534
+ d4 += h7 * (5 * r7);
535
+ d4 += h8 * (5 * r6);
536
+ d4 += h9 * (5 * r5);
537
+ c += d4 >>> 13;
538
+ d4 &= 8191;
539
+ d5 = c;
540
+ d5 += h0 * r5;
541
+ d5 += h1 * r4;
542
+ d5 += h2 * r3;
543
+ d5 += h3 * r2;
544
+ d5 += h4 * r1;
545
+ c = d5 >>> 13;
546
+ d5 &= 8191;
547
+ d5 += h5 * r0;
548
+ d5 += h6 * (5 * r9);
549
+ d5 += h7 * (5 * r8);
550
+ d5 += h8 * (5 * r7);
551
+ d5 += h9 * (5 * r6);
552
+ c += d5 >>> 13;
553
+ d5 &= 8191;
554
+ d6 = c;
555
+ d6 += h0 * r6;
556
+ d6 += h1 * r5;
557
+ d6 += h2 * r4;
558
+ d6 += h3 * r3;
559
+ d6 += h4 * r2;
560
+ c = d6 >>> 13;
561
+ d6 &= 8191;
562
+ d6 += h5 * r1;
563
+ d6 += h6 * r0;
564
+ d6 += h7 * (5 * r9);
565
+ d6 += h8 * (5 * r8);
566
+ d6 += h9 * (5 * r7);
567
+ c += d6 >>> 13;
568
+ d6 &= 8191;
569
+ d7 = c;
570
+ d7 += h0 * r7;
571
+ d7 += h1 * r6;
572
+ d7 += h2 * r5;
573
+ d7 += h3 * r4;
574
+ d7 += h4 * r3;
575
+ c = d7 >>> 13;
576
+ d7 &= 8191;
577
+ d7 += h5 * r2;
578
+ d7 += h6 * r1;
579
+ d7 += h7 * r0;
580
+ d7 += h8 * (5 * r9);
581
+ d7 += h9 * (5 * r8);
582
+ c += d7 >>> 13;
583
+ d7 &= 8191;
584
+ d8 = c;
585
+ d8 += h0 * r8;
586
+ d8 += h1 * r7;
587
+ d8 += h2 * r6;
588
+ d8 += h3 * r5;
589
+ d8 += h4 * r4;
590
+ c = d8 >>> 13;
591
+ d8 &= 8191;
592
+ d8 += h5 * r3;
593
+ d8 += h6 * r2;
594
+ d8 += h7 * r1;
595
+ d8 += h8 * r0;
596
+ d8 += h9 * (5 * r9);
597
+ c += d8 >>> 13;
598
+ d8 &= 8191;
599
+ d9 = c;
600
+ d9 += h0 * r9;
601
+ d9 += h1 * r8;
602
+ d9 += h2 * r7;
603
+ d9 += h3 * r6;
604
+ d9 += h4 * r5;
605
+ c = d9 >>> 13;
606
+ d9 &= 8191;
607
+ d9 += h5 * r4;
608
+ d9 += h6 * r3;
609
+ d9 += h7 * r2;
610
+ d9 += h8 * r1;
611
+ d9 += h9 * r0;
612
+ c += d9 >>> 13;
613
+ d9 &= 8191;
614
+ c = (c << 2) + c | 0;
615
+ c = c + d0 | 0;
616
+ d0 = c & 8191;
617
+ c = c >>> 13;
618
+ d1 += c;
619
+ h0 = d0;
620
+ h1 = d1;
621
+ h2 = d2;
622
+ h3 = d3;
623
+ h4 = d4;
624
+ h5 = d5;
625
+ h6 = d6;
626
+ h7 = d7;
627
+ h8 = d8;
628
+ h9 = d9;
629
+ mpos += 16;
630
+ bytes -= 16;
631
+ }
632
+ this.h[0] = h0;
633
+ this.h[1] = h1;
634
+ this.h[2] = h2;
635
+ this.h[3] = h3;
636
+ this.h[4] = h4;
637
+ this.h[5] = h5;
638
+ this.h[6] = h6;
639
+ this.h[7] = h7;
640
+ this.h[8] = h8;
641
+ this.h[9] = h9;
642
+ };
643
+ poly1305.prototype.finish = function(mac, macpos) {
644
+ var g = new Uint16Array(10);
645
+ var c, mask, f, i;
646
+ if (this.leftover) {
647
+ i = this.leftover;
648
+ this.buffer[i++] = 1;
649
+ for (; i < 16; i++) this.buffer[i] = 0;
650
+ this.fin = 1;
651
+ this.blocks(this.buffer, 0, 16);
652
+ }
653
+ c = this.h[1] >>> 13;
654
+ this.h[1] &= 8191;
655
+ for (i = 2; i < 10; i++) {
656
+ this.h[i] += c;
657
+ c = this.h[i] >>> 13;
658
+ this.h[i] &= 8191;
659
+ }
660
+ this.h[0] += c * 5;
661
+ c = this.h[0] >>> 13;
662
+ this.h[0] &= 8191;
663
+ this.h[1] += c;
664
+ c = this.h[1] >>> 13;
665
+ this.h[1] &= 8191;
666
+ this.h[2] += c;
667
+ g[0] = this.h[0] + 5;
668
+ c = g[0] >>> 13;
669
+ g[0] &= 8191;
670
+ for (i = 1; i < 10; i++) {
671
+ g[i] = this.h[i] + c;
672
+ c = g[i] >>> 13;
673
+ g[i] &= 8191;
674
+ }
675
+ g[9] -= 1 << 13;
676
+ mask = (c ^ 1) - 1;
677
+ for (i = 0; i < 10; i++) g[i] &= mask;
678
+ mask = ~mask;
679
+ for (i = 0; i < 10; i++) this.h[i] = this.h[i] & mask | g[i];
680
+ this.h[0] = (this.h[0] | this.h[1] << 13) & 65535;
681
+ this.h[1] = (this.h[1] >>> 3 | this.h[2] << 10) & 65535;
682
+ this.h[2] = (this.h[2] >>> 6 | this.h[3] << 7) & 65535;
683
+ this.h[3] = (this.h[3] >>> 9 | this.h[4] << 4) & 65535;
684
+ this.h[4] = (this.h[4] >>> 12 | this.h[5] << 1 | this.h[6] << 14) & 65535;
685
+ this.h[5] = (this.h[6] >>> 2 | this.h[7] << 11) & 65535;
686
+ this.h[6] = (this.h[7] >>> 5 | this.h[8] << 8) & 65535;
687
+ this.h[7] = (this.h[8] >>> 8 | this.h[9] << 5) & 65535;
688
+ f = this.h[0] + this.pad[0];
689
+ this.h[0] = f & 65535;
690
+ for (i = 1; i < 8; i++) {
691
+ f = (this.h[i] + this.pad[i] | 0) + (f >>> 16) | 0;
692
+ this.h[i] = f & 65535;
693
+ }
694
+ mac[macpos + 0] = this.h[0] >>> 0 & 255;
695
+ mac[macpos + 1] = this.h[0] >>> 8 & 255;
696
+ mac[macpos + 2] = this.h[1] >>> 0 & 255;
697
+ mac[macpos + 3] = this.h[1] >>> 8 & 255;
698
+ mac[macpos + 4] = this.h[2] >>> 0 & 255;
699
+ mac[macpos + 5] = this.h[2] >>> 8 & 255;
700
+ mac[macpos + 6] = this.h[3] >>> 0 & 255;
701
+ mac[macpos + 7] = this.h[3] >>> 8 & 255;
702
+ mac[macpos + 8] = this.h[4] >>> 0 & 255;
703
+ mac[macpos + 9] = this.h[4] >>> 8 & 255;
704
+ mac[macpos + 10] = this.h[5] >>> 0 & 255;
705
+ mac[macpos + 11] = this.h[5] >>> 8 & 255;
706
+ mac[macpos + 12] = this.h[6] >>> 0 & 255;
707
+ mac[macpos + 13] = this.h[6] >>> 8 & 255;
708
+ mac[macpos + 14] = this.h[7] >>> 0 & 255;
709
+ mac[macpos + 15] = this.h[7] >>> 8 & 255;
710
+ };
711
+ poly1305.prototype.update = function(m, mpos, bytes) {
712
+ var i, want;
713
+ if (this.leftover) {
714
+ want = 16 - this.leftover;
715
+ if (want > bytes)
716
+ want = bytes;
717
+ for (i = 0; i < want; i++)
718
+ this.buffer[this.leftover + i] = m[mpos + i];
719
+ bytes -= want;
720
+ mpos += want;
721
+ this.leftover += want;
722
+ if (this.leftover < 16)
723
+ return;
724
+ this.blocks(this.buffer, 0, 16);
725
+ this.leftover = 0;
726
+ }
727
+ if (bytes >= 16) {
728
+ want = bytes - bytes % 16;
729
+ this.blocks(m, mpos, want);
730
+ mpos += want;
731
+ bytes -= want;
732
+ }
733
+ if (bytes) {
734
+ for (i = 0; i < bytes; i++)
735
+ this.buffer[this.leftover + i] = m[mpos + i];
736
+ this.leftover += bytes;
737
+ }
738
+ };
739
+ function crypto_onetimeauth(out, outpos, m, mpos, n, k) {
740
+ var s = new poly1305(k);
741
+ s.update(m, mpos, n);
742
+ s.finish(out, outpos);
743
+ return 0;
744
+ }
745
+ function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) {
746
+ var x = new Uint8Array(16);
747
+ crypto_onetimeauth(x, 0, m, mpos, n, k);
748
+ return crypto_verify_16(h, hpos, x, 0);
749
+ }
750
+ function crypto_secretbox(c, m, d, n, k) {
751
+ var i;
752
+ if (d < 32) return -1;
753
+ crypto_stream_xor(c, 0, m, 0, d, n, k);
754
+ crypto_onetimeauth(c, 16, c, 32, d - 32, c);
755
+ for (i = 0; i < 16; i++) c[i] = 0;
756
+ return 0;
757
+ }
758
+ function crypto_secretbox_open(m, c, d, n, k) {
759
+ var i;
760
+ var x = new Uint8Array(32);
761
+ if (d < 32) return -1;
762
+ crypto_stream(x, 0, 32, n, k);
763
+ if (crypto_onetimeauth_verify(c, 16, c, 32, d - 32, x) !== 0) return -1;
764
+ crypto_stream_xor(m, 0, c, 0, d, n, k);
765
+ for (i = 0; i < 32; i++) m[i] = 0;
766
+ return 0;
767
+ }
768
+ function set25519(r, a) {
769
+ var i;
770
+ for (i = 0; i < 16; i++) r[i] = a[i] | 0;
771
+ }
772
+ function car25519(o) {
773
+ var i, v, c = 1;
774
+ for (i = 0; i < 16; i++) {
775
+ v = o[i] + c + 65535;
776
+ c = Math.floor(v / 65536);
777
+ o[i] = v - c * 65536;
778
+ }
779
+ o[0] += c - 1 + 37 * (c - 1);
780
+ }
781
+ function sel25519(p, q, b) {
782
+ var t, c = ~(b - 1);
783
+ for (var i = 0; i < 16; i++) {
784
+ t = c & (p[i] ^ q[i]);
785
+ p[i] ^= t;
786
+ q[i] ^= t;
787
+ }
788
+ }
789
+ function pack25519(o, n) {
790
+ var i, j, b;
791
+ var m = gf(), t = gf();
792
+ for (i = 0; i < 16; i++) t[i] = n[i];
793
+ car25519(t);
794
+ car25519(t);
795
+ car25519(t);
796
+ for (j = 0; j < 2; j++) {
797
+ m[0] = t[0] - 65517;
798
+ for (i = 1; i < 15; i++) {
799
+ m[i] = t[i] - 65535 - (m[i - 1] >> 16 & 1);
800
+ m[i - 1] &= 65535;
801
+ }
802
+ m[15] = t[15] - 32767 - (m[14] >> 16 & 1);
803
+ b = m[15] >> 16 & 1;
804
+ m[14] &= 65535;
805
+ sel25519(t, m, 1 - b);
806
+ }
807
+ for (i = 0; i < 16; i++) {
808
+ o[2 * i] = t[i] & 255;
809
+ o[2 * i + 1] = t[i] >> 8;
810
+ }
811
+ }
812
+ function neq25519(a, b) {
813
+ var c = new Uint8Array(32), d = new Uint8Array(32);
814
+ pack25519(c, a);
815
+ pack25519(d, b);
816
+ return crypto_verify_32(c, 0, d, 0);
817
+ }
818
+ function par25519(a) {
819
+ var d = new Uint8Array(32);
820
+ pack25519(d, a);
821
+ return d[0] & 1;
822
+ }
823
+ function unpack25519(o, n) {
824
+ var i;
825
+ for (i = 0; i < 16; i++) o[i] = n[2 * i] + (n[2 * i + 1] << 8);
826
+ o[15] &= 32767;
827
+ }
828
+ function A(o, a, b) {
829
+ for (var i = 0; i < 16; i++) o[i] = a[i] + b[i];
830
+ }
831
+ function Z(o, a, b) {
832
+ for (var i = 0; i < 16; i++) o[i] = a[i] - b[i];
833
+ }
834
+ function M(o, a, b) {
835
+ var v, c, t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5], b6 = b[6], b7 = b[7], b8 = b[8], b9 = b[9], b10 = b[10], b11 = b[11], b12 = b[12], b13 = b[13], b14 = b[14], b15 = b[15];
836
+ v = a[0];
837
+ t0 += v * b0;
838
+ t1 += v * b1;
839
+ t2 += v * b2;
840
+ t3 += v * b3;
841
+ t4 += v * b4;
842
+ t5 += v * b5;
843
+ t6 += v * b6;
844
+ t7 += v * b7;
845
+ t8 += v * b8;
846
+ t9 += v * b9;
847
+ t10 += v * b10;
848
+ t11 += v * b11;
849
+ t12 += v * b12;
850
+ t13 += v * b13;
851
+ t14 += v * b14;
852
+ t15 += v * b15;
853
+ v = a[1];
854
+ t1 += v * b0;
855
+ t2 += v * b1;
856
+ t3 += v * b2;
857
+ t4 += v * b3;
858
+ t5 += v * b4;
859
+ t6 += v * b5;
860
+ t7 += v * b6;
861
+ t8 += v * b7;
862
+ t9 += v * b8;
863
+ t10 += v * b9;
864
+ t11 += v * b10;
865
+ t12 += v * b11;
866
+ t13 += v * b12;
867
+ t14 += v * b13;
868
+ t15 += v * b14;
869
+ t16 += v * b15;
870
+ v = a[2];
871
+ t2 += v * b0;
872
+ t3 += v * b1;
873
+ t4 += v * b2;
874
+ t5 += v * b3;
875
+ t6 += v * b4;
876
+ t7 += v * b5;
877
+ t8 += v * b6;
878
+ t9 += v * b7;
879
+ t10 += v * b8;
880
+ t11 += v * b9;
881
+ t12 += v * b10;
882
+ t13 += v * b11;
883
+ t14 += v * b12;
884
+ t15 += v * b13;
885
+ t16 += v * b14;
886
+ t17 += v * b15;
887
+ v = a[3];
888
+ t3 += v * b0;
889
+ t4 += v * b1;
890
+ t5 += v * b2;
891
+ t6 += v * b3;
892
+ t7 += v * b4;
893
+ t8 += v * b5;
894
+ t9 += v * b6;
895
+ t10 += v * b7;
896
+ t11 += v * b8;
897
+ t12 += v * b9;
898
+ t13 += v * b10;
899
+ t14 += v * b11;
900
+ t15 += v * b12;
901
+ t16 += v * b13;
902
+ t17 += v * b14;
903
+ t18 += v * b15;
904
+ v = a[4];
905
+ t4 += v * b0;
906
+ t5 += v * b1;
907
+ t6 += v * b2;
908
+ t7 += v * b3;
909
+ t8 += v * b4;
910
+ t9 += v * b5;
911
+ t10 += v * b6;
912
+ t11 += v * b7;
913
+ t12 += v * b8;
914
+ t13 += v * b9;
915
+ t14 += v * b10;
916
+ t15 += v * b11;
917
+ t16 += v * b12;
918
+ t17 += v * b13;
919
+ t18 += v * b14;
920
+ t19 += v * b15;
921
+ v = a[5];
922
+ t5 += v * b0;
923
+ t6 += v * b1;
924
+ t7 += v * b2;
925
+ t8 += v * b3;
926
+ t9 += v * b4;
927
+ t10 += v * b5;
928
+ t11 += v * b6;
929
+ t12 += v * b7;
930
+ t13 += v * b8;
931
+ t14 += v * b9;
932
+ t15 += v * b10;
933
+ t16 += v * b11;
934
+ t17 += v * b12;
935
+ t18 += v * b13;
936
+ t19 += v * b14;
937
+ t20 += v * b15;
938
+ v = a[6];
939
+ t6 += v * b0;
940
+ t7 += v * b1;
941
+ t8 += v * b2;
942
+ t9 += v * b3;
943
+ t10 += v * b4;
944
+ t11 += v * b5;
945
+ t12 += v * b6;
946
+ t13 += v * b7;
947
+ t14 += v * b8;
948
+ t15 += v * b9;
949
+ t16 += v * b10;
950
+ t17 += v * b11;
951
+ t18 += v * b12;
952
+ t19 += v * b13;
953
+ t20 += v * b14;
954
+ t21 += v * b15;
955
+ v = a[7];
956
+ t7 += v * b0;
957
+ t8 += v * b1;
958
+ t9 += v * b2;
959
+ t10 += v * b3;
960
+ t11 += v * b4;
961
+ t12 += v * b5;
962
+ t13 += v * b6;
963
+ t14 += v * b7;
964
+ t15 += v * b8;
965
+ t16 += v * b9;
966
+ t17 += v * b10;
967
+ t18 += v * b11;
968
+ t19 += v * b12;
969
+ t20 += v * b13;
970
+ t21 += v * b14;
971
+ t22 += v * b15;
972
+ v = a[8];
973
+ t8 += v * b0;
974
+ t9 += v * b1;
975
+ t10 += v * b2;
976
+ t11 += v * b3;
977
+ t12 += v * b4;
978
+ t13 += v * b5;
979
+ t14 += v * b6;
980
+ t15 += v * b7;
981
+ t16 += v * b8;
982
+ t17 += v * b9;
983
+ t18 += v * b10;
984
+ t19 += v * b11;
985
+ t20 += v * b12;
986
+ t21 += v * b13;
987
+ t22 += v * b14;
988
+ t23 += v * b15;
989
+ v = a[9];
990
+ t9 += v * b0;
991
+ t10 += v * b1;
992
+ t11 += v * b2;
993
+ t12 += v * b3;
994
+ t13 += v * b4;
995
+ t14 += v * b5;
996
+ t15 += v * b6;
997
+ t16 += v * b7;
998
+ t17 += v * b8;
999
+ t18 += v * b9;
1000
+ t19 += v * b10;
1001
+ t20 += v * b11;
1002
+ t21 += v * b12;
1003
+ t22 += v * b13;
1004
+ t23 += v * b14;
1005
+ t24 += v * b15;
1006
+ v = a[10];
1007
+ t10 += v * b0;
1008
+ t11 += v * b1;
1009
+ t12 += v * b2;
1010
+ t13 += v * b3;
1011
+ t14 += v * b4;
1012
+ t15 += v * b5;
1013
+ t16 += v * b6;
1014
+ t17 += v * b7;
1015
+ t18 += v * b8;
1016
+ t19 += v * b9;
1017
+ t20 += v * b10;
1018
+ t21 += v * b11;
1019
+ t22 += v * b12;
1020
+ t23 += v * b13;
1021
+ t24 += v * b14;
1022
+ t25 += v * b15;
1023
+ v = a[11];
1024
+ t11 += v * b0;
1025
+ t12 += v * b1;
1026
+ t13 += v * b2;
1027
+ t14 += v * b3;
1028
+ t15 += v * b4;
1029
+ t16 += v * b5;
1030
+ t17 += v * b6;
1031
+ t18 += v * b7;
1032
+ t19 += v * b8;
1033
+ t20 += v * b9;
1034
+ t21 += v * b10;
1035
+ t22 += v * b11;
1036
+ t23 += v * b12;
1037
+ t24 += v * b13;
1038
+ t25 += v * b14;
1039
+ t26 += v * b15;
1040
+ v = a[12];
1041
+ t12 += v * b0;
1042
+ t13 += v * b1;
1043
+ t14 += v * b2;
1044
+ t15 += v * b3;
1045
+ t16 += v * b4;
1046
+ t17 += v * b5;
1047
+ t18 += v * b6;
1048
+ t19 += v * b7;
1049
+ t20 += v * b8;
1050
+ t21 += v * b9;
1051
+ t22 += v * b10;
1052
+ t23 += v * b11;
1053
+ t24 += v * b12;
1054
+ t25 += v * b13;
1055
+ t26 += v * b14;
1056
+ t27 += v * b15;
1057
+ v = a[13];
1058
+ t13 += v * b0;
1059
+ t14 += v * b1;
1060
+ t15 += v * b2;
1061
+ t16 += v * b3;
1062
+ t17 += v * b4;
1063
+ t18 += v * b5;
1064
+ t19 += v * b6;
1065
+ t20 += v * b7;
1066
+ t21 += v * b8;
1067
+ t22 += v * b9;
1068
+ t23 += v * b10;
1069
+ t24 += v * b11;
1070
+ t25 += v * b12;
1071
+ t26 += v * b13;
1072
+ t27 += v * b14;
1073
+ t28 += v * b15;
1074
+ v = a[14];
1075
+ t14 += v * b0;
1076
+ t15 += v * b1;
1077
+ t16 += v * b2;
1078
+ t17 += v * b3;
1079
+ t18 += v * b4;
1080
+ t19 += v * b5;
1081
+ t20 += v * b6;
1082
+ t21 += v * b7;
1083
+ t22 += v * b8;
1084
+ t23 += v * b9;
1085
+ t24 += v * b10;
1086
+ t25 += v * b11;
1087
+ t26 += v * b12;
1088
+ t27 += v * b13;
1089
+ t28 += v * b14;
1090
+ t29 += v * b15;
1091
+ v = a[15];
1092
+ t15 += v * b0;
1093
+ t16 += v * b1;
1094
+ t17 += v * b2;
1095
+ t18 += v * b3;
1096
+ t19 += v * b4;
1097
+ t20 += v * b5;
1098
+ t21 += v * b6;
1099
+ t22 += v * b7;
1100
+ t23 += v * b8;
1101
+ t24 += v * b9;
1102
+ t25 += v * b10;
1103
+ t26 += v * b11;
1104
+ t27 += v * b12;
1105
+ t28 += v * b13;
1106
+ t29 += v * b14;
1107
+ t30 += v * b15;
1108
+ t0 += 38 * t16;
1109
+ t1 += 38 * t17;
1110
+ t2 += 38 * t18;
1111
+ t3 += 38 * t19;
1112
+ t4 += 38 * t20;
1113
+ t5 += 38 * t21;
1114
+ t6 += 38 * t22;
1115
+ t7 += 38 * t23;
1116
+ t8 += 38 * t24;
1117
+ t9 += 38 * t25;
1118
+ t10 += 38 * t26;
1119
+ t11 += 38 * t27;
1120
+ t12 += 38 * t28;
1121
+ t13 += 38 * t29;
1122
+ t14 += 38 * t30;
1123
+ c = 1;
1124
+ v = t0 + c + 65535;
1125
+ c = Math.floor(v / 65536);
1126
+ t0 = v - c * 65536;
1127
+ v = t1 + c + 65535;
1128
+ c = Math.floor(v / 65536);
1129
+ t1 = v - c * 65536;
1130
+ v = t2 + c + 65535;
1131
+ c = Math.floor(v / 65536);
1132
+ t2 = v - c * 65536;
1133
+ v = t3 + c + 65535;
1134
+ c = Math.floor(v / 65536);
1135
+ t3 = v - c * 65536;
1136
+ v = t4 + c + 65535;
1137
+ c = Math.floor(v / 65536);
1138
+ t4 = v - c * 65536;
1139
+ v = t5 + c + 65535;
1140
+ c = Math.floor(v / 65536);
1141
+ t5 = v - c * 65536;
1142
+ v = t6 + c + 65535;
1143
+ c = Math.floor(v / 65536);
1144
+ t6 = v - c * 65536;
1145
+ v = t7 + c + 65535;
1146
+ c = Math.floor(v / 65536);
1147
+ t7 = v - c * 65536;
1148
+ v = t8 + c + 65535;
1149
+ c = Math.floor(v / 65536);
1150
+ t8 = v - c * 65536;
1151
+ v = t9 + c + 65535;
1152
+ c = Math.floor(v / 65536);
1153
+ t9 = v - c * 65536;
1154
+ v = t10 + c + 65535;
1155
+ c = Math.floor(v / 65536);
1156
+ t10 = v - c * 65536;
1157
+ v = t11 + c + 65535;
1158
+ c = Math.floor(v / 65536);
1159
+ t11 = v - c * 65536;
1160
+ v = t12 + c + 65535;
1161
+ c = Math.floor(v / 65536);
1162
+ t12 = v - c * 65536;
1163
+ v = t13 + c + 65535;
1164
+ c = Math.floor(v / 65536);
1165
+ t13 = v - c * 65536;
1166
+ v = t14 + c + 65535;
1167
+ c = Math.floor(v / 65536);
1168
+ t14 = v - c * 65536;
1169
+ v = t15 + c + 65535;
1170
+ c = Math.floor(v / 65536);
1171
+ t15 = v - c * 65536;
1172
+ t0 += c - 1 + 37 * (c - 1);
1173
+ c = 1;
1174
+ v = t0 + c + 65535;
1175
+ c = Math.floor(v / 65536);
1176
+ t0 = v - c * 65536;
1177
+ v = t1 + c + 65535;
1178
+ c = Math.floor(v / 65536);
1179
+ t1 = v - c * 65536;
1180
+ v = t2 + c + 65535;
1181
+ c = Math.floor(v / 65536);
1182
+ t2 = v - c * 65536;
1183
+ v = t3 + c + 65535;
1184
+ c = Math.floor(v / 65536);
1185
+ t3 = v - c * 65536;
1186
+ v = t4 + c + 65535;
1187
+ c = Math.floor(v / 65536);
1188
+ t4 = v - c * 65536;
1189
+ v = t5 + c + 65535;
1190
+ c = Math.floor(v / 65536);
1191
+ t5 = v - c * 65536;
1192
+ v = t6 + c + 65535;
1193
+ c = Math.floor(v / 65536);
1194
+ t6 = v - c * 65536;
1195
+ v = t7 + c + 65535;
1196
+ c = Math.floor(v / 65536);
1197
+ t7 = v - c * 65536;
1198
+ v = t8 + c + 65535;
1199
+ c = Math.floor(v / 65536);
1200
+ t8 = v - c * 65536;
1201
+ v = t9 + c + 65535;
1202
+ c = Math.floor(v / 65536);
1203
+ t9 = v - c * 65536;
1204
+ v = t10 + c + 65535;
1205
+ c = Math.floor(v / 65536);
1206
+ t10 = v - c * 65536;
1207
+ v = t11 + c + 65535;
1208
+ c = Math.floor(v / 65536);
1209
+ t11 = v - c * 65536;
1210
+ v = t12 + c + 65535;
1211
+ c = Math.floor(v / 65536);
1212
+ t12 = v - c * 65536;
1213
+ v = t13 + c + 65535;
1214
+ c = Math.floor(v / 65536);
1215
+ t13 = v - c * 65536;
1216
+ v = t14 + c + 65535;
1217
+ c = Math.floor(v / 65536);
1218
+ t14 = v - c * 65536;
1219
+ v = t15 + c + 65535;
1220
+ c = Math.floor(v / 65536);
1221
+ t15 = v - c * 65536;
1222
+ t0 += c - 1 + 37 * (c - 1);
1223
+ o[0] = t0;
1224
+ o[1] = t1;
1225
+ o[2] = t2;
1226
+ o[3] = t3;
1227
+ o[4] = t4;
1228
+ o[5] = t5;
1229
+ o[6] = t6;
1230
+ o[7] = t7;
1231
+ o[8] = t8;
1232
+ o[9] = t9;
1233
+ o[10] = t10;
1234
+ o[11] = t11;
1235
+ o[12] = t12;
1236
+ o[13] = t13;
1237
+ o[14] = t14;
1238
+ o[15] = t15;
1239
+ }
1240
+ function S(o, a) {
1241
+ M(o, a, a);
1242
+ }
1243
+ function inv25519(o, i) {
1244
+ var c = gf();
1245
+ var a;
1246
+ for (a = 0; a < 16; a++) c[a] = i[a];
1247
+ for (a = 253; a >= 0; a--) {
1248
+ S(c, c);
1249
+ if (a !== 2 && a !== 4) M(c, c, i);
1250
+ }
1251
+ for (a = 0; a < 16; a++) o[a] = c[a];
1252
+ }
1253
+ function pow2523(o, i) {
1254
+ var c = gf();
1255
+ var a;
1256
+ for (a = 0; a < 16; a++) c[a] = i[a];
1257
+ for (a = 250; a >= 0; a--) {
1258
+ S(c, c);
1259
+ if (a !== 1) M(c, c, i);
1260
+ }
1261
+ for (a = 0; a < 16; a++) o[a] = c[a];
1262
+ }
1263
+ function crypto_scalarmult(q, n, p) {
1264
+ var z = new Uint8Array(32);
1265
+ var x = new Float64Array(80), r, i;
1266
+ var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf();
1267
+ for (i = 0; i < 31; i++) z[i] = n[i];
1268
+ z[31] = n[31] & 127 | 64;
1269
+ z[0] &= 248;
1270
+ unpack25519(x, p);
1271
+ for (i = 0; i < 16; i++) {
1272
+ b[i] = x[i];
1273
+ d[i] = a[i] = c[i] = 0;
1274
+ }
1275
+ a[0] = d[0] = 1;
1276
+ for (i = 254; i >= 0; --i) {
1277
+ r = z[i >>> 3] >>> (i & 7) & 1;
1278
+ sel25519(a, b, r);
1279
+ sel25519(c, d, r);
1280
+ A(e, a, c);
1281
+ Z(a, a, c);
1282
+ A(c, b, d);
1283
+ Z(b, b, d);
1284
+ S(d, e);
1285
+ S(f, a);
1286
+ M(a, c, a);
1287
+ M(c, b, e);
1288
+ A(e, a, c);
1289
+ Z(a, a, c);
1290
+ S(b, a);
1291
+ Z(c, d, f);
1292
+ M(a, c, _121665);
1293
+ A(a, a, d);
1294
+ M(c, c, a);
1295
+ M(a, d, f);
1296
+ M(d, b, x);
1297
+ S(b, e);
1298
+ sel25519(a, b, r);
1299
+ sel25519(c, d, r);
1300
+ }
1301
+ for (i = 0; i < 16; i++) {
1302
+ x[i + 16] = a[i];
1303
+ x[i + 32] = c[i];
1304
+ x[i + 48] = b[i];
1305
+ x[i + 64] = d[i];
1306
+ }
1307
+ var x32 = x.subarray(32);
1308
+ var x16 = x.subarray(16);
1309
+ inv25519(x32, x32);
1310
+ M(x16, x16, x32);
1311
+ pack25519(q, x16);
1312
+ return 0;
1313
+ }
1314
+ function crypto_scalarmult_base(q, n) {
1315
+ return crypto_scalarmult(q, n, _9);
1316
+ }
1317
+ function crypto_box_keypair(y, x) {
1318
+ randombytes(x, 32);
1319
+ return crypto_scalarmult_base(y, x);
1320
+ }
1321
+ function crypto_box_beforenm(k, y, x) {
1322
+ var s = new Uint8Array(32);
1323
+ crypto_scalarmult(s, x, y);
1324
+ return crypto_core_hsalsa20(k, _0, s, sigma);
1325
+ }
1326
+ var crypto_box_afternm = crypto_secretbox;
1327
+ var crypto_box_open_afternm = crypto_secretbox_open;
1328
+ function crypto_box(c, m, d, n, y, x) {
1329
+ var k = new Uint8Array(32);
1330
+ crypto_box_beforenm(k, y, x);
1331
+ return crypto_box_afternm(c, m, d, n, k);
1332
+ }
1333
+ function crypto_box_open(m, c, d, n, y, x) {
1334
+ var k = new Uint8Array(32);
1335
+ crypto_box_beforenm(k, y, x);
1336
+ return crypto_box_open_afternm(m, c, d, n, k);
1337
+ }
1338
+ var K = [
1339
+ 1116352408,
1340
+ 3609767458,
1341
+ 1899447441,
1342
+ 602891725,
1343
+ 3049323471,
1344
+ 3964484399,
1345
+ 3921009573,
1346
+ 2173295548,
1347
+ 961987163,
1348
+ 4081628472,
1349
+ 1508970993,
1350
+ 3053834265,
1351
+ 2453635748,
1352
+ 2937671579,
1353
+ 2870763221,
1354
+ 3664609560,
1355
+ 3624381080,
1356
+ 2734883394,
1357
+ 310598401,
1358
+ 1164996542,
1359
+ 607225278,
1360
+ 1323610764,
1361
+ 1426881987,
1362
+ 3590304994,
1363
+ 1925078388,
1364
+ 4068182383,
1365
+ 2162078206,
1366
+ 991336113,
1367
+ 2614888103,
1368
+ 633803317,
1369
+ 3248222580,
1370
+ 3479774868,
1371
+ 3835390401,
1372
+ 2666613458,
1373
+ 4022224774,
1374
+ 944711139,
1375
+ 264347078,
1376
+ 2341262773,
1377
+ 604807628,
1378
+ 2007800933,
1379
+ 770255983,
1380
+ 1495990901,
1381
+ 1249150122,
1382
+ 1856431235,
1383
+ 1555081692,
1384
+ 3175218132,
1385
+ 1996064986,
1386
+ 2198950837,
1387
+ 2554220882,
1388
+ 3999719339,
1389
+ 2821834349,
1390
+ 766784016,
1391
+ 2952996808,
1392
+ 2566594879,
1393
+ 3210313671,
1394
+ 3203337956,
1395
+ 3336571891,
1396
+ 1034457026,
1397
+ 3584528711,
1398
+ 2466948901,
1399
+ 113926993,
1400
+ 3758326383,
1401
+ 338241895,
1402
+ 168717936,
1403
+ 666307205,
1404
+ 1188179964,
1405
+ 773529912,
1406
+ 1546045734,
1407
+ 1294757372,
1408
+ 1522805485,
1409
+ 1396182291,
1410
+ 2643833823,
1411
+ 1695183700,
1412
+ 2343527390,
1413
+ 1986661051,
1414
+ 1014477480,
1415
+ 2177026350,
1416
+ 1206759142,
1417
+ 2456956037,
1418
+ 344077627,
1419
+ 2730485921,
1420
+ 1290863460,
1421
+ 2820302411,
1422
+ 3158454273,
1423
+ 3259730800,
1424
+ 3505952657,
1425
+ 3345764771,
1426
+ 106217008,
1427
+ 3516065817,
1428
+ 3606008344,
1429
+ 3600352804,
1430
+ 1432725776,
1431
+ 4094571909,
1432
+ 1467031594,
1433
+ 275423344,
1434
+ 851169720,
1435
+ 430227734,
1436
+ 3100823752,
1437
+ 506948616,
1438
+ 1363258195,
1439
+ 659060556,
1440
+ 3750685593,
1441
+ 883997877,
1442
+ 3785050280,
1443
+ 958139571,
1444
+ 3318307427,
1445
+ 1322822218,
1446
+ 3812723403,
1447
+ 1537002063,
1448
+ 2003034995,
1449
+ 1747873779,
1450
+ 3602036899,
1451
+ 1955562222,
1452
+ 1575990012,
1453
+ 2024104815,
1454
+ 1125592928,
1455
+ 2227730452,
1456
+ 2716904306,
1457
+ 2361852424,
1458
+ 442776044,
1459
+ 2428436474,
1460
+ 593698344,
1461
+ 2756734187,
1462
+ 3733110249,
1463
+ 3204031479,
1464
+ 2999351573,
1465
+ 3329325298,
1466
+ 3815920427,
1467
+ 3391569614,
1468
+ 3928383900,
1469
+ 3515267271,
1470
+ 566280711,
1471
+ 3940187606,
1472
+ 3454069534,
1473
+ 4118630271,
1474
+ 4000239992,
1475
+ 116418474,
1476
+ 1914138554,
1477
+ 174292421,
1478
+ 2731055270,
1479
+ 289380356,
1480
+ 3203993006,
1481
+ 460393269,
1482
+ 320620315,
1483
+ 685471733,
1484
+ 587496836,
1485
+ 852142971,
1486
+ 1086792851,
1487
+ 1017036298,
1488
+ 365543100,
1489
+ 1126000580,
1490
+ 2618297676,
1491
+ 1288033470,
1492
+ 3409855158,
1493
+ 1501505948,
1494
+ 4234509866,
1495
+ 1607167915,
1496
+ 987167468,
1497
+ 1816402316,
1498
+ 1246189591
1499
+ ];
1500
+ function crypto_hashblocks_hl(hh, hl, m, n) {
1501
+ var wh = new Int32Array(16), wl = new Int32Array(16), bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, th, tl, i, j, h, l, a, b, c, d;
1502
+ var ah0 = hh[0], ah1 = hh[1], ah2 = hh[2], ah3 = hh[3], ah4 = hh[4], ah5 = hh[5], ah6 = hh[6], ah7 = hh[7], al0 = hl[0], al1 = hl[1], al2 = hl[2], al3 = hl[3], al4 = hl[4], al5 = hl[5], al6 = hl[6], al7 = hl[7];
1503
+ var pos = 0;
1504
+ while (n >= 128) {
1505
+ for (i = 0; i < 16; i++) {
1506
+ j = 8 * i + pos;
1507
+ wh[i] = m[j + 0] << 24 | m[j + 1] << 16 | m[j + 2] << 8 | m[j + 3];
1508
+ wl[i] = m[j + 4] << 24 | m[j + 5] << 16 | m[j + 6] << 8 | m[j + 7];
1509
+ }
1510
+ for (i = 0; i < 80; i++) {
1511
+ bh0 = ah0;
1512
+ bh1 = ah1;
1513
+ bh2 = ah2;
1514
+ bh3 = ah3;
1515
+ bh4 = ah4;
1516
+ bh5 = ah5;
1517
+ bh6 = ah6;
1518
+ bh7 = ah7;
1519
+ bl0 = al0;
1520
+ bl1 = al1;
1521
+ bl2 = al2;
1522
+ bl3 = al3;
1523
+ bl4 = al4;
1524
+ bl5 = al5;
1525
+ bl6 = al6;
1526
+ bl7 = al7;
1527
+ h = ah7;
1528
+ l = al7;
1529
+ a = l & 65535;
1530
+ b = l >>> 16;
1531
+ c = h & 65535;
1532
+ d = h >>> 16;
1533
+ h = (ah4 >>> 14 | al4 << 32 - 14) ^ (ah4 >>> 18 | al4 << 32 - 18) ^ (al4 >>> 41 - 32 | ah4 << 32 - (41 - 32));
1534
+ l = (al4 >>> 14 | ah4 << 32 - 14) ^ (al4 >>> 18 | ah4 << 32 - 18) ^ (ah4 >>> 41 - 32 | al4 << 32 - (41 - 32));
1535
+ a += l & 65535;
1536
+ b += l >>> 16;
1537
+ c += h & 65535;
1538
+ d += h >>> 16;
1539
+ h = ah4 & ah5 ^ ~ah4 & ah6;
1540
+ l = al4 & al5 ^ ~al4 & al6;
1541
+ a += l & 65535;
1542
+ b += l >>> 16;
1543
+ c += h & 65535;
1544
+ d += h >>> 16;
1545
+ h = K[i * 2];
1546
+ l = K[i * 2 + 1];
1547
+ a += l & 65535;
1548
+ b += l >>> 16;
1549
+ c += h & 65535;
1550
+ d += h >>> 16;
1551
+ h = wh[i % 16];
1552
+ l = wl[i % 16];
1553
+ a += l & 65535;
1554
+ b += l >>> 16;
1555
+ c += h & 65535;
1556
+ d += h >>> 16;
1557
+ b += a >>> 16;
1558
+ c += b >>> 16;
1559
+ d += c >>> 16;
1560
+ th = c & 65535 | d << 16;
1561
+ tl = a & 65535 | b << 16;
1562
+ h = th;
1563
+ l = tl;
1564
+ a = l & 65535;
1565
+ b = l >>> 16;
1566
+ c = h & 65535;
1567
+ d = h >>> 16;
1568
+ h = (ah0 >>> 28 | al0 << 32 - 28) ^ (al0 >>> 34 - 32 | ah0 << 32 - (34 - 32)) ^ (al0 >>> 39 - 32 | ah0 << 32 - (39 - 32));
1569
+ l = (al0 >>> 28 | ah0 << 32 - 28) ^ (ah0 >>> 34 - 32 | al0 << 32 - (34 - 32)) ^ (ah0 >>> 39 - 32 | al0 << 32 - (39 - 32));
1570
+ a += l & 65535;
1571
+ b += l >>> 16;
1572
+ c += h & 65535;
1573
+ d += h >>> 16;
1574
+ h = ah0 & ah1 ^ ah0 & ah2 ^ ah1 & ah2;
1575
+ l = al0 & al1 ^ al0 & al2 ^ al1 & al2;
1576
+ a += l & 65535;
1577
+ b += l >>> 16;
1578
+ c += h & 65535;
1579
+ d += h >>> 16;
1580
+ b += a >>> 16;
1581
+ c += b >>> 16;
1582
+ d += c >>> 16;
1583
+ bh7 = c & 65535 | d << 16;
1584
+ bl7 = a & 65535 | b << 16;
1585
+ h = bh3;
1586
+ l = bl3;
1587
+ a = l & 65535;
1588
+ b = l >>> 16;
1589
+ c = h & 65535;
1590
+ d = h >>> 16;
1591
+ h = th;
1592
+ l = tl;
1593
+ a += l & 65535;
1594
+ b += l >>> 16;
1595
+ c += h & 65535;
1596
+ d += h >>> 16;
1597
+ b += a >>> 16;
1598
+ c += b >>> 16;
1599
+ d += c >>> 16;
1600
+ bh3 = c & 65535 | d << 16;
1601
+ bl3 = a & 65535 | b << 16;
1602
+ ah1 = bh0;
1603
+ ah2 = bh1;
1604
+ ah3 = bh2;
1605
+ ah4 = bh3;
1606
+ ah5 = bh4;
1607
+ ah6 = bh5;
1608
+ ah7 = bh6;
1609
+ ah0 = bh7;
1610
+ al1 = bl0;
1611
+ al2 = bl1;
1612
+ al3 = bl2;
1613
+ al4 = bl3;
1614
+ al5 = bl4;
1615
+ al6 = bl5;
1616
+ al7 = bl6;
1617
+ al0 = bl7;
1618
+ if (i % 16 === 15) {
1619
+ for (j = 0; j < 16; j++) {
1620
+ h = wh[j];
1621
+ l = wl[j];
1622
+ a = l & 65535;
1623
+ b = l >>> 16;
1624
+ c = h & 65535;
1625
+ d = h >>> 16;
1626
+ h = wh[(j + 9) % 16];
1627
+ l = wl[(j + 9) % 16];
1628
+ a += l & 65535;
1629
+ b += l >>> 16;
1630
+ c += h & 65535;
1631
+ d += h >>> 16;
1632
+ th = wh[(j + 1) % 16];
1633
+ tl = wl[(j + 1) % 16];
1634
+ h = (th >>> 1 | tl << 32 - 1) ^ (th >>> 8 | tl << 32 - 8) ^ th >>> 7;
1635
+ l = (tl >>> 1 | th << 32 - 1) ^ (tl >>> 8 | th << 32 - 8) ^ (tl >>> 7 | th << 32 - 7);
1636
+ a += l & 65535;
1637
+ b += l >>> 16;
1638
+ c += h & 65535;
1639
+ d += h >>> 16;
1640
+ th = wh[(j + 14) % 16];
1641
+ tl = wl[(j + 14) % 16];
1642
+ h = (th >>> 19 | tl << 32 - 19) ^ (tl >>> 61 - 32 | th << 32 - (61 - 32)) ^ th >>> 6;
1643
+ l = (tl >>> 19 | th << 32 - 19) ^ (th >>> 61 - 32 | tl << 32 - (61 - 32)) ^ (tl >>> 6 | th << 32 - 6);
1644
+ a += l & 65535;
1645
+ b += l >>> 16;
1646
+ c += h & 65535;
1647
+ d += h >>> 16;
1648
+ b += a >>> 16;
1649
+ c += b >>> 16;
1650
+ d += c >>> 16;
1651
+ wh[j] = c & 65535 | d << 16;
1652
+ wl[j] = a & 65535 | b << 16;
1653
+ }
1654
+ }
1655
+ }
1656
+ h = ah0;
1657
+ l = al0;
1658
+ a = l & 65535;
1659
+ b = l >>> 16;
1660
+ c = h & 65535;
1661
+ d = h >>> 16;
1662
+ h = hh[0];
1663
+ l = hl[0];
1664
+ a += l & 65535;
1665
+ b += l >>> 16;
1666
+ c += h & 65535;
1667
+ d += h >>> 16;
1668
+ b += a >>> 16;
1669
+ c += b >>> 16;
1670
+ d += c >>> 16;
1671
+ hh[0] = ah0 = c & 65535 | d << 16;
1672
+ hl[0] = al0 = a & 65535 | b << 16;
1673
+ h = ah1;
1674
+ l = al1;
1675
+ a = l & 65535;
1676
+ b = l >>> 16;
1677
+ c = h & 65535;
1678
+ d = h >>> 16;
1679
+ h = hh[1];
1680
+ l = hl[1];
1681
+ a += l & 65535;
1682
+ b += l >>> 16;
1683
+ c += h & 65535;
1684
+ d += h >>> 16;
1685
+ b += a >>> 16;
1686
+ c += b >>> 16;
1687
+ d += c >>> 16;
1688
+ hh[1] = ah1 = c & 65535 | d << 16;
1689
+ hl[1] = al1 = a & 65535 | b << 16;
1690
+ h = ah2;
1691
+ l = al2;
1692
+ a = l & 65535;
1693
+ b = l >>> 16;
1694
+ c = h & 65535;
1695
+ d = h >>> 16;
1696
+ h = hh[2];
1697
+ l = hl[2];
1698
+ a += l & 65535;
1699
+ b += l >>> 16;
1700
+ c += h & 65535;
1701
+ d += h >>> 16;
1702
+ b += a >>> 16;
1703
+ c += b >>> 16;
1704
+ d += c >>> 16;
1705
+ hh[2] = ah2 = c & 65535 | d << 16;
1706
+ hl[2] = al2 = a & 65535 | b << 16;
1707
+ h = ah3;
1708
+ l = al3;
1709
+ a = l & 65535;
1710
+ b = l >>> 16;
1711
+ c = h & 65535;
1712
+ d = h >>> 16;
1713
+ h = hh[3];
1714
+ l = hl[3];
1715
+ a += l & 65535;
1716
+ b += l >>> 16;
1717
+ c += h & 65535;
1718
+ d += h >>> 16;
1719
+ b += a >>> 16;
1720
+ c += b >>> 16;
1721
+ d += c >>> 16;
1722
+ hh[3] = ah3 = c & 65535 | d << 16;
1723
+ hl[3] = al3 = a & 65535 | b << 16;
1724
+ h = ah4;
1725
+ l = al4;
1726
+ a = l & 65535;
1727
+ b = l >>> 16;
1728
+ c = h & 65535;
1729
+ d = h >>> 16;
1730
+ h = hh[4];
1731
+ l = hl[4];
1732
+ a += l & 65535;
1733
+ b += l >>> 16;
1734
+ c += h & 65535;
1735
+ d += h >>> 16;
1736
+ b += a >>> 16;
1737
+ c += b >>> 16;
1738
+ d += c >>> 16;
1739
+ hh[4] = ah4 = c & 65535 | d << 16;
1740
+ hl[4] = al4 = a & 65535 | b << 16;
1741
+ h = ah5;
1742
+ l = al5;
1743
+ a = l & 65535;
1744
+ b = l >>> 16;
1745
+ c = h & 65535;
1746
+ d = h >>> 16;
1747
+ h = hh[5];
1748
+ l = hl[5];
1749
+ a += l & 65535;
1750
+ b += l >>> 16;
1751
+ c += h & 65535;
1752
+ d += h >>> 16;
1753
+ b += a >>> 16;
1754
+ c += b >>> 16;
1755
+ d += c >>> 16;
1756
+ hh[5] = ah5 = c & 65535 | d << 16;
1757
+ hl[5] = al5 = a & 65535 | b << 16;
1758
+ h = ah6;
1759
+ l = al6;
1760
+ a = l & 65535;
1761
+ b = l >>> 16;
1762
+ c = h & 65535;
1763
+ d = h >>> 16;
1764
+ h = hh[6];
1765
+ l = hl[6];
1766
+ a += l & 65535;
1767
+ b += l >>> 16;
1768
+ c += h & 65535;
1769
+ d += h >>> 16;
1770
+ b += a >>> 16;
1771
+ c += b >>> 16;
1772
+ d += c >>> 16;
1773
+ hh[6] = ah6 = c & 65535 | d << 16;
1774
+ hl[6] = al6 = a & 65535 | b << 16;
1775
+ h = ah7;
1776
+ l = al7;
1777
+ a = l & 65535;
1778
+ b = l >>> 16;
1779
+ c = h & 65535;
1780
+ d = h >>> 16;
1781
+ h = hh[7];
1782
+ l = hl[7];
1783
+ a += l & 65535;
1784
+ b += l >>> 16;
1785
+ c += h & 65535;
1786
+ d += h >>> 16;
1787
+ b += a >>> 16;
1788
+ c += b >>> 16;
1789
+ d += c >>> 16;
1790
+ hh[7] = ah7 = c & 65535 | d << 16;
1791
+ hl[7] = al7 = a & 65535 | b << 16;
1792
+ pos += 128;
1793
+ n -= 128;
1794
+ }
1795
+ return n;
1796
+ }
1797
+ function crypto_hash(out, m, n) {
1798
+ var hh = new Int32Array(8), hl = new Int32Array(8), x = new Uint8Array(256), i, b = n;
1799
+ hh[0] = 1779033703;
1800
+ hh[1] = 3144134277;
1801
+ hh[2] = 1013904242;
1802
+ hh[3] = 2773480762;
1803
+ hh[4] = 1359893119;
1804
+ hh[5] = 2600822924;
1805
+ hh[6] = 528734635;
1806
+ hh[7] = 1541459225;
1807
+ hl[0] = 4089235720;
1808
+ hl[1] = 2227873595;
1809
+ hl[2] = 4271175723;
1810
+ hl[3] = 1595750129;
1811
+ hl[4] = 2917565137;
1812
+ hl[5] = 725511199;
1813
+ hl[6] = 4215389547;
1814
+ hl[7] = 327033209;
1815
+ crypto_hashblocks_hl(hh, hl, m, n);
1816
+ n %= 128;
1817
+ for (i = 0; i < n; i++) x[i] = m[b - n + i];
1818
+ x[n] = 128;
1819
+ n = 256 - 128 * (n < 112 ? 1 : 0);
1820
+ x[n - 9] = 0;
1821
+ ts64(x, n - 8, b / 536870912 | 0, b << 3);
1822
+ crypto_hashblocks_hl(hh, hl, x, n);
1823
+ for (i = 0; i < 8; i++) ts64(out, 8 * i, hh[i], hl[i]);
1824
+ return 0;
1825
+ }
1826
+ function add(p, q) {
1827
+ var a = gf(), b = gf(), c = gf(), d = gf(), e = gf(), f = gf(), g = gf(), h = gf(), t = gf();
1828
+ Z(a, p[1], p[0]);
1829
+ Z(t, q[1], q[0]);
1830
+ M(a, a, t);
1831
+ A(b, p[0], p[1]);
1832
+ A(t, q[0], q[1]);
1833
+ M(b, b, t);
1834
+ M(c, p[3], q[3]);
1835
+ M(c, c, D2);
1836
+ M(d, p[2], q[2]);
1837
+ A(d, d, d);
1838
+ Z(e, b, a);
1839
+ Z(f, d, c);
1840
+ A(g, d, c);
1841
+ A(h, b, a);
1842
+ M(p[0], e, f);
1843
+ M(p[1], h, g);
1844
+ M(p[2], g, f);
1845
+ M(p[3], e, h);
1846
+ }
1847
+ function cswap(p, q, b) {
1848
+ var i;
1849
+ for (i = 0; i < 4; i++) {
1850
+ sel25519(p[i], q[i], b);
1851
+ }
1852
+ }
1853
+ function pack(r, p) {
1854
+ var tx = gf(), ty = gf(), zi = gf();
1855
+ inv25519(zi, p[2]);
1856
+ M(tx, p[0], zi);
1857
+ M(ty, p[1], zi);
1858
+ pack25519(r, ty);
1859
+ r[31] ^= par25519(tx) << 7;
1860
+ }
1861
+ function scalarmult(p, q, s) {
1862
+ var b, i;
1863
+ set25519(p[0], gf0);
1864
+ set25519(p[1], gf1);
1865
+ set25519(p[2], gf1);
1866
+ set25519(p[3], gf0);
1867
+ for (i = 255; i >= 0; --i) {
1868
+ b = s[i / 8 | 0] >> (i & 7) & 1;
1869
+ cswap(p, q, b);
1870
+ add(q, p);
1871
+ add(p, p);
1872
+ cswap(p, q, b);
1873
+ }
1874
+ }
1875
+ function scalarbase(p, s) {
1876
+ var q = [gf(), gf(), gf(), gf()];
1877
+ set25519(q[0], X);
1878
+ set25519(q[1], Y);
1879
+ set25519(q[2], gf1);
1880
+ M(q[3], X, Y);
1881
+ scalarmult(p, q, s);
1882
+ }
1883
+ function crypto_sign_keypair(pk, sk, seeded) {
1884
+ var d = new Uint8Array(64);
1885
+ var p = [gf(), gf(), gf(), gf()];
1886
+ var i;
1887
+ if (!seeded) randombytes(sk, 32);
1888
+ crypto_hash(d, sk, 32);
1889
+ d[0] &= 248;
1890
+ d[31] &= 127;
1891
+ d[31] |= 64;
1892
+ scalarbase(p, d);
1893
+ pack(pk, p);
1894
+ for (i = 0; i < 32; i++) sk[i + 32] = pk[i];
1895
+ return 0;
1896
+ }
1897
+ var L = new Float64Array([237, 211, 245, 92, 26, 99, 18, 88, 214, 156, 247, 162, 222, 249, 222, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16]);
1898
+ function modL(r, x) {
1899
+ var carry, i, j, k;
1900
+ for (i = 63; i >= 32; --i) {
1901
+ carry = 0;
1902
+ for (j = i - 32, k = i - 12; j < k; ++j) {
1903
+ x[j] += carry - 16 * x[i] * L[j - (i - 32)];
1904
+ carry = Math.floor((x[j] + 128) / 256);
1905
+ x[j] -= carry * 256;
1906
+ }
1907
+ x[j] += carry;
1908
+ x[i] = 0;
1909
+ }
1910
+ carry = 0;
1911
+ for (j = 0; j < 32; j++) {
1912
+ x[j] += carry - (x[31] >> 4) * L[j];
1913
+ carry = x[j] >> 8;
1914
+ x[j] &= 255;
1915
+ }
1916
+ for (j = 0; j < 32; j++) x[j] -= carry * L[j];
1917
+ for (i = 0; i < 32; i++) {
1918
+ x[i + 1] += x[i] >> 8;
1919
+ r[i] = x[i] & 255;
1920
+ }
1921
+ }
1922
+ function reduce(r) {
1923
+ var x = new Float64Array(64), i;
1924
+ for (i = 0; i < 64; i++) x[i] = r[i];
1925
+ for (i = 0; i < 64; i++) r[i] = 0;
1926
+ modL(r, x);
1927
+ }
1928
+ function crypto_sign(sm, m, n, sk) {
1929
+ var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64);
1930
+ var i, j, x = new Float64Array(64);
1931
+ var p = [gf(), gf(), gf(), gf()];
1932
+ crypto_hash(d, sk, 32);
1933
+ d[0] &= 248;
1934
+ d[31] &= 127;
1935
+ d[31] |= 64;
1936
+ var smlen = n + 64;
1937
+ for (i = 0; i < n; i++) sm[64 + i] = m[i];
1938
+ for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i];
1939
+ crypto_hash(r, sm.subarray(32), n + 32);
1940
+ reduce(r);
1941
+ scalarbase(p, r);
1942
+ pack(sm, p);
1943
+ for (i = 32; i < 64; i++) sm[i] = sk[i];
1944
+ crypto_hash(h, sm, n + 64);
1945
+ reduce(h);
1946
+ for (i = 0; i < 64; i++) x[i] = 0;
1947
+ for (i = 0; i < 32; i++) x[i] = r[i];
1948
+ for (i = 0; i < 32; i++) {
1949
+ for (j = 0; j < 32; j++) {
1950
+ x[i + j] += h[i] * d[j];
1951
+ }
1952
+ }
1953
+ modL(sm.subarray(32), x);
1954
+ return smlen;
1955
+ }
1956
+ function unpackneg(r, p) {
1957
+ var t = gf(), chk = gf(), num = gf(), den = gf(), den2 = gf(), den4 = gf(), den6 = gf();
1958
+ set25519(r[2], gf1);
1959
+ unpack25519(r[1], p);
1960
+ S(num, r[1]);
1961
+ M(den, num, D);
1962
+ Z(num, num, r[2]);
1963
+ A(den, r[2], den);
1964
+ S(den2, den);
1965
+ S(den4, den2);
1966
+ M(den6, den4, den2);
1967
+ M(t, den6, num);
1968
+ M(t, t, den);
1969
+ pow2523(t, t);
1970
+ M(t, t, num);
1971
+ M(t, t, den);
1972
+ M(t, t, den);
1973
+ M(r[0], t, den);
1974
+ S(chk, r[0]);
1975
+ M(chk, chk, den);
1976
+ if (neq25519(chk, num)) M(r[0], r[0], I);
1977
+ S(chk, r[0]);
1978
+ M(chk, chk, den);
1979
+ if (neq25519(chk, num)) return -1;
1980
+ if (par25519(r[0]) === p[31] >> 7) Z(r[0], gf0, r[0]);
1981
+ M(r[3], r[0], r[1]);
1982
+ return 0;
1983
+ }
1984
+ function crypto_sign_open(m, sm, n, pk) {
1985
+ var i;
1986
+ var t = new Uint8Array(32), h = new Uint8Array(64);
1987
+ var p = [gf(), gf(), gf(), gf()], q = [gf(), gf(), gf(), gf()];
1988
+ if (n < 64) return -1;
1989
+ if (unpackneg(q, pk)) return -1;
1990
+ for (i = 0; i < n; i++) m[i] = sm[i];
1991
+ for (i = 0; i < 32; i++) m[i + 32] = pk[i];
1992
+ crypto_hash(h, m, n);
1993
+ reduce(h);
1994
+ scalarmult(p, q, h);
1995
+ scalarbase(q, sm.subarray(32));
1996
+ add(p, q);
1997
+ pack(t, p);
1998
+ n -= 64;
1999
+ if (crypto_verify_32(sm, 0, t, 0)) {
2000
+ for (i = 0; i < n; i++) m[i] = 0;
2001
+ return -1;
2002
+ }
2003
+ for (i = 0; i < n; i++) m[i] = sm[i + 64];
2004
+ return n;
2005
+ }
2006
+ var crypto_secretbox_KEYBYTES = 32, crypto_secretbox_NONCEBYTES = 24, crypto_secretbox_ZEROBYTES = 32, crypto_secretbox_BOXZEROBYTES = 16, crypto_scalarmult_BYTES = 32, crypto_scalarmult_SCALARBYTES = 32, crypto_box_PUBLICKEYBYTES = 32, crypto_box_SECRETKEYBYTES = 32, crypto_box_BEFORENMBYTES = 32, crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, crypto_sign_BYTES = 64, crypto_sign_PUBLICKEYBYTES = 32, crypto_sign_SECRETKEYBYTES = 64, crypto_sign_SEEDBYTES = 32, crypto_hash_BYTES = 64;
2007
+ nacl.lowlevel = {
2008
+ crypto_core_hsalsa20,
2009
+ crypto_stream_xor,
2010
+ crypto_stream,
2011
+ crypto_stream_salsa20_xor,
2012
+ crypto_stream_salsa20,
2013
+ crypto_onetimeauth,
2014
+ crypto_onetimeauth_verify,
2015
+ crypto_verify_16,
2016
+ crypto_verify_32,
2017
+ crypto_secretbox,
2018
+ crypto_secretbox_open,
2019
+ crypto_scalarmult,
2020
+ crypto_scalarmult_base,
2021
+ crypto_box_beforenm,
2022
+ crypto_box_afternm,
2023
+ crypto_box,
2024
+ crypto_box_open,
2025
+ crypto_box_keypair,
2026
+ crypto_hash,
2027
+ crypto_sign,
2028
+ crypto_sign_keypair,
2029
+ crypto_sign_open,
2030
+ crypto_secretbox_KEYBYTES,
2031
+ crypto_secretbox_NONCEBYTES,
2032
+ crypto_secretbox_ZEROBYTES,
2033
+ crypto_secretbox_BOXZEROBYTES,
2034
+ crypto_scalarmult_BYTES,
2035
+ crypto_scalarmult_SCALARBYTES,
2036
+ crypto_box_PUBLICKEYBYTES,
2037
+ crypto_box_SECRETKEYBYTES,
2038
+ crypto_box_BEFORENMBYTES,
2039
+ crypto_box_NONCEBYTES,
2040
+ crypto_box_ZEROBYTES,
2041
+ crypto_box_BOXZEROBYTES,
2042
+ crypto_sign_BYTES,
2043
+ crypto_sign_PUBLICKEYBYTES,
2044
+ crypto_sign_SECRETKEYBYTES,
2045
+ crypto_sign_SEEDBYTES,
2046
+ crypto_hash_BYTES,
2047
+ gf,
2048
+ D,
2049
+ L,
2050
+ pack25519,
2051
+ unpack25519,
2052
+ M,
2053
+ A,
2054
+ S,
2055
+ Z,
2056
+ pow2523,
2057
+ add,
2058
+ set25519,
2059
+ modL,
2060
+ scalarmult,
2061
+ scalarbase
2062
+ };
2063
+ function checkLengths(k, n) {
2064
+ if (k.length !== crypto_secretbox_KEYBYTES) throw new Error("bad key size");
2065
+ if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error("bad nonce size");
2066
+ }
2067
+ function checkBoxLengths(pk, sk) {
2068
+ if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error("bad public key size");
2069
+ if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error("bad secret key size");
2070
+ }
2071
+ function checkArrayTypes() {
2072
+ for (var i = 0; i < arguments.length; i++) {
2073
+ if (!(arguments[i] instanceof Uint8Array))
2074
+ throw new TypeError("unexpected type, use Uint8Array");
2075
+ }
2076
+ }
2077
+ function cleanup(arr) {
2078
+ for (var i = 0; i < arr.length; i++) arr[i] = 0;
2079
+ }
2080
+ nacl.randomBytes = function(n) {
2081
+ var b = new Uint8Array(n);
2082
+ randombytes(b, n);
2083
+ return b;
2084
+ };
2085
+ nacl.secretbox = function(msg, nonce, key) {
2086
+ checkArrayTypes(msg, nonce, key);
2087
+ checkLengths(key, nonce);
2088
+ var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length);
2089
+ var c = new Uint8Array(m.length);
2090
+ for (var i = 0; i < msg.length; i++) m[i + crypto_secretbox_ZEROBYTES] = msg[i];
2091
+ crypto_secretbox(c, m, m.length, nonce, key);
2092
+ return c.subarray(crypto_secretbox_BOXZEROBYTES);
2093
+ };
2094
+ nacl.secretbox.open = function(box, nonce, key) {
2095
+ checkArrayTypes(box, nonce, key);
2096
+ checkLengths(key, nonce);
2097
+ var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length);
2098
+ var m = new Uint8Array(c.length);
2099
+ for (var i = 0; i < box.length; i++) c[i + crypto_secretbox_BOXZEROBYTES] = box[i];
2100
+ if (c.length < 32) return null;
2101
+ if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return null;
2102
+ return m.subarray(crypto_secretbox_ZEROBYTES);
2103
+ };
2104
+ nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES;
2105
+ nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES;
2106
+ nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES;
2107
+ nacl.scalarMult = function(n, p) {
2108
+ checkArrayTypes(n, p);
2109
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error("bad n size");
2110
+ if (p.length !== crypto_scalarmult_BYTES) throw new Error("bad p size");
2111
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
2112
+ crypto_scalarmult(q, n, p);
2113
+ return q;
2114
+ };
2115
+ nacl.scalarMult.base = function(n) {
2116
+ checkArrayTypes(n);
2117
+ if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error("bad n size");
2118
+ var q = new Uint8Array(crypto_scalarmult_BYTES);
2119
+ crypto_scalarmult_base(q, n);
2120
+ return q;
2121
+ };
2122
+ nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES;
2123
+ nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES;
2124
+ nacl.box = function(msg, nonce, publicKey, secretKey) {
2125
+ var k = nacl.box.before(publicKey, secretKey);
2126
+ return nacl.secretbox(msg, nonce, k);
2127
+ };
2128
+ nacl.box.before = function(publicKey, secretKey) {
2129
+ checkArrayTypes(publicKey, secretKey);
2130
+ checkBoxLengths(publicKey, secretKey);
2131
+ var k = new Uint8Array(crypto_box_BEFORENMBYTES);
2132
+ crypto_box_beforenm(k, publicKey, secretKey);
2133
+ return k;
2134
+ };
2135
+ nacl.box.after = nacl.secretbox;
2136
+ nacl.box.open = function(msg, nonce, publicKey, secretKey) {
2137
+ var k = nacl.box.before(publicKey, secretKey);
2138
+ return nacl.secretbox.open(msg, nonce, k);
2139
+ };
2140
+ nacl.box.open.after = nacl.secretbox.open;
2141
+ nacl.box.keyPair = function() {
2142
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
2143
+ var sk = new Uint8Array(crypto_box_SECRETKEYBYTES);
2144
+ crypto_box_keypair(pk, sk);
2145
+ return { publicKey: pk, secretKey: sk };
2146
+ };
2147
+ nacl.box.keyPair.fromSecretKey = function(secretKey) {
2148
+ checkArrayTypes(secretKey);
2149
+ if (secretKey.length !== crypto_box_SECRETKEYBYTES)
2150
+ throw new Error("bad secret key size");
2151
+ var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES);
2152
+ crypto_scalarmult_base(pk, secretKey);
2153
+ return { publicKey: pk, secretKey: new Uint8Array(secretKey) };
2154
+ };
2155
+ nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES;
2156
+ nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES;
2157
+ nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES;
2158
+ nacl.box.nonceLength = crypto_box_NONCEBYTES;
2159
+ nacl.box.overheadLength = nacl.secretbox.overheadLength;
2160
+ nacl.sign = function(msg, secretKey) {
2161
+ checkArrayTypes(msg, secretKey);
2162
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
2163
+ throw new Error("bad secret key size");
2164
+ var signedMsg = new Uint8Array(crypto_sign_BYTES + msg.length);
2165
+ crypto_sign(signedMsg, msg, msg.length, secretKey);
2166
+ return signedMsg;
2167
+ };
2168
+ nacl.sign.open = function(signedMsg, publicKey) {
2169
+ checkArrayTypes(signedMsg, publicKey);
2170
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
2171
+ throw new Error("bad public key size");
2172
+ var tmp = new Uint8Array(signedMsg.length);
2173
+ var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey);
2174
+ if (mlen < 0) return null;
2175
+ var m = new Uint8Array(mlen);
2176
+ for (var i = 0; i < m.length; i++) m[i] = tmp[i];
2177
+ return m;
2178
+ };
2179
+ nacl.sign.detached = function(msg, secretKey) {
2180
+ var signedMsg = nacl.sign(msg, secretKey);
2181
+ var sig = new Uint8Array(crypto_sign_BYTES);
2182
+ for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i];
2183
+ return sig;
2184
+ };
2185
+ nacl.sign.detached.verify = function(msg, sig, publicKey) {
2186
+ checkArrayTypes(msg, sig, publicKey);
2187
+ if (sig.length !== crypto_sign_BYTES)
2188
+ throw new Error("bad signature size");
2189
+ if (publicKey.length !== crypto_sign_PUBLICKEYBYTES)
2190
+ throw new Error("bad public key size");
2191
+ var sm = new Uint8Array(crypto_sign_BYTES + msg.length);
2192
+ var m = new Uint8Array(crypto_sign_BYTES + msg.length);
2193
+ var i;
2194
+ for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i];
2195
+ for (i = 0; i < msg.length; i++) sm[i + crypto_sign_BYTES] = msg[i];
2196
+ return crypto_sign_open(m, sm, sm.length, publicKey) >= 0;
2197
+ };
2198
+ nacl.sign.keyPair = function() {
2199
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
2200
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
2201
+ crypto_sign_keypair(pk, sk);
2202
+ return { publicKey: pk, secretKey: sk };
2203
+ };
2204
+ nacl.sign.keyPair.fromSecretKey = function(secretKey) {
2205
+ checkArrayTypes(secretKey);
2206
+ if (secretKey.length !== crypto_sign_SECRETKEYBYTES)
2207
+ throw new Error("bad secret key size");
2208
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
2209
+ for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32 + i];
2210
+ return { publicKey: pk, secretKey: new Uint8Array(secretKey) };
2211
+ };
2212
+ nacl.sign.keyPair.fromSeed = function(seed) {
2213
+ checkArrayTypes(seed);
2214
+ if (seed.length !== crypto_sign_SEEDBYTES)
2215
+ throw new Error("bad seed size");
2216
+ var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES);
2217
+ var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES);
2218
+ for (var i = 0; i < 32; i++) sk[i] = seed[i];
2219
+ crypto_sign_keypair(pk, sk, true);
2220
+ return { publicKey: pk, secretKey: sk };
2221
+ };
2222
+ nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES;
2223
+ nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES;
2224
+ nacl.sign.seedLength = crypto_sign_SEEDBYTES;
2225
+ nacl.sign.signatureLength = crypto_sign_BYTES;
2226
+ nacl.hash = function(msg) {
2227
+ checkArrayTypes(msg);
2228
+ var h = new Uint8Array(crypto_hash_BYTES);
2229
+ crypto_hash(h, msg, msg.length);
2230
+ return h;
2231
+ };
2232
+ nacl.hash.hashLength = crypto_hash_BYTES;
2233
+ nacl.verify = function(x, y) {
2234
+ checkArrayTypes(x, y);
2235
+ if (x.length === 0 || y.length === 0) return false;
2236
+ if (x.length !== y.length) return false;
2237
+ return vn(x, 0, y, 0, x.length) === 0 ? true : false;
2238
+ };
2239
+ nacl.setPRNG = function(fn) {
2240
+ randombytes = fn;
2241
+ };
2242
+ (function() {
2243
+ var crypto2 = typeof self !== "undefined" ? self.crypto || self.msCrypto : null;
2244
+ if (crypto2 && crypto2.getRandomValues) {
2245
+ var QUOTA = 65536;
2246
+ nacl.setPRNG(function(x, n) {
2247
+ var i, v = new Uint8Array(n);
2248
+ for (i = 0; i < n; i += QUOTA) {
2249
+ crypto2.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA)));
2250
+ }
2251
+ for (i = 0; i < n; i++) x[i] = v[i];
2252
+ cleanup(v);
2253
+ });
2254
+ } else if (typeof __require !== "undefined") {
2255
+ crypto2 = __require("crypto");
2256
+ if (crypto2 && crypto2.randomBytes) {
2257
+ nacl.setPRNG(function(x, n) {
2258
+ var i, v = crypto2.randomBytes(n);
2259
+ for (i = 0; i < n; i++) x[i] = v[i];
2260
+ cleanup(v);
2261
+ });
2262
+ }
2263
+ }
2264
+ })();
2265
+ })(typeof module !== "undefined" && module.exports ? module.exports : self.nacl = self.nacl || {});
2266
+ }
2267
+ });
2268
+
2269
+ // ../../node_modules/base-x/src/index.js
2270
+ var require_src = __commonJS({
2271
+ "../../node_modules/base-x/src/index.js"(exports$1, module) {
2272
+ function base(ALPHABET) {
2273
+ if (ALPHABET.length >= 255) {
2274
+ throw new TypeError("Alphabet too long");
2275
+ }
2276
+ var BASE_MAP = new Uint8Array(256);
2277
+ for (var j = 0; j < BASE_MAP.length; j++) {
2278
+ BASE_MAP[j] = 255;
2279
+ }
2280
+ for (var i = 0; i < ALPHABET.length; i++) {
2281
+ var x = ALPHABET.charAt(i);
2282
+ var xc = x.charCodeAt(0);
2283
+ if (BASE_MAP[xc] !== 255) {
2284
+ throw new TypeError(x + " is ambiguous");
2285
+ }
2286
+ BASE_MAP[xc] = i;
2287
+ }
2288
+ var BASE = ALPHABET.length;
2289
+ var LEADER = ALPHABET.charAt(0);
2290
+ var FACTOR = Math.log(BASE) / Math.log(256);
2291
+ var iFACTOR = Math.log(256) / Math.log(BASE);
2292
+ function encode(source) {
2293
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
2294
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
2295
+ } else if (Array.isArray(source)) {
2296
+ source = Uint8Array.from(source);
2297
+ }
2298
+ if (!(source instanceof Uint8Array)) {
2299
+ throw new TypeError("Expected Uint8Array");
2300
+ }
2301
+ if (source.length === 0) {
2302
+ return "";
2303
+ }
2304
+ var zeroes = 0;
2305
+ var length = 0;
2306
+ var pbegin = 0;
2307
+ var pend = source.length;
2308
+ while (pbegin !== pend && source[pbegin] === 0) {
2309
+ pbegin++;
2310
+ zeroes++;
2311
+ }
2312
+ var size = (pend - pbegin) * iFACTOR + 1 >>> 0;
2313
+ var b58 = new Uint8Array(size);
2314
+ while (pbegin !== pend) {
2315
+ var carry = source[pbegin];
2316
+ var i2 = 0;
2317
+ for (var it1 = size - 1; (carry !== 0 || i2 < length) && it1 !== -1; it1--, i2++) {
2318
+ carry += 256 * b58[it1] >>> 0;
2319
+ b58[it1] = carry % BASE >>> 0;
2320
+ carry = carry / BASE >>> 0;
2321
+ }
2322
+ if (carry !== 0) {
2323
+ throw new Error("Non-zero carry");
2324
+ }
2325
+ length = i2;
2326
+ pbegin++;
2327
+ }
2328
+ var it2 = size - length;
2329
+ while (it2 !== size && b58[it2] === 0) {
2330
+ it2++;
2331
+ }
2332
+ var str = LEADER.repeat(zeroes);
2333
+ for (; it2 < size; ++it2) {
2334
+ str += ALPHABET.charAt(b58[it2]);
2335
+ }
2336
+ return str;
2337
+ }
2338
+ function decodeUnsafe(source) {
2339
+ if (typeof source !== "string") {
2340
+ throw new TypeError("Expected String");
2341
+ }
2342
+ if (source.length === 0) {
2343
+ return new Uint8Array();
2344
+ }
2345
+ var psz = 0;
2346
+ var zeroes = 0;
2347
+ var length = 0;
2348
+ while (source[psz] === LEADER) {
2349
+ zeroes++;
2350
+ psz++;
2351
+ }
2352
+ var size = (source.length - psz) * FACTOR + 1 >>> 0;
2353
+ var b256 = new Uint8Array(size);
2354
+ while (source[psz]) {
2355
+ var charCode = source.charCodeAt(psz);
2356
+ if (charCode > 255) {
2357
+ return;
2358
+ }
2359
+ var carry = BASE_MAP[charCode];
2360
+ if (carry === 255) {
2361
+ return;
2362
+ }
2363
+ var i2 = 0;
2364
+ for (var it3 = size - 1; (carry !== 0 || i2 < length) && it3 !== -1; it3--, i2++) {
2365
+ carry += BASE * b256[it3] >>> 0;
2366
+ b256[it3] = carry % 256 >>> 0;
2367
+ carry = carry / 256 >>> 0;
2368
+ }
2369
+ if (carry !== 0) {
2370
+ throw new Error("Non-zero carry");
2371
+ }
2372
+ length = i2;
2373
+ psz++;
2374
+ }
2375
+ var it4 = size - length;
2376
+ while (it4 !== size && b256[it4] === 0) {
2377
+ it4++;
2378
+ }
2379
+ var vch = new Uint8Array(zeroes + (size - it4));
2380
+ var j2 = zeroes;
2381
+ while (it4 !== size) {
2382
+ vch[j2++] = b256[it4++];
2383
+ }
2384
+ return vch;
2385
+ }
2386
+ function decode(string) {
2387
+ var buffer = decodeUnsafe(string);
2388
+ if (buffer) {
2389
+ return buffer;
2390
+ }
2391
+ throw new Error("Non-base" + BASE + " character");
2392
+ }
2393
+ return {
2394
+ encode,
2395
+ decodeUnsafe,
2396
+ decode
2397
+ };
2398
+ }
2399
+ module.exports = base;
2400
+ }
2401
+ });
2402
+
2403
+ // ../../node_modules/bs58/index.js
2404
+ var require_bs58 = __commonJS({
2405
+ "../../node_modules/bs58/index.js"(exports$1, module) {
2406
+ var basex = require_src();
2407
+ var ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
2408
+ module.exports = basex(ALPHABET);
2409
+ }
2410
+ });
2411
+
2412
+ // ../../node_modules/bs58check/base.js
2413
+ var require_base = __commonJS({
2414
+ "../../node_modules/bs58check/base.js"(exports$1, module) {
2415
+ var base58 = require_bs58();
2416
+ module.exports = function(checksumFn) {
2417
+ function encode(payload) {
2418
+ var payloadU8 = Uint8Array.from(payload);
2419
+ var checksum = checksumFn(payloadU8);
2420
+ var length = payloadU8.length + 4;
2421
+ var both = new Uint8Array(length);
2422
+ both.set(payloadU8, 0);
2423
+ both.set(checksum.subarray(0, 4), payloadU8.length);
2424
+ return base58.encode(both, length);
2425
+ }
2426
+ function decodeRaw(buffer) {
2427
+ var payload = buffer.slice(0, -4);
2428
+ var checksum = buffer.slice(-4);
2429
+ var newChecksum = checksumFn(payload);
2430
+ if (checksum[0] ^ newChecksum[0] | checksum[1] ^ newChecksum[1] | checksum[2] ^ newChecksum[2] | checksum[3] ^ newChecksum[3]) return;
2431
+ return payload;
2432
+ }
2433
+ function decodeUnsafe(string) {
2434
+ var buffer = base58.decodeUnsafe(string);
2435
+ if (!buffer) return;
2436
+ return decodeRaw(buffer);
2437
+ }
2438
+ function decode(string) {
2439
+ var buffer = base58.decode(string);
2440
+ var payload = decodeRaw(buffer);
2441
+ if (!payload) throw new Error("Invalid checksum");
2442
+ return payload;
2443
+ }
2444
+ return {
2445
+ encode,
2446
+ decode,
2447
+ decodeUnsafe
2448
+ };
2449
+ };
2450
+ }
2451
+ });
2452
+
2453
+ // ../../node_modules/bs58check/index.js
2454
+ var require_bs58check = __commonJS({
2455
+ "../../node_modules/bs58check/index.js"(exports$1, module) {
2456
+ var { sha256: sha2562 } = __require("@noble/hashes/sha256");
2457
+ var bs58checkBase = require_base();
2458
+ function sha256x2(buffer) {
2459
+ return sha2562(sha2562(buffer));
2460
+ }
2461
+ module.exports = bs58checkBase(sha256x2);
2462
+ }
2463
+ });
2464
+
8
2465
  // src/config/networks.ts
9
2466
  var NETWORKS = {
10
2467
  bitcoin: {
@@ -1157,6 +3614,178 @@ var WdkService = class {
1157
3614
  this.seed = null;
1158
3615
  }
1159
3616
  };
3617
+ var DERIVATION_PATHS3 = {
3618
+ ethereum: "m/44'/60'/0'/0/0",
3619
+ bitcoin_mainnet: "m/84'/0'/0'/0/0",
3620
+ bitcoin_testnet: "m/84'/1'/0'/0/0",
3621
+ ton: "m/44'/607'/0'/0'/0'",
3622
+ tron: "m/44'/195'/0'/0/0",
3623
+ solana: "m/44'/501'/0'/0'",
3624
+ spark: "m/44'/998'/0'/0/0"
3625
+ };
3626
+ function deriveEthereumAddress(seed) {
3627
+ const hdNode = ethers.HDNodeWallet.fromPhrase(seed, void 0, DERIVATION_PATHS3.ethereum);
3628
+ return hdNode.address;
3629
+ }
3630
+ function deriveBitcoinAddress(seed, network = "testnet") {
3631
+ try {
3632
+ const seedBytes = bip39.mnemonicToSeedSync(seed);
3633
+ const hdKey = bip32.HDKey.fromMasterSeed(seedBytes);
3634
+ const path = network === "testnet" ? DERIVATION_PATHS3.bitcoin_testnet : DERIVATION_PATHS3.bitcoin_mainnet;
3635
+ const child = hdKey.derive(path);
3636
+ if (!child.publicKey) {
3637
+ throw new Error("Failed to derive public key");
3638
+ }
3639
+ const pubKeyHash = ripemd160.ripemd160(sha256.sha256(child.publicKey));
3640
+ const witnessVersion = 0;
3641
+ const words = base.bech32.toWords(pubKeyHash);
3642
+ words.unshift(witnessVersion);
3643
+ const hrp = network === "testnet" ? "tb" : "bc";
3644
+ const address = base.bech32.encode(hrp, words);
3645
+ return address;
3646
+ } catch (error) {
3647
+ console.error("Bitcoin address derivation failed:", error);
3648
+ throw error;
3649
+ }
3650
+ }
3651
+ async function deriveSolanaAddress(seed) {
3652
+ try {
3653
+ const [ed25519, nacl, bs58] = await Promise.all([
3654
+ import('ed25519-hd-key'),
3655
+ Promise.resolve().then(() => __toESM(require_nacl_fast())),
3656
+ Promise.resolve().then(() => __toESM(require_bs58()))
3657
+ ]);
3658
+ const seedBytes = bip39.mnemonicToSeedSync(seed);
3659
+ const derived = ed25519.derivePath(DERIVATION_PATHS3.solana, Buffer.from(seedBytes).toString("hex"));
3660
+ const keypair = nacl.sign.keyPair.fromSeed(new Uint8Array(derived.key));
3661
+ return bs58.encode(keypair.publicKey);
3662
+ } catch (error) {
3663
+ console.error("Solana address derivation failed:", error);
3664
+ throw error;
3665
+ }
3666
+ }
3667
+ async function deriveTonAddress(seed) {
3668
+ try {
3669
+ const [ed25519, nacl] = await Promise.all([
3670
+ import('ed25519-hd-key'),
3671
+ Promise.resolve().then(() => __toESM(require_nacl_fast()))
3672
+ ]);
3673
+ const seedBytes = bip39.mnemonicToSeedSync(seed);
3674
+ const derived = ed25519.derivePath(DERIVATION_PATHS3.ton, Buffer.from(seedBytes).toString("hex"));
3675
+ const keypair = nacl.sign.keyPair.fromSeed(new Uint8Array(derived.key));
3676
+ const publicKey = keypair.publicKey;
3677
+ const workchain = 0;
3678
+ const flags = 17;
3679
+ const hash = sha256.sha256(publicKey);
3680
+ const addressData = new Uint8Array(34);
3681
+ addressData[0] = flags;
3682
+ addressData[1] = workchain;
3683
+ addressData.set(hash, 2);
3684
+ const crc = crc16(addressData);
3685
+ const fullAddress = new Uint8Array(36);
3686
+ fullAddress.set(addressData);
3687
+ fullAddress[34] = crc >> 8 & 255;
3688
+ fullAddress[35] = crc & 255;
3689
+ const base64 = btoa(String.fromCharCode(...fullAddress)).replace(/\+/g, "-").replace(/\//g, "_");
3690
+ return base64;
3691
+ } catch (error) {
3692
+ console.error("TON address derivation failed:", error);
3693
+ throw error;
3694
+ }
3695
+ }
3696
+ function crc16(data) {
3697
+ let crc = 0;
3698
+ for (const byte of data) {
3699
+ crc ^= byte << 8;
3700
+ for (let i = 0; i < 8; i++) {
3701
+ crc = crc & 32768 ? crc << 1 ^ 4129 : crc << 1;
3702
+ crc &= 65535;
3703
+ }
3704
+ }
3705
+ return crc;
3706
+ }
3707
+ async function deriveTronAddress(seed) {
3708
+ try {
3709
+ const bs58check = await Promise.resolve().then(() => __toESM(require_bs58check()));
3710
+ const hdNode = ethers.HDNodeWallet.fromPhrase(seed, void 0, DERIVATION_PATHS3.tron);
3711
+ const ethAddressHex = hdNode.address.slice(2).toLowerCase();
3712
+ const addressBytes = new Uint8Array(21);
3713
+ addressBytes[0] = 65;
3714
+ for (let i = 0; i < 20; i++) {
3715
+ addressBytes[i + 1] = parseInt(ethAddressHex.slice(i * 2, i * 2 + 2), 16);
3716
+ }
3717
+ return bs58check.encode(Buffer.from(addressBytes));
3718
+ } catch (error) {
3719
+ console.error("TRON address derivation failed:", error);
3720
+ throw error;
3721
+ }
3722
+ }
3723
+ function deriveSparkAddress(seed, network = "testnet") {
3724
+ try {
3725
+ const seedBytes = bip39.mnemonicToSeedSync(seed);
3726
+ const hdKey = bip32.HDKey.fromMasterSeed(seedBytes);
3727
+ const child = hdKey.derive(DERIVATION_PATHS3.spark);
3728
+ if (!child.publicKey) {
3729
+ throw new Error("Failed to derive public key");
3730
+ }
3731
+ const pubKeyHash = ripemd160.ripemd160(sha256.sha256(child.publicKey));
3732
+ const witnessVersion = 0;
3733
+ const words = base.bech32.toWords(pubKeyHash);
3734
+ words.unshift(witnessVersion);
3735
+ const hrp = network === "testnet" ? "tsp" : "sp";
3736
+ const address = base.bech32.encode(hrp, words);
3737
+ return address;
3738
+ } catch (error) {
3739
+ console.error("Spark address derivation failed:", error);
3740
+ throw error;
3741
+ }
3742
+ }
3743
+ async function deriveAllAddresses(seed, network = "testnet") {
3744
+ const addresses = {
3745
+ ethereum: null,
3746
+ bitcoin: null,
3747
+ ton: null,
3748
+ tron: null,
3749
+ solana: null,
3750
+ spark: null
3751
+ };
3752
+ try {
3753
+ addresses.ethereum = deriveEthereumAddress(seed);
3754
+ } catch (e) {
3755
+ console.error("ETH derivation failed:", e);
3756
+ }
3757
+ try {
3758
+ addresses.bitcoin = deriveBitcoinAddress(seed, network);
3759
+ } catch (e) {
3760
+ console.error("BTC derivation failed:", e);
3761
+ }
3762
+ try {
3763
+ addresses.spark = deriveSparkAddress(seed, network);
3764
+ } catch (e) {
3765
+ console.error("Spark derivation failed:", e);
3766
+ }
3767
+ const [solResult, tonResult, tronResult] = await Promise.allSettled([
3768
+ deriveSolanaAddress(seed),
3769
+ deriveTonAddress(seed),
3770
+ deriveTronAddress(seed)
3771
+ ]);
3772
+ if (solResult.status === "fulfilled") {
3773
+ addresses.solana = solResult.value;
3774
+ } else {
3775
+ console.error("SOL derivation failed:", solResult.reason);
3776
+ }
3777
+ if (tonResult.status === "fulfilled") {
3778
+ addresses.ton = tonResult.value;
3779
+ } else {
3780
+ console.error("TON derivation failed:", tonResult.reason);
3781
+ }
3782
+ if (tronResult.status === "fulfilled") {
3783
+ addresses.tron = tronResult.value;
3784
+ } else {
3785
+ console.error("TRON derivation failed:", tronResult.reason);
3786
+ }
3787
+ return addresses;
3788
+ }
1160
3789
 
1161
3790
  // src/wallet/WalletManager.ts
1162
3791
  var STORAGE_KEYS = {
@@ -1569,8 +4198,27 @@ var WalletManager = class _WalletManager {
1569
4198
  } catch (apiError) {
1570
4199
  console.warn("WDK API unavailable:", apiError);
1571
4200
  }
1572
- console.warn("WARNING: Using placeholder addresses. These are NOT valid for receiving funds!");
1573
- return this.deriveAllAddresses();
4201
+ console.log("Using browser-compatible address derivation...");
4202
+ try {
4203
+ const browserAddresses = await deriveAllAddresses(
4204
+ this.currentSeed,
4205
+ this.config.network
4206
+ );
4207
+ const addresses = {};
4208
+ for (const chain of this.config.enabledChains) {
4209
+ const address = browserAddresses[chain];
4210
+ if (address) {
4211
+ addresses[chain] = address;
4212
+ }
4213
+ }
4214
+ this.derivedAddresses = addresses;
4215
+ return addresses;
4216
+ } catch (browserError) {
4217
+ console.error("Browser derivation failed:", browserError);
4218
+ const ethAddress = _WalletManager.deriveAddress(this.currentSeed);
4219
+ this.derivedAddresses = { ethereum: ethAddress };
4220
+ return this.derivedAddresses;
4221
+ }
1574
4222
  }
1575
4223
  /**
1576
4224
  * Get address for a specific chain
@@ -2159,6 +4807,410 @@ var SwapService = class {
2159
4807
  }
2160
4808
  };
2161
4809
 
4810
+ // src/services/TransactionService.ts
4811
+ var WdkManager2;
4812
+ var WalletManagerBtc2;
4813
+ var WalletManagerEvm2;
4814
+ var WalletManagerSolana2;
4815
+ var WalletManagerTon2;
4816
+ var WalletManagerTron2;
4817
+ var WalletManagerSpark2;
4818
+ var wdkLoaded2 = false;
4819
+ var wdkLoadError2 = null;
4820
+ var dynamicImport2 = new Function("specifier", "return import(specifier)");
4821
+ async function loadWdkModules2() {
4822
+ if (wdkLoaded2) return;
4823
+ if (wdkLoadError2) throw wdkLoadError2;
4824
+ try {
4825
+ const [wdk, btc, evm, solana, ton, tron, spark] = await Promise.all([
4826
+ dynamicImport2("@tetherto/wdk"),
4827
+ dynamicImport2("@tetherto/wdk-wallet-btc"),
4828
+ dynamicImport2("@tetherto/wdk-wallet-evm"),
4829
+ dynamicImport2("@tetherto/wdk-wallet-solana"),
4830
+ dynamicImport2("@tetherto/wdk-wallet-ton"),
4831
+ dynamicImport2("@tetherto/wdk-wallet-tron"),
4832
+ dynamicImport2("@tetherto/wdk-wallet-spark")
4833
+ ]);
4834
+ WdkManager2 = wdk.default;
4835
+ WalletManagerBtc2 = btc.default;
4836
+ WalletManagerEvm2 = evm.default;
4837
+ WalletManagerSolana2 = solana.default;
4838
+ WalletManagerTon2 = ton.default;
4839
+ WalletManagerTron2 = tron.default;
4840
+ WalletManagerSpark2 = spark.default;
4841
+ wdkLoaded2 = true;
4842
+ } catch (error) {
4843
+ wdkLoadError2 = error instanceof Error ? error : new Error("Failed to load WDK modules");
4844
+ console.error("Failed to load WDK modules:", error);
4845
+ throw wdkLoadError2;
4846
+ }
4847
+ }
4848
+ var DEFAULT_RPC_URLS2 = {
4849
+ mainnet: {
4850
+ ethereum: "https://eth.llamarpc.com",
4851
+ bitcoin: "",
4852
+ // Uses Electrum
4853
+ solana: "https://api.mainnet-beta.solana.com",
4854
+ ton: "https://toncenter.com/api/v2/jsonRPC",
4855
+ tron: "https://api.trongrid.io",
4856
+ spark: ""
4857
+ // Uses Spark network
4858
+ },
4859
+ testnet: {
4860
+ ethereum: "https://ethereum-sepolia-rpc.publicnode.com",
4861
+ bitcoin: "",
4862
+ // Uses Electrum testnet
4863
+ solana: "https://api.devnet.solana.com",
4864
+ ton: "https://testnet.toncenter.com/api/v2/jsonRPC",
4865
+ tron: "https://api.shasta.trongrid.io",
4866
+ spark: ""
4867
+ // Uses Spark testnet
4868
+ }
4869
+ };
4870
+ var EXPLORER_URLS = {
4871
+ mainnet: {
4872
+ ethereum: "https://etherscan.io/tx/",
4873
+ bitcoin: "https://mempool.space/tx/",
4874
+ solana: "https://solscan.io/tx/",
4875
+ ton: "https://tonscan.org/tx/",
4876
+ tron: "https://tronscan.org/#/transaction/",
4877
+ spark: "https://spark.info/tx/"
4878
+ },
4879
+ testnet: {
4880
+ ethereum: "https://sepolia.etherscan.io/tx/",
4881
+ bitcoin: "https://mempool.space/testnet/tx/",
4882
+ solana: "https://solscan.io/tx/?cluster=devnet&tx=",
4883
+ ton: "https://testnet.tonscan.org/tx/",
4884
+ tron: "https://shasta.tronscan.org/#/transaction/",
4885
+ spark: "https://testnet.spark.info/tx/"
4886
+ }
4887
+ };
4888
+ var TransactionService = class {
4889
+ seed = null;
4890
+ config;
4891
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4892
+ wallets = {};
4893
+ constructor(config = {}) {
4894
+ this.config = {
4895
+ network: config.network || "testnet",
4896
+ rpcUrls: config.rpcUrls
4897
+ };
4898
+ }
4899
+ /**
4900
+ * Ensure WDK modules are loaded
4901
+ */
4902
+ async ensureLoaded() {
4903
+ await loadWdkModules2();
4904
+ }
4905
+ /**
4906
+ * Get RPC URL for a chain
4907
+ */
4908
+ getRpcUrl(chain) {
4909
+ const networkUrls = DEFAULT_RPC_URLS2[this.config.network];
4910
+ if (this.config.rpcUrls?.[chain]) {
4911
+ return this.config.rpcUrls[chain];
4912
+ }
4913
+ return networkUrls[chain] || "";
4914
+ }
4915
+ /**
4916
+ * Get explorer URL for a transaction
4917
+ */
4918
+ getExplorerUrl(chain, txHash) {
4919
+ const explorers = EXPLORER_URLS[this.config.network];
4920
+ const baseUrl = explorers[chain] || "";
4921
+ return `${baseUrl}${txHash}`;
4922
+ }
4923
+ /**
4924
+ * Initialize the service with a seed phrase
4925
+ */
4926
+ async initialize(seed) {
4927
+ await this.ensureLoaded();
4928
+ if (!WdkManager2.isValidSeed(seed)) {
4929
+ throw new Error("Invalid seed phrase");
4930
+ }
4931
+ this.seed = seed;
4932
+ this.wallets = {};
4933
+ }
4934
+ /**
4935
+ * Check if service is initialized
4936
+ */
4937
+ isInitialized() {
4938
+ return this.seed !== null;
4939
+ }
4940
+ /**
4941
+ * Get or create wallet instance for a specific chain
4942
+ */
4943
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4944
+ async getWallet(chain) {
4945
+ if (!this.seed) {
4946
+ throw new Error("TransactionService not initialized. Call initialize() first.");
4947
+ }
4948
+ if (this.wallets[chain]) {
4949
+ return this.wallets[chain];
4950
+ }
4951
+ const isTestnet = this.config.network === "testnet";
4952
+ try {
4953
+ switch (chain) {
4954
+ case "ethereum": {
4955
+ const rpcUrl = this.getRpcUrl("ethereum");
4956
+ const wallet = new WalletManagerEvm2(this.seed, { provider: rpcUrl });
4957
+ this.wallets[chain] = wallet;
4958
+ return wallet;
4959
+ }
4960
+ case "bitcoin": {
4961
+ const wallet = new WalletManagerBtc2(this.seed, {
4962
+ network: isTestnet ? "testnet" : "bitcoin"
4963
+ });
4964
+ this.wallets[chain] = wallet;
4965
+ return wallet;
4966
+ }
4967
+ case "solana": {
4968
+ const rpcUrl = this.getRpcUrl("solana");
4969
+ const wallet = new WalletManagerSolana2(this.seed, {
4970
+ rpcUrl
4971
+ });
4972
+ this.wallets[chain] = wallet;
4973
+ return wallet;
4974
+ }
4975
+ case "ton": {
4976
+ const url = this.getRpcUrl("ton");
4977
+ const wallet = new WalletManagerTon2(this.seed, {
4978
+ tonClient: { url }
4979
+ });
4980
+ this.wallets[chain] = wallet;
4981
+ return wallet;
4982
+ }
4983
+ case "tron": {
4984
+ const fullHost = this.getRpcUrl("tron");
4985
+ const wallet = new WalletManagerTron2(this.seed, {
4986
+ provider: fullHost
4987
+ });
4988
+ this.wallets[chain] = wallet;
4989
+ return wallet;
4990
+ }
4991
+ case "spark": {
4992
+ const wallet = new WalletManagerSpark2(this.seed, {
4993
+ network: isTestnet ? "TESTNET" : "MAINNET"
4994
+ });
4995
+ this.wallets[chain] = wallet;
4996
+ return wallet;
4997
+ }
4998
+ default:
4999
+ throw new Error(`Unsupported chain: ${chain}`);
5000
+ }
5001
+ } catch (error) {
5002
+ console.error(`Failed to initialize ${chain} wallet:`, error);
5003
+ throw error;
5004
+ }
5005
+ }
5006
+ /**
5007
+ * Estimate transaction fee
5008
+ */
5009
+ async estimateFee(chain, params) {
5010
+ const wallet = await this.getWallet(chain);
5011
+ try {
5012
+ const feeRates = await wallet.getFeeRates();
5013
+ if (chain === "ethereum") {
5014
+ return {
5015
+ slow: {
5016
+ fee: `${feeRates.slow || "0"} Gwei`,
5017
+ estimatedTime: "~10 min"
5018
+ },
5019
+ medium: {
5020
+ fee: `${feeRates.medium || feeRates.standard || "0"} Gwei`,
5021
+ estimatedTime: "~3 min"
5022
+ },
5023
+ fast: {
5024
+ fee: `${feeRates.fast || feeRates.high || "0"} Gwei`,
5025
+ estimatedTime: "~30 sec"
5026
+ }
5027
+ };
5028
+ } else if (chain === "bitcoin") {
5029
+ return {
5030
+ slow: {
5031
+ fee: `${feeRates.slow || feeRates.low || "0"} sat/vB`,
5032
+ estimatedTime: "~60 min"
5033
+ },
5034
+ medium: {
5035
+ fee: `${feeRates.medium || feeRates.normal || "0"} sat/vB`,
5036
+ estimatedTime: "~30 min"
5037
+ },
5038
+ fast: {
5039
+ fee: `${feeRates.fast || feeRates.high || "0"} sat/vB`,
5040
+ estimatedTime: "~10 min"
5041
+ }
5042
+ };
5043
+ } else {
5044
+ return {
5045
+ slow: {
5046
+ fee: String(feeRates.slow || feeRates.low || "0"),
5047
+ estimatedTime: "~10 min"
5048
+ },
5049
+ medium: {
5050
+ fee: String(feeRates.medium || feeRates.standard || "0"),
5051
+ estimatedTime: "~3 min"
5052
+ },
5053
+ fast: {
5054
+ fee: String(feeRates.fast || feeRates.high || "0"),
5055
+ estimatedTime: "~1 min"
5056
+ }
5057
+ };
5058
+ }
5059
+ } catch (error) {
5060
+ console.error(`Error estimating fee for ${chain}:`, error);
5061
+ return {
5062
+ slow: { fee: "0", estimatedTime: "Unknown" },
5063
+ medium: { fee: "0", estimatedTime: "Unknown" },
5064
+ fast: { fee: "0", estimatedTime: "Unknown" }
5065
+ };
5066
+ }
5067
+ }
5068
+ /**
5069
+ * Send a transaction
5070
+ */
5071
+ async send(chain, params) {
5072
+ const wallet = await this.getWallet(chain);
5073
+ const account = await wallet.getAccount(0);
5074
+ const timestamp = Date.now();
5075
+ try {
5076
+ let txHash;
5077
+ if (params.token) {
5078
+ txHash = await account.sendToken(params.to, params.amount, params.token, {
5079
+ memo: params.memo,
5080
+ feePriority: params.feePriority || "medium"
5081
+ });
5082
+ } else {
5083
+ txHash = await account.send(params.to, params.amount, {
5084
+ memo: params.memo,
5085
+ feePriority: params.feePriority || "medium",
5086
+ gasLimit: params.gasLimit,
5087
+ gasPrice: params.gasPrice
5088
+ });
5089
+ }
5090
+ return {
5091
+ hash: txHash,
5092
+ network: chain,
5093
+ status: "pending",
5094
+ explorerUrl: this.getExplorerUrl(chain, txHash),
5095
+ timestamp
5096
+ };
5097
+ } catch (error) {
5098
+ const errorMessage = error instanceof Error ? error.message : "Transaction failed";
5099
+ console.error(`Transaction failed on ${chain}:`, error);
5100
+ return {
5101
+ hash: "",
5102
+ network: chain,
5103
+ status: "failed",
5104
+ error: errorMessage,
5105
+ timestamp
5106
+ };
5107
+ }
5108
+ }
5109
+ /**
5110
+ * Get transaction status
5111
+ */
5112
+ async getTransactionStatus(chain, txHash) {
5113
+ const wallet = await this.getWallet(chain);
5114
+ try {
5115
+ const tx = await wallet.getTransaction(txHash);
5116
+ return {
5117
+ hash: txHash,
5118
+ network: chain,
5119
+ status: tx.confirmed ? "confirmed" : "pending",
5120
+ blockNumber: tx.blockNumber,
5121
+ gasUsed: tx.gasUsed?.toString(),
5122
+ fee: tx.fee?.toString(),
5123
+ explorerUrl: this.getExplorerUrl(chain, txHash),
5124
+ timestamp: tx.timestamp || Date.now()
5125
+ };
5126
+ } catch (error) {
5127
+ console.error(`Error getting transaction status for ${txHash}:`, error);
5128
+ return {
5129
+ hash: txHash,
5130
+ network: chain,
5131
+ status: "pending",
5132
+ explorerUrl: this.getExplorerUrl(chain, txHash),
5133
+ timestamp: Date.now()
5134
+ };
5135
+ }
5136
+ }
5137
+ /**
5138
+ * Get transaction history for an address
5139
+ */
5140
+ async getTransactionHistory(chain, limit = 10) {
5141
+ const wallet = await this.getWallet(chain);
5142
+ const account = await wallet.getAccount(0);
5143
+ try {
5144
+ const history = await account.getTransactions({ limit });
5145
+ return history.map((tx) => ({
5146
+ hash: tx.hash || tx.txHash,
5147
+ network: chain,
5148
+ type: tx.type || (tx.from === account.address ? "send" : "receive"),
5149
+ from: tx.from,
5150
+ to: tx.to,
5151
+ amount: tx.amount || tx.value,
5152
+ token: tx.token,
5153
+ fee: tx.fee?.toString(),
5154
+ status: tx.confirmed ? "confirmed" : "pending",
5155
+ timestamp: tx.timestamp || Date.now(),
5156
+ blockNumber: tx.blockNumber
5157
+ }));
5158
+ } catch (error) {
5159
+ console.error(`Error getting transaction history for ${chain}:`, error);
5160
+ return [];
5161
+ }
5162
+ }
5163
+ /**
5164
+ * Get balance for a specific chain
5165
+ */
5166
+ async getBalance(chain) {
5167
+ const wallet = await this.getWallet(chain);
5168
+ const account = await wallet.getAccount(0);
5169
+ try {
5170
+ const balance = await account.getBalance();
5171
+ return {
5172
+ balance: balance.toString(),
5173
+ balanceUsd: 0
5174
+ // TODO: Implement price fetching
5175
+ };
5176
+ } catch (error) {
5177
+ console.error(`Error getting balance for ${chain}:`, error);
5178
+ return { balance: "0", balanceUsd: 0 };
5179
+ }
5180
+ }
5181
+ /**
5182
+ * Get the current network configuration
5183
+ */
5184
+ getNetwork() {
5185
+ return this.config.network;
5186
+ }
5187
+ /**
5188
+ * Clean up and dispose of wallet instances
5189
+ */
5190
+ dispose() {
5191
+ for (const wallet of Object.values(this.wallets)) {
5192
+ if (wallet && typeof wallet.dispose === "function") {
5193
+ try {
5194
+ wallet.dispose();
5195
+ } catch {
5196
+ }
5197
+ }
5198
+ }
5199
+ this.wallets = {};
5200
+ this.seed = null;
5201
+ }
5202
+ };
5203
+ var transactionServiceInstance = null;
5204
+ function getTransactionService(config) {
5205
+ if (!transactionServiceInstance || config && config.network !== transactionServiceInstance.getNetwork()) {
5206
+ transactionServiceInstance = new TransactionService(config);
5207
+ }
5208
+ return transactionServiceInstance;
5209
+ }
5210
+ function createTransactionService(config) {
5211
+ return new TransactionService(config);
5212
+ }
5213
+
2162
5214
  // src/types/index.ts
2163
5215
  var ZubariError = class extends Error {
2164
5216
  constructor(code, message, details) {
@@ -2390,6 +5442,7 @@ exports.NETWORKS = NETWORKS;
2390
5442
  exports.PLATFORM_CONFIG = PLATFORM_CONFIG;
2391
5443
  exports.SwapService = SwapService;
2392
5444
  exports.TESTNET_NETWORKS = TESTNET_NETWORKS;
5445
+ exports.TransactionService = TransactionService;
2393
5446
  exports.WalletManager = WalletManager;
2394
5447
  exports.WebEncryptedStorageAdapter = WebEncryptedStorageAdapter;
2395
5448
  exports.ZUBARI_CONTRACTS = ZUBARI_CONTRACTS;
@@ -2400,10 +5453,12 @@ exports.ZubariSubscriptionProtocol = ZubariSubscriptionProtocol;
2400
5453
  exports.ZubariTipsProtocol = ZubariTipsProtocol;
2401
5454
  exports.ZubariWallet = ZubariWallet;
2402
5455
  exports.createSecureStorage = createSecureStorage;
5456
+ exports.createTransactionService = createTransactionService;
2403
5457
  exports.formatAddress = formatAddress;
2404
5458
  exports.formatBalance = formatBalance;
2405
5459
  exports.getContractAddresses = getContractAddresses;
2406
5460
  exports.getNetworkConfig = getNetworkConfig;
5461
+ exports.getTransactionService = getTransactionService;
2407
5462
  exports.isValidAddress = isValidAddress;
2408
5463
  exports.normalizeAddress = normalizeAddress;
2409
5464
  exports.useWalletManager = useWalletManager;