@private.me/xbind 1.2.17 → 1.3.5

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 (77) hide show
  1. package/README.md +97 -7
  2. package/dist-standalone/_deps/crypto/base64.js +212 -87
  3. package/dist-standalone/_deps/crypto/cjs/base64.js +653 -91
  4. package/dist-standalone/_deps/crypto/cjs/errors.js +658 -102
  5. package/dist-standalone/_deps/crypto/cjs/hmac.js +468 -66
  6. package/dist-standalone/_deps/crypto/cjs/index.js +848 -82
  7. package/dist-standalone/_deps/crypto/cjs/package.json +1 -0
  8. package/dist-standalone/_deps/crypto/cjs/padding.js +504 -50
  9. package/dist-standalone/_deps/crypto/cjs/share-header.js +369 -65
  10. package/dist-standalone/_deps/crypto/cjs/shares.js +865 -143
  11. package/dist-standalone/_deps/crypto/cjs/tlv.js +1005 -183
  12. package/dist-standalone/_deps/crypto/cjs/uuid.js +437 -55
  13. package/dist-standalone/_deps/crypto/cjs/verify.js +414 -24
  14. package/dist-standalone/_deps/crypto/cjs/xorida.js +888 -186
  15. package/dist-standalone/_deps/crypto/errors.js +179 -89
  16. package/dist-standalone/_deps/crypto/hmac.js +129 -61
  17. package/dist-standalone/_deps/crypto/index.js +140 -40
  18. package/dist-standalone/_deps/crypto/padding.js +151 -45
  19. package/dist-standalone/_deps/crypto/share-header.js +89 -60
  20. package/dist-standalone/_deps/crypto/shares.js +280 -133
  21. package/dist-standalone/_deps/crypto/tlv.js +348 -179
  22. package/dist-standalone/_deps/crypto/uuid.js +130 -50
  23. package/dist-standalone/_deps/crypto/verify.js +71 -15
  24. package/dist-standalone/_deps/crypto/xorida.js +332 -181
  25. package/dist-standalone/_deps/shared/cjs/errors.js +582 -525
  26. package/dist-standalone/_deps/shared/cjs/index.js +413 -409
  27. package/dist-standalone/_deps/shared/cjs/types.js +262 -348
  28. package/dist-standalone/_deps/shared/errors.d.ts +7 -1
  29. package/dist-standalone/_deps/shared/errors.d.ts.map +1 -1
  30. package/dist-standalone/_deps/shared/errors.js +229 -166
  31. package/dist-standalone/_deps/shared/errors.js.map +1 -1
  32. package/dist-standalone/_deps/shared/index.js +50 -54
  33. package/dist-standalone/_deps/shared/types.js +61 -60
  34. package/dist-standalone/_deps/ux-helpers/cjs/errors.js +1 -1
  35. package/dist-standalone/_deps/ux-helpers/cjs/pagination.js +1 -1
  36. package/dist-standalone/_deps/ux-helpers/cjs/progress.js +1 -1
  37. package/dist-standalone/_deps/ux-helpers/cjs/search.js +1 -1
  38. package/dist-standalone/_deps/ux-helpers/errors.js +1 -1
  39. package/dist-standalone/_deps/ux-helpers/pagination.js +1 -1
  40. package/dist-standalone/_deps/ux-helpers/progress.js +1 -1
  41. package/dist-standalone/_deps/ux-helpers/search.js +1 -1
  42. package/dist-standalone/_deps/xchange/auto-accept.js +1 -1
  43. package/dist-standalone/_deps/xchange/cjs/auto-accept.js +1 -1
  44. package/dist-standalone/_deps/xchange/cjs/errors.js +1 -1
  45. package/dist-standalone/_deps/xchange/cjs/index.js +1 -1
  46. package/dist-standalone/_deps/xchange/cjs/invite-client.js +1 -1
  47. package/dist-standalone/_deps/xchange/cjs/lazy-init.js +1 -1
  48. package/dist-standalone/_deps/xchange/cjs/trust-integration.js +1 -1
  49. package/dist-standalone/_deps/xchange/cjs/xchange.js +1 -1
  50. package/dist-standalone/_deps/xchange/errors.js +1 -1
  51. package/dist-standalone/_deps/xchange/index.js +1 -1
  52. package/dist-standalone/_deps/xchange/invite-client.js +1 -1
  53. package/dist-standalone/_deps/xchange/lazy-init.js +1 -1
  54. package/dist-standalone/_deps/xchange/trust-integration.js +1 -1
  55. package/dist-standalone/_deps/xchange/xchange.js +1 -1
  56. package/dist-standalone/_deps/xregistry/cjs/discovery.js +1 -1
  57. package/dist-standalone/_deps/xregistry/cjs/errors.js +1 -1
  58. package/dist-standalone/_deps/xregistry/cjs/index.js +1 -1
  59. package/dist-standalone/_deps/xregistry/cjs/registry.js +1 -1
  60. package/dist-standalone/_deps/xregistry/cjs/schema.js +1 -1
  61. package/dist-standalone/_deps/xregistry/cjs/types.js +1 -1
  62. package/dist-standalone/_deps/xregistry/discovery.js +1 -1
  63. package/dist-standalone/_deps/xregistry/errors.js +1 -1
  64. package/dist-standalone/_deps/xregistry/index.js +1 -1
  65. package/dist-standalone/_deps/xregistry/registry.js +1 -1
  66. package/dist-standalone/_deps/xregistry/schema.js +1 -1
  67. package/dist-standalone/_deps/xregistry/types.js +1 -1
  68. package/dist-standalone/cjs/identity.js +2 -3
  69. package/dist-standalone/cli/setup.d.ts +52 -0
  70. package/dist-standalone/cli/setup.js +515 -0
  71. package/dist-standalone/cli/types.d.ts +79 -0
  72. package/dist-standalone/cli/types.js +27 -0
  73. package/dist-standalone/cli/xbind.d.ts +20 -0
  74. package/dist-standalone/cli/xbind.js +149 -0
  75. package/dist-standalone/identity.js +2 -3
  76. package/package.json +3 -2
  77. package/share1.dat +0 -0
@@ -1,215 +1,366 @@
1
- /**
2
- * XorIDA Threshold Secret Sharing over GF(2).
3
- *
4
- * Proprietary, patent-protected (k,n)-threshold secret sharing construction.
5
- *
6
- * All arithmetic is XOR (GF(2)). The generator matrix is constructed from a cyclic
7
- * index formula using NextOddPrime(n). Any k-of-n shares reconstruct the original
8
- * message via Gaussian elimination on the restricted generator matrix.
9
- */
10
- /**
11
- * Find the smallest odd prime >= n.
12
- * Used to determine the cyclic group Z_p for generator matrix construction.
13
- *
14
- * @param n - Total number of shares
15
- * @returns Smallest odd prime >= n
16
- */
17
- export function nextOddPrime(n) {
18
- let i = n;
19
- while (true) {
20
- if (i >= 2 && isOddPrime(i))
21
- return i;
22
- i++;
1
+ function a21_0x2adb() {
2
+ const _0x2f3f4d = [
3
+ 'mJjewwLtt1m',
4
+ 'rMv3qui',
5
+ 'ndi3ntqYnxDHufnxqW',
6
+ 'sw1XzKi',
7
+ 'mJe3zhbouu5X',
8
+ 'twvZC2fNzsbSzw5NDgGG',
9
+ 'C1zOwwu',
10
+ 'DxHWBhy',
11
+ 'CunxAgm',
12
+ 'rxzcrwG',
13
+ 'EgTkwvu',
14
+ 'C3vIyxjYyxK',
15
+ 'nJmXnZrzrMrfDNy',
16
+ 'rxHWzwn0zwqG',
17
+ 'mJbOz0DvsNa',
18
+ 'mZaYnJCYq1j4CeXk',
19
+ 'ww5wv2q',
20
+ 'ChvZAa',
21
+ 'sfzQtNK',
22
+ 'sMX1uKq',
23
+ 'B0T2DNG',
24
+ 'yxbiwg4',
25
+ 'vfrosfq',
26
+ 'ihnOyxjLCYWGz290ia',
27
+ 'tvPouhy',
28
+ 'odqYmtG3B2zpAwHY',
29
+ 'vvrmAgK',
30
+ 'BgvUz3rO',
31
+ 'mtq1BvfUzgHY',
32
+ 'ueneCeq',
33
+ 'EwT0ugC',
34
+ 'AKz4swq',
35
+ 'qu5or1C',
36
+ 'odCXmduWmgfPEhzXBG',
37
+ 'ote3nJKWrxv6ufrU',
38
+ 'AMrtqui',
39
+ 'ntm3nfjsqMHvBW',
40
+ 'C2XPy2u',
41
+ 'mJyXELzTCeDT',
42
+ 'y1HAyKO',
43
+ 'zMXVB3i',
44
+ 'C2Hrr1C',
45
+ 'igLZig5VDcbHig11BhrPCgXLig9MigjSB2nRihnPEMuG',
46
+ 'B0XSENe',
47
+ 'CMfpEwC'
48
+ ];
49
+ a21_0x2adb = function () {
50
+ return _0x2f3f4d;
51
+ };
52
+ return a21_0x2adb();
53
+ }
54
+ (function (_0x342e0e, _0x29961e) {
55
+ const a21_0x40207c = {
56
+ _0x112f75: 0x16f,
57
+ _0x1c14fa: 0x164,
58
+ _0x122456: 0x17c,
59
+ _0x5666b6: 0x171
60
+ }, _0x597d56 = a21_0x5607, _0xfdd432 = _0x342e0e();
61
+ while (!![]) {
62
+ try {
63
+ const _0xa7dd21 = parseInt(_0x597d56(0x167)) / 0x1 * (parseInt(_0x597d56(a21_0x40207c._0x112f75)) / 0x2) + parseInt(_0x597d56(a21_0x40207c._0x1c14fa)) / 0x3 * (-parseInt(_0x597d56(0x186)) / 0x4) + parseInt(_0x597d56(0x17a)) / 0x5 + parseInt(_0x597d56(0x184)) / 0x6 * (parseInt(_0x597d56(a21_0x40207c._0x122456)) / 0x7) + parseInt(_0x597d56(0x187)) / 0x8 * (parseInt(_0x597d56(a21_0x40207c._0x5666b6)) / 0x9) + parseInt(_0x597d56(0x16d)) / 0xa * (parseInt(_0x597d56(0x178)) / 0xb) + -parseInt(_0x597d56(0x16c)) / 0xc;
64
+ if (_0xa7dd21 === _0x29961e)
65
+ break;
66
+ else
67
+ _0xfdd432['push'](_0xfdd432['shift']());
68
+ } catch (_0x12d6ea) {
69
+ _0xfdd432['push'](_0xfdd432['shift']());
70
+ }
71
+ }
72
+ }(a21_0x2adb, 0xb057f));
73
+ export function nextOddPrime(_0x5e299d) {
74
+ const _0x1f3a20 = a21_0x5607, _0x16d2ee = {
75
+ 'oLlzq': function (_0x1962b5, _0x555c8e) {
76
+ return _0x1962b5 >= _0x555c8e;
77
+ },
78
+ 'qCWhc': function (_0x496c58, _0x4f262e) {
79
+ return _0x496c58(_0x4f262e);
80
+ }
81
+ };
82
+ let _0x2487e5 = _0x5e299d;
83
+ while (!![]) {
84
+ if (_0x16d2ee[_0x1f3a20(0x176)](_0x2487e5, 0x2) && _0x16d2ee[_0x1f3a20(0x180)](isOddPrime, _0x2487e5))
85
+ return _0x2487e5;
86
+ _0x2487e5++;
23
87
  }
24
88
  }
25
- /** Max bytes per crypto.getRandomValues call (Web Crypto API limit). */
26
- const MAX_RANDOM_CHUNK = 65536;
27
- /** Fill a Uint8Array with cryptographic random bytes, chunked to respect API limits. */
28
- function fillRandom(arr) {
29
- for (let offset = 0; offset < arr.length; offset += MAX_RANDOM_CHUNK) {
30
- const end = Math.min(offset + MAX_RANDOM_CHUNK, arr.length);
31
- crypto.getRandomValues(arr.subarray(offset, end));
89
+ function a21_0x5607(_0x31b2c0, _0x2527be) {
90
+ _0x31b2c0 = _0x31b2c0 - 0x15d;
91
+ const _0x2adb0a = a21_0x2adb();
92
+ let _0x560779 = _0x2adb0a[_0x31b2c0];
93
+ if (a21_0x5607['kSmfGy'] === undefined) {
94
+ var _0x243017 = function (_0x4599d9) {
95
+ const _0x196a5e = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
96
+ let _0x3df5ea = '', _0x14b2a6 = '';
97
+ for (let _0x43bcd5 = 0x0, _0x3c2317, _0x223bd7, _0x546290 = 0x0; _0x223bd7 = _0x4599d9['charAt'](_0x546290++); ~_0x223bd7 && (_0x3c2317 = _0x43bcd5 % 0x4 ? _0x3c2317 * 0x40 + _0x223bd7 : _0x223bd7, _0x43bcd5++ % 0x4) ? _0x3df5ea += String['fromCharCode'](0xff & _0x3c2317 >> (-0x2 * _0x43bcd5 & 0x6)) : 0x0) {
98
+ _0x223bd7 = _0x196a5e['indexOf'](_0x223bd7);
99
+ }
100
+ for (let _0xdb86ec = 0x0, _0x2b5fa9 = _0x3df5ea['length']; _0xdb86ec < _0x2b5fa9; _0xdb86ec++) {
101
+ _0x14b2a6 += '%' + ('00' + _0x3df5ea['charCodeAt'](_0xdb86ec)['toString'](0x10))['slice'](-0x2);
102
+ }
103
+ return decodeURIComponent(_0x14b2a6);
104
+ };
105
+ a21_0x5607['DmKLEd'] = _0x243017, a21_0x5607['lWCBYv'] = {}, a21_0x5607['kSmfGy'] = !![];
32
106
  }
107
+ const _0x3ca29c = _0x2adb0a[0x0], _0x4c24b1 = _0x31b2c0 + _0x3ca29c, _0x4d22b0 = a21_0x5607['lWCBYv'][_0x4c24b1];
108
+ return !_0x4d22b0 ? (_0x560779 = a21_0x5607['DmKLEd'](_0x560779), a21_0x5607['lWCBYv'][_0x4c24b1] = _0x560779) : _0x560779 = _0x4d22b0, _0x560779;
33
109
  }
34
- /** Check if a number is an odd prime. */
35
- function isOddPrime(n) {
36
- if (n < 2)
37
- return false;
38
- if (n === 2)
39
- return false; // even
40
- if (n === 3)
41
- return true;
42
- if (n % 2 === 0)
43
- return false;
44
- for (let d = 3; d * d <= n; d += 2) {
45
- if (n % d === 0)
46
- return false;
110
+ const MAX_RANDOM_CHUNK = 0x10000;
111
+ function fillRandom(_0x1e02c8) {
112
+ const a21_0x3ffa99 = { _0x20c417: 0x166 }, _0x43a112 = a21_0x5607;
113
+ for (let _0x4b6c3c = 0x0; _0x4b6c3c < _0x1e02c8[_0x43a112(a21_0x3ffa99._0x20c417)]; _0x4b6c3c += MAX_RANDOM_CHUNK) {
114
+ const _0x4d938e = Math['min'](_0x4b6c3c + MAX_RANDOM_CHUNK, _0x1e02c8[_0x43a112(0x166)]);
115
+ crypto['getRandomValues'](_0x1e02c8[_0x43a112(0x183)](_0x4b6c3c, _0x4d938e));
47
116
  }
48
- return true;
49
117
  }
50
- /**
51
- * Split a padded message into n shares using XorIDA threshold sharing.
52
- *
53
- * The message length must be a multiple of b = NextOddPrime(n) - 1.
54
- * Each share is the same length as the input message.
55
- *
56
- * @param paddedMessage - PKCS#7-padded message (length must be multiple of b)
57
- * @param n - Total number of shares to produce
58
- * @param k - Threshold: minimum shares needed for reconstruction
59
- * @returns Array of n shares, each the same length as paddedMessage
60
- */
61
- export function splitXorIDA(paddedMessage, n, k) {
62
- const p = nextOddPrime(n);
63
- const b = p - 1;
64
- if (paddedMessage.length === 0 || paddedMessage.length % b !== 0) {
65
- throw new Error(`Message length ${paddedMessage.length} is not a multiple of block size ${b}`);
118
+ function isOddPrime(_0x276bdb) {
119
+ const a21_0x19a501 = {
120
+ _0x5642ad: 0x16a,
121
+ _0x26be8d: 0x15d
122
+ }, _0xbd3920 = a21_0x5607, _0xc47eed = {
123
+ 'NRWvj': function (_0x277dd3, _0x3ac6e8) {
124
+ return _0x277dd3 < _0x3ac6e8;
125
+ },
126
+ 'jFxId': function (_0x406e93, _0x511abc) {
127
+ return _0x406e93 === _0x511abc;
128
+ },
129
+ 'HVjNy': function (_0x302df0, _0x25b712) {
130
+ return _0x302df0 === _0x25b712;
131
+ },
132
+ 'Hshkv': function (_0x1dac91, _0x1d08ba) {
133
+ return _0x1dac91 % _0x1d08ba;
134
+ },
135
+ 'oKvvx': function (_0x5432c4, _0x37bdbe) {
136
+ return _0x5432c4 * _0x37bdbe;
137
+ }
138
+ };
139
+ if (_0xc47eed['NRWvj'](_0x276bdb, 0x2))
140
+ return ![];
141
+ if (_0xc47eed[_0xbd3920(a21_0x19a501._0x5642ad)](_0x276bdb, 0x2))
142
+ return ![];
143
+ if (_0xc47eed[_0xbd3920(a21_0x19a501._0x26be8d)](_0x276bdb, 0x3))
144
+ return !![];
145
+ if (_0xc47eed['Hshkv'](_0x276bdb, 0x2) === 0x0)
146
+ return ![];
147
+ for (let _0x1dc70c = 0x3; _0xc47eed[_0xbd3920(0x15f)](_0x1dc70c, _0x1dc70c) <= _0x276bdb; _0x1dc70c += 0x2) {
148
+ if (_0x276bdb % _0x1dc70c === 0x0)
149
+ return ![];
66
150
  }
67
- return splitWithRandom(paddedMessage, n, k, p, b);
151
+ return !![];
68
152
  }
69
- /**
70
- * Split with externally provided random source arrays (for testing with known vectors).
71
- * @internal Exported for testing only.
72
- */
73
- export function splitWithRandom(paddedMessage, n, k, p, b, randomArrays) {
74
- const msgLen = paddedMessage.length;
75
- const numBlocks = msgLen / b;
76
- // Step 1: Create k source arrays — (k-1) random + message
77
- const sourceArrays = [];
78
- for (let i = 0; i < k - 1; i++) {
79
- const provided = randomArrays?.[i];
80
- if (provided) {
81
- sourceArrays.push(provided);
82
- }
153
+ export function splitXorIDA(_0x12ce7f, _0x1f8b0f, _0x42790b) {
154
+ const a21_0x45f683 = {
155
+ _0x3e613e: 0x181,
156
+ _0xa3323b: 0x179,
157
+ _0x40a854: 0x166,
158
+ _0x47961b: 0x17d,
159
+ _0x5d1f4b: 0x166
160
+ }, _0x1d54ee = a21_0x5607, _0x32b617 = {
161
+ 'EvBEh': function (_0x1ba495, _0x9aa6ef) {
162
+ return _0x1ba495(_0x9aa6ef);
163
+ },
164
+ 'qvbhB': function (_0x3152d1, _0x14a7a6) {
165
+ return _0x3152d1 - _0x14a7a6;
166
+ },
167
+ 'FewAB': function (_0x19d8ce, _0x31d41d) {
168
+ return _0x19d8ce === _0x31d41d;
169
+ },
170
+ 'CLDKd': function (_0x19644e, _0x4d0346) {
171
+ return _0x19644e !== _0x4d0346;
172
+ }
173
+ }, _0x828174 = _0x32b617[_0x1d54ee(a21_0x45f683._0x3e613e)](nextOddPrime, _0x1f8b0f), _0x4e991d = _0x32b617['qvbhB'](_0x828174, 0x1);
174
+ if (_0x32b617[_0x1d54ee(a21_0x45f683._0xa3323b)](_0x12ce7f[_0x1d54ee(a21_0x45f683._0x40a854)], 0x0) || _0x32b617['CLDKd'](_0x12ce7f[_0x1d54ee(0x166)] % _0x4e991d, 0x0))
175
+ throw new Error(_0x1d54ee(a21_0x45f683._0x47961b) + _0x12ce7f[_0x1d54ee(a21_0x45f683._0x5d1f4b)] + _0x1d54ee(0x175) + _0x4e991d);
176
+ return splitWithRandom(_0x12ce7f, _0x1f8b0f, _0x42790b, _0x828174, _0x4e991d);
177
+ }
178
+ export function splitWithRandom(_0x3b8590, _0x32b832, _0x2d4aa3, _0x433fb4, _0x1173b2, _0x11fba1) {
179
+ const a21_0x539b23 = {
180
+ _0x357087: 0x166,
181
+ _0x70b56c: 0x17e
182
+ }, _0x19875b = a21_0x5607, _0x183b6b = {
183
+ 'YnVWd': function (_0x47f13f, _0x9542c8) {
184
+ return _0x47f13f / _0x9542c8;
185
+ },
186
+ 'sVhYe': function (_0x12fdd1, _0x44acd9) {
187
+ return _0x12fdd1(_0x44acd9);
188
+ },
189
+ 'raOyg': function (_0x4d30c6, _0x3c7cbc) {
190
+ return _0x4d30c6 < _0x3c7cbc;
191
+ },
192
+ 'tQeNS': function (_0x43d431, _0x4e1fad) {
193
+ return _0x43d431 * _0x4e1fad;
194
+ },
195
+ 'iKazs': function (_0x2042ac, _0x389e0a) {
196
+ return _0x2042ac < _0x389e0a;
197
+ },
198
+ 'apHXn': function (_0x4d2aac, _0x42b016) {
199
+ return _0x4d2aac + _0x42b016;
200
+ }
201
+ }, _0x3bf88d = _0x3b8590[_0x19875b(a21_0x539b23._0x357087)], _0x20803a = _0x183b6b[_0x19875b(0x188)](_0x3bf88d, _0x1173b2), _0x54afdf = [];
202
+ for (let _0x295927 = 0x0; _0x295927 < _0x2d4aa3 - 0x1; _0x295927++) {
203
+ const _0xc2dc8 = _0x11fba1?.[_0x295927];
204
+ if (_0xc2dc8)
205
+ _0x54afdf[_0x19875b(0x189)](_0xc2dc8);
83
206
  else {
84
- const rand = new Uint8Array(msgLen);
85
- fillRandom(rand);
86
- sourceArrays.push(rand);
207
+ const _0x36634c = new Uint8Array(_0x3bf88d);
208
+ _0x183b6b[_0x19875b(a21_0x539b23._0x70b56c)](fillRandom, _0x36634c), _0x54afdf[_0x19875b(0x189)](_0x36634c);
87
209
  }
88
210
  }
89
- sourceArrays.push(paddedMessage);
90
- // Step 2: Construct each share using the generator matrix index formula
91
- const shares = [];
92
- for (let shareIdx = 0; shareIdx < n; shareIdx++) {
93
- const share = new Uint8Array(msgLen);
94
- for (let blockIdx = 0; blockIdx < numBlocks; blockIdx++) {
95
- const blockOffset = blockIdx * b;
96
- for (let destRow = 0; destRow < b; destRow++) {
97
- for (let srcCol = 0; srcCol < k; srcCol++) {
98
- const srcRow = (destRow + shareIdx * srcCol) % p;
99
- if (srcRow < b) {
100
- share[blockOffset + destRow] ^=
101
- sourceArrays[srcCol][blockOffset + srcRow];
102
- }
211
+ _0x54afdf[_0x19875b(0x189)](_0x3b8590);
212
+ const _0x20ab8 = [];
213
+ for (let _0x403a23 = 0x0; _0x183b6b[_0x19875b(0x177)](_0x403a23, _0x32b832); _0x403a23++) {
214
+ const _0x615b5 = new Uint8Array(_0x3bf88d);
215
+ for (let _0x572675 = 0x0; _0x572675 < _0x20803a; _0x572675++) {
216
+ const _0x23fcc9 = _0x183b6b['tQeNS'](_0x572675, _0x1173b2);
217
+ for (let _0x4ec5ac = 0x0; _0x4ec5ac < _0x1173b2; _0x4ec5ac++) {
218
+ for (let _0x2c9ead = 0x0; _0x2c9ead < _0x2d4aa3; _0x2c9ead++) {
219
+ const _0x2e8605 = (_0x4ec5ac + _0x403a23 * _0x2c9ead) % _0x433fb4;
220
+ _0x183b6b['iKazs'](_0x2e8605, _0x1173b2) && (_0x615b5[_0x183b6b[_0x19875b(0x160)](_0x23fcc9, _0x4ec5ac)] ^= _0x54afdf[_0x2c9ead][_0x23fcc9 + _0x2e8605]);
103
221
  }
104
222
  }
105
223
  }
106
- shares.push(share);
224
+ _0x20ab8[_0x19875b(0x189)](_0x615b5);
107
225
  }
108
- return shares;
226
+ return _0x20ab8;
109
227
  }
110
- /**
111
- * Reconstruct the padded message from k shares via GF(2) Gaussian elimination.
112
- *
113
- * @param shares - Array of k share byte arrays
114
- * @param indices - Original indices (0-based) of the provided shares
115
- * @param n - Total number of shares that were produced
116
- * @param k - Threshold used during splitting
117
- * @returns Reconstructed padded message
118
- */
119
- export function reconstructXorIDA(shares, indices, n, k) {
120
- if (shares.length !== k || indices.length !== k) {
121
- throw new Error(`Expected ${k} shares, got ${shares.length}`);
122
- }
123
- const p = nextOddPrime(n);
124
- const b = p - 1;
125
- const shareLen = shares[0].length;
126
- const numBlocks = shareLen / b;
127
- // Step 1: Build restricted generator matrix G (k*b rows × k*b cols)
128
- const numRows = k * b;
129
- const numCols = k * b;
130
- const recoveryMatrix = buildAndSolve(indices, k, p, b, numRows, numCols);
131
- // Step 2: Apply recovery matrix to extract message bytes
132
- const result = new Uint8Array(shareLen);
133
- for (let blockIdx = 0; blockIdx < numBlocks; blockIdx++) {
134
- const blockOffset = blockIdx * b;
135
- for (let destByte = 0; destByte < b; destByte++) {
136
- // Skip random rows, use message rows: row index = (k-1)*b + destByte
137
- const recoveryRow = (k - 1) * b + destByte;
138
- let val = 0;
139
- for (let c = 0; c < numRows; c++) {
140
- if (recoveryMatrix[recoveryRow][c]) {
141
- const localShareIdx = Math.floor(c / b);
142
- const byteInBlock = c % b;
143
- val ^= shares[localShareIdx][blockOffset + byteInBlock];
228
+ export function reconstructXorIDA(_0x5b5e13, _0x5e338e, _0x1f9ac0, _0x21e414) {
229
+ const a21_0x3f02d7 = {
230
+ _0x2d52f5: 0x166,
231
+ _0x12c7f4: 0x162,
232
+ _0x1b4908: 0x166,
233
+ _0x4d1f28: 0x173,
234
+ _0x51074f: 0x163,
235
+ _0x2f5d8d: 0x161
236
+ }, _0x5af718 = a21_0x5607, _0x2883e4 = {
237
+ 'hvKqn': function (_0x4f9429, _0xa6f610) {
238
+ return _0x4f9429 !== _0xa6f610;
239
+ },
240
+ 'xkJYU': function (_0xd531fc, _0x1ce5cd) {
241
+ return _0xd531fc * _0x1ce5cd;
242
+ },
243
+ 'EYRBA': function (_0x2154b0, _0x1c63bc) {
244
+ return _0x2154b0 < _0x1c63bc;
245
+ },
246
+ 'hcLNP': function (_0x4b1ad7, _0x5ac968) {
247
+ return _0x4b1ad7 * _0x5ac968;
248
+ },
249
+ 'ANNGW': function (_0x2c385d, _0x268b54) {
250
+ return _0x2c385d < _0x268b54;
251
+ },
252
+ 'iVnEC': function (_0x5b2737, _0x50b364) {
253
+ return _0x5b2737 * _0x50b364;
254
+ },
255
+ 'MZNPv': function (_0x204abe, _0x32a361) {
256
+ return _0x204abe / _0x32a361;
257
+ },
258
+ 'TTNHT': function (_0x3dbf20, _0x3b7a7c) {
259
+ return _0x3dbf20 % _0x3b7a7c;
260
+ },
261
+ 'uuKye': function (_0x79e3f5, _0x2deaa1) {
262
+ return _0x79e3f5 + _0x2deaa1;
263
+ }
264
+ };
265
+ if (_0x5b5e13[_0x5af718(0x166)] !== _0x21e414 || _0x2883e4['hvKqn'](_0x5e338e[_0x5af718(a21_0x3f02d7._0x2d52f5)], _0x21e414))
266
+ throw new Error(_0x5af718(0x185) + _0x21e414 + _0x5af718(a21_0x3f02d7._0x12c7f4) + _0x5b5e13[_0x5af718(0x166)]);
267
+ const _0x440305 = nextOddPrime(_0x1f9ac0), _0x3ade3d = _0x440305 - 0x1, _0x5aef89 = _0x5b5e13[0x0][_0x5af718(a21_0x3f02d7._0x1b4908)], _0x4059a0 = _0x5aef89 / _0x3ade3d, _0x240633 = _0x21e414 * _0x3ade3d, _0x398d93 = _0x2883e4[_0x5af718(0x182)](_0x21e414, _0x3ade3d), _0x1a048c = buildAndSolve(_0x5e338e, _0x21e414, _0x440305, _0x3ade3d, _0x240633, _0x398d93), _0x429dae = new Uint8Array(_0x5aef89);
268
+ for (let _0x362dc0 = 0x0; _0x2883e4['EYRBA'](_0x362dc0, _0x4059a0); _0x362dc0++) {
269
+ const _0x2bf841 = _0x2883e4['hcLNP'](_0x362dc0, _0x3ade3d);
270
+ for (let _0x39dd4a = 0x0; _0x2883e4[_0x5af718(0x16b)](_0x39dd4a, _0x3ade3d); _0x39dd4a++) {
271
+ const _0xd4fb6d = _0x2883e4['iVnEC'](_0x21e414 - 0x1, _0x3ade3d) + _0x39dd4a;
272
+ let _0x2f2e7a = 0x0;
273
+ for (let _0x16bf3e = 0x0; _0x16bf3e < _0x240633; _0x16bf3e++) {
274
+ if (_0x1a048c[_0xd4fb6d][_0x16bf3e]) {
275
+ const _0x4b5e00 = Math[_0x5af718(a21_0x3f02d7._0x4d1f28)](_0x2883e4[_0x5af718(a21_0x3f02d7._0x51074f)](_0x16bf3e, _0x3ade3d)), _0x4d59e9 = _0x2883e4[_0x5af718(a21_0x3f02d7._0x2f5d8d)](_0x16bf3e, _0x3ade3d);
276
+ _0x2f2e7a ^= _0x5b5e13[_0x4b5e00][_0x2883e4['uuKye'](_0x2bf841, _0x4d59e9)];
144
277
  }
145
278
  }
146
- result[blockOffset + destByte] = val;
279
+ _0x429dae[_0x2bf841 + _0x39dd4a] = _0x2f2e7a;
147
280
  }
148
281
  }
149
- return result;
282
+ return _0x429dae;
150
283
  }
151
- /**
152
- * Build the restricted generator matrix and solve via Gaussian elimination.
153
- * Returns the recovery matrix (right portion of [G|I] after elimination).
154
- */
155
- function buildAndSolve(shareIndices, k, p, b, numRows, numCols) {
156
- // Build augmented matrix [G | I] using Uint8Array rows
157
- const totalCols = numCols + numRows;
158
- const aug = [];
159
- for (let i = 0; i < k; i++) {
160
- const shareIdx = shareIndices[i];
161
- for (let rowInShare = 0; rowInShare < b; rowInShare++) {
162
- const row = new Uint8Array(totalCols);
163
- const destRow = i * b + rowInShare;
164
- // Fill generator matrix portion
165
- for (let srcCol = 0; srcCol < k; srcCol++) {
166
- const srcRow = (rowInShare + shareIdx * srcCol) % p;
167
- if (srcRow < b) {
168
- row[srcCol * b + srcRow] = 1;
169
- }
284
+ function buildAndSolve(_0x33c3e4, _0x4ee828, _0x35326c, _0x285a9d, _0x38fbd8, _0x3c2228) {
285
+ const a21_0x4d9570 = {
286
+ _0x268c69: 0x174,
287
+ _0x18ac09: 0x15e,
288
+ _0x44cd5b: 0x168,
289
+ _0x19aae3: 0x172,
290
+ _0x14b98b: 0x169,
291
+ _0x5a1bcf: 0x169,
292
+ _0x31a0f9: 0x170
293
+ }, _0x59b016 = a21_0x5607, _0x252692 = {
294
+ 'shQGW': function (_0x3ece70, _0xfd2342) {
295
+ return _0x3ece70 + _0xfd2342;
296
+ },
297
+ 'UTLhi': function (_0x4d9fb5, _0x529e8d) {
298
+ return _0x4d9fb5 < _0x529e8d;
299
+ },
300
+ 'ImqfB': function (_0xb48655, _0x183577) {
301
+ return _0xb48655 < _0x183577;
302
+ },
303
+ 'PCDpD': function (_0x20d73f, _0x5b976c) {
304
+ return _0x20d73f * _0x5b976c;
305
+ },
306
+ 'JluRD': function (_0x3d3c4b, _0x56e2f1) {
307
+ return _0x3d3c4b < _0x56e2f1;
308
+ },
309
+ 'uxplv': function (_0x3fb002, _0x8405fc) {
310
+ return _0x3fb002 % _0x8405fc;
311
+ },
312
+ 'cXZbJ': function (_0x5a89b2, _0x503a8f) {
313
+ return _0x5a89b2 + _0x503a8f;
314
+ },
315
+ 'noRxi': function (_0x21b9ce, _0x41ffec) {
316
+ return _0x21b9ce < _0x41ffec;
317
+ },
318
+ 'yktPg': function (_0x3081cd, _0x269e98) {
319
+ return _0x3081cd !== _0x269e98;
320
+ },
321
+ 'jdSAB': function (_0x5b52b2, _0x550601, _0x583f23) {
322
+ return _0x5b52b2(_0x550601, _0x583f23);
323
+ }
324
+ }, _0xe4b707 = _0x252692['shQGW'](_0x3c2228, _0x38fbd8), _0x146241 = [];
325
+ for (let _0x24fa5b = 0x0; _0x252692[_0x59b016(0x165)](_0x24fa5b, _0x4ee828); _0x24fa5b++) {
326
+ const _0x28fb41 = _0x33c3e4[_0x24fa5b];
327
+ for (let _0x463e29 = 0x0; _0x252692[_0x59b016(0x17b)](_0x463e29, _0x285a9d); _0x463e29++) {
328
+ const _0x3b56cf = new Uint8Array(_0xe4b707), _0x840c55 = _0x252692[_0x59b016(a21_0x4d9570._0x268c69)](_0x252692['PCDpD'](_0x24fa5b, _0x285a9d), _0x463e29);
329
+ for (let _0x887b5b = 0x0; _0x252692[_0x59b016(a21_0x4d9570._0x18ac09)](_0x887b5b, _0x4ee828); _0x887b5b++) {
330
+ const _0x1e60b8 = _0x252692[_0x59b016(0x17f)](_0x252692[_0x59b016(0x172)](_0x463e29, _0x28fb41 * _0x887b5b), _0x35326c);
331
+ _0x1e60b8 < _0x285a9d && (_0x3b56cf[_0x252692['cXZbJ'](_0x252692[_0x59b016(a21_0x4d9570._0x44cd5b)](_0x887b5b, _0x285a9d), _0x1e60b8)] = 0x1);
170
332
  }
171
- // Fill identity portion
172
- row[numCols + destRow] = 1;
173
- aug.push(row);
333
+ _0x3b56cf[_0x252692[_0x59b016(a21_0x4d9570._0x19aae3)](_0x3c2228, _0x840c55)] = 0x1, _0x146241['push'](_0x3b56cf);
174
334
  }
175
335
  }
176
- // Gaussian elimination over GF(2)
177
- let pivotRow = 0;
178
- for (let col = 0; col < numCols; col++) {
179
- // Find pivot
180
- let found = -1;
181
- for (let r = pivotRow; r < numRows; r++) {
182
- if (aug[r][col]) {
183
- found = r;
336
+ let _0x5cb201 = 0x0;
337
+ for (let _0x586538 = 0x0; _0x586538 < _0x3c2228; _0x586538++) {
338
+ let _0x3df1dd = -0x1;
339
+ for (let _0x1294f7 = _0x5cb201; _0x252692['noRxi'](_0x1294f7, _0x38fbd8); _0x1294f7++) {
340
+ if (_0x146241[_0x1294f7][_0x586538]) {
341
+ _0x3df1dd = _0x1294f7;
184
342
  break;
185
343
  }
186
344
  }
187
- if (found === -1)
345
+ if (_0x3df1dd === -0x1)
188
346
  continue;
189
- // Swap
190
- if (found !== pivotRow) {
191
- const tmp = aug[found];
192
- aug[found] = aug[pivotRow];
193
- aug[pivotRow] = tmp;
347
+ if (_0x252692[_0x59b016(a21_0x4d9570._0x14b98b)](_0x3df1dd, _0x5cb201)) {
348
+ const _0x1ba5ae = _0x146241[_0x3df1dd];
349
+ _0x146241[_0x3df1dd] = _0x146241[_0x5cb201], _0x146241[_0x5cb201] = _0x1ba5ae;
194
350
  }
195
- // Eliminate
196
- for (let r = 0; r < numRows; r++) {
197
- if (r !== pivotRow && aug[r][col]) {
198
- xorRow(aug[r], aug[pivotRow]);
199
- }
351
+ for (let _0x8ce9e0 = 0x0; _0x8ce9e0 < _0x38fbd8; _0x8ce9e0++) {
352
+ _0x252692[_0x59b016(a21_0x4d9570._0x5a1bcf)](_0x8ce9e0, _0x5cb201) && _0x146241[_0x8ce9e0][_0x586538] && _0x252692[_0x59b016(0x16e)](xorRow, _0x146241[_0x8ce9e0], _0x146241[_0x5cb201]);
200
353
  }
201
- pivotRow++;
354
+ _0x5cb201++;
202
355
  }
203
- // Extract recovery matrix (right portion)
204
- const recovery = [];
205
- for (let r = 0; r < numRows; r++) {
206
- recovery.push(aug[r].slice(numCols));
356
+ const _0xb83a56 = [];
357
+ for (let _0x3ed82a = 0x0; _0x252692['noRxi'](_0x3ed82a, _0x38fbd8); _0x3ed82a++) {
358
+ _0xb83a56[_0x59b016(0x189)](_0x146241[_0x3ed82a][_0x59b016(a21_0x4d9570._0x31a0f9)](_0x3c2228));
207
359
  }
208
- return recovery;
360
+ return _0xb83a56;
209
361
  }
210
- /** XOR row b into row a (in-place). */
211
- function xorRow(a, b) {
212
- for (let i = 0; i < a.length; i++) {
213
- a[i] ^= b[i];
362
+ function xorRow(_0x35b338, _0x3adda0) {
363
+ for (let _0xc85f68 = 0x0; _0xc85f68 < _0x35b338['length']; _0xc85f68++) {
364
+ _0x35b338[_0xc85f68] ^= _0x3adda0[_0xc85f68];
214
365
  }
215
- }
366
+ }