@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,109 +1,199 @@
1
- /**
2
- * @module errors
3
- * Named error class hierarchy for @private.me/crypto.
4
- *
5
- * Provides structured error types for XorIDA threshold sharing,
6
- * HMAC integrity verification, PKCS#7 padding, and TLV serialization.
7
- */
8
- const DOC_BASE = 'https://private.me/docs/packages/crypto';
9
- /** Base error class for all crypto operations. */
1
+ const a12_0x39904e = a12_0x1a13;
2
+ (function (_0x310496, _0x3a68c1) {
3
+ const a12_0x41e666 = {
4
+ _0x1de7a9: 0x123,
5
+ _0x3bd48a: 0x129,
6
+ _0x14cf25: 0x13f,
7
+ _0x2d1da8: 0x133
8
+ }, _0x1b258c = a12_0x1a13, _0x3253f1 = _0x310496();
9
+ while (!![]) {
10
+ try {
11
+ const _0x3c19aa = parseInt(_0x1b258c(a12_0x41e666._0x1de7a9)) / 0x1 * (parseInt(_0x1b258c(a12_0x41e666._0x3bd48a)) / 0x2) + -parseInt(_0x1b258c(a12_0x41e666._0x14cf25)) / 0x3 + parseInt(_0x1b258c(0x137)) / 0x4 + -parseInt(_0x1b258c(0x128)) / 0x5 + parseInt(_0x1b258c(0x124)) / 0x6 + -parseInt(_0x1b258c(0x13a)) / 0x7 * (-parseInt(_0x1b258c(0x140)) / 0x8) + -parseInt(_0x1b258c(a12_0x41e666._0x2d1da8)) / 0x9;
12
+ if (_0x3c19aa === _0x3a68c1)
13
+ break;
14
+ else
15
+ _0x3253f1['push'](_0x3253f1['shift']());
16
+ } catch (_0x588b3a) {
17
+ _0x3253f1['push'](_0x3253f1['shift']());
18
+ }
19
+ }
20
+ }(a12_0x5190, 0x37b78));
21
+ const DOC_BASE = a12_0x39904e(0x132);
10
22
  export class CryptoError extends Error {
11
- code;
12
- subCode;
13
- docUrl;
14
- constructor(code, message, docUrl) {
15
- super(message);
16
- this.name = 'CryptoError';
17
- const parts = code.split(':');
18
- this.code = parts[0] ?? code;
19
- this.subCode = parts.length > 1 ? parts.slice(1).join(':') : undefined;
20
- this.docUrl = docUrl;
23
+ [a12_0x39904e(0x13c)];
24
+ [a12_0x39904e(0x14c)];
25
+ [a12_0x39904e(0x141)];
26
+ constructor(_0x124995, _0x586476, _0x292f4d) {
27
+ const a12_0x2e48ae = {
28
+ _0x166a51: 0x146,
29
+ _0x21f589: 0x122,
30
+ _0x147cfe: 0x141
31
+ }, _0x5639d0 = a12_0x1a13, _0x573c24 = { 'PRqpB': _0x5639d0(a12_0x2e48ae._0x166a51) };
32
+ super(_0x586476), this['name'] = _0x573c24['PRqpB'];
33
+ const _0x2f9d6a = _0x124995['split'](':');
34
+ this[_0x5639d0(0x13c)] = _0x2f9d6a[0x0] ?? _0x124995, this[_0x5639d0(0x14c)] = _0x2f9d6a[_0x5639d0(0x12f)] > 0x1 ? _0x2f9d6a[_0x5639d0(a12_0x2e48ae._0x21f589)](0x1)['join'](':') : undefined, this[_0x5639d0(a12_0x2e48ae._0x147cfe)] = _0x292f4d;
21
35
  }
22
36
  }
23
- /** Error thrown during XorIDA split or reconstruction operations. */
24
37
  export class CryptoSplitError extends CryptoError {
25
- constructor(code, message) {
26
- super(code, message, `${DOC_BASE}#splitting`);
27
- this.name = 'CryptoSplitError';
38
+ constructor(_0x1b8b8f, _0x349144) {
39
+ const a12_0xb7a456 = { _0x3fec08: 0x147 }, _0x1a10b6 = a12_0x1a13, _0x540312 = { 'AXKqr': _0x1a10b6(0x12d) };
40
+ super(_0x1b8b8f, _0x349144, DOC_BASE + '#splitting'), this['name'] = _0x540312[_0x1a10b6(a12_0xb7a456._0x3fec08)];
28
41
  }
29
42
  }
30
- /** Error thrown when HMAC integrity verification fails. */
43
+ function a12_0x5190() {
44
+ const _0x1017e0 = [
45
+ 'uMvXDwLYzwqGveXwigzPzwXKigLZig1PC3nPBMCGzNjVBsbZzxjPywXPEMvKigrHDge',
46
+ 'u1bmsvrFrKfjteve',
47
+ 'qxfJt2i',
48
+ 'C2XPy2u',
49
+ 'ntG5ogzpqKzvwq',
50
+ 'mJe3mdyWofjMCuX1rG',
51
+ 'wuTmvKK',
52
+ 'BMfTzq',
53
+ 'q3j5ChrVugfKzgLUz0vYCM9Y',
54
+ 'mZC3nteWuMj6rKjx',
55
+ 'ntHwANrhr2y',
56
+ 'u2HHCMvZigHHDMuGAw5JB25ZAxn0zw50igXLBMD0AhmSigr1CgXPy2f0zsbPBMrPy2vZlcbVCIbTAxnTyxrJAgvKihbHCMfTzxrLCNmU',
57
+ 'ueTduYm3ihbHzgrPBMCGAxmGAw52ywXPzcbVCIbJB3jYDxb0zwq',
58
+ 'uNnMre8',
59
+ 'q3j5ChrVu3bSAxrfCNjVCG',
60
+ 'wg9YsurbihjLy29UC3rYDwn0Aw9UigzHAwXLza',
61
+ 'BgvUz3rO',
62
+ 'BwvZC2fNzq',
63
+ 'u3bSAxqGy29UzMLNDxjHDgLVBIbPCYbPBNzHBgLKicHUidWGmIWGAYa8idiSig9YigSGpIbUkq',
64
+ 'Ahr0Chm6lY9WCML2yxrLlM1Ll2rVy3mVCgfJA2fNzxmVy3j5ChrV',
65
+ 'ndCZmdGWnvPxuxr1Ca',
66
+ 'qsbZAgfYzsbPBMrLEcbPCYbVDxqGB2yGCMfUz2uGkg11C3qGyMuGmcb0BYbUltePlG',
67
+ 'rMv3zxiGC2HHCMvZihbYB3zPzgvKihrOyw4GDgHLihjLCxvPCMvKihrOCMvZAg9SzcbRlG',
68
+ 'wg9YsurbihnWBgL0ig9WzxjHDgLVBIbMywLSzwqGzhvLihrVigLUDMfSAwqGAw5WDxqGB3iGy29UzMLNDxjHDgLVBI4',
69
+ 'otiYmJa0zfHtCKvr',
70
+ 'u3rHBMrHBg9UzsbitufdihzLCMLMAwnHDgLVBIbMywLSzwqUierHDgeGB3iGA2v5igLZigLUy29YCMvJDc4',
71
+ 'se1bqYbPBNrLz3jPDhKGDMvYAwzPy2f0Aw9UigzHAwXLzcaTlsbKyxrHig1HEsbIzsbJB3jYDxb0zwq',
72
+ 'n1nqr1LvDa',
73
+ 'wg9YsurbihjLy29UC3rYDwn0Aw9UigzHAwXLzc4Gq2HLy2SGC2HHCMuGAw50zwDYAxr5igfUzcbWyxjHBwv0zxjZlG',
74
+ 'y29Kzq',
75
+ 'veXwigXLBMD0AcbMAwvSzcbLEgnLzwrZigf2ywLSywjSzsbKyxrHlG',
76
+ 'uuXWqw0',
77
+ 'mZaYmJeXzez2wfzQ',
78
+ 'mtmZmZKXmNbtANH4uW',
79
+ 'zg9JvxjS',
80
+ 'se1bqY1tseeYntyGDMvYAwzPy2f0Aw9UigzHAwXLzcbKDxjPBMCGCMvJB25ZDhj1y3rPB24Uie9UzsbVCIbTB3jLihnOyxjLCYbOyxzLigjLzw4GDgfTCgvYzwqGD2L0Ac4',
81
+ 'qw4GDw5YzwnVz25PEMvKifrmvIb0ExbLihrHzYb3yxmGzw5JB3vUDgvYzwqGAw4GysbYzxf1AxjLzcbWB3nPDgLVBI4',
82
+ 'veXwigrHDgeGAxmGBwfSzM9YBwvKig9YihrYDw5JyxrLzc4',
83
+ 'rw52zwXVCguGvvvjrcbKB2vZig5VDcbTyxrJAcbutfyGCgf5Bg9HzcbvvuLe',
84
+ 'q3j5ChrVrxjYB3i',
85
+ 'qvHlCxi',
86
+ 'veXwigj1zMzLCIbPCYbTywXMB3jTzwqGB3iGDhj1BMnHDgvK',
87
+ 'u2HHCMuGAw5KzxGGAxmGB3v0ig9MihjHBMDLig9Yigr1CgXPy2f0zwq',
88
+ 'wg9YsurbihnWBgL0ig9WzxjHDgLVBIbMywLSzwq',
89
+ 'q3j5ChrVsw50zwDYAxr5rxjYB3i',
90
+ 'C3vIq29Kzq',
91
+ 'u2HHCMvZigHHDMuGAw5JB25ZAxn0zw50ifvvsuqSig4Sig9YigSGDMfSDwvZ',
92
+ 'i3nLCMLHBgL6yxrPB24',
93
+ 'ueTduYm3ihbHzgrPBMCGyNL0zxmGyxjLigLUDMfSAwqGB3iGAw5JB25ZAxn0zw50lIbeyxrHig1HEsbIzsbJB3jYDxb0zwqU',
94
+ 'i2LUDgvNCML0Eq',
95
+ 'u3bSAxqGy29UzMLNDxjHDgLVBIbPCYbPBNzHBgLKlIbszxf1AxjLCYbUid49idiSigSGpJ0GmIWGyw5KigSGpd0GBI4'
96
+ ];
97
+ a12_0x5190 = function () {
98
+ return _0x1017e0;
99
+ };
100
+ return a12_0x5190();
101
+ }
31
102
  export class CryptoIntegrityError extends CryptoError {
32
- constructor(code, message) {
33
- super(code, message, `${DOC_BASE}#integrity`);
34
- this.name = 'CryptoIntegrityError';
103
+ constructor(_0x119116, _0xfbe164) {
104
+ const a12_0x42fa57 = { _0x525713: 0x150 }, _0x12acc4 = a12_0x1a13;
105
+ super(_0x119116, _0xfbe164, DOC_BASE + _0x12acc4(a12_0x42fa57._0x525713)), this['name'] = _0x12acc4(0x14b);
106
+ }
107
+ }
108
+ function a12_0x1a13(_0x8935a, _0x706d44) {
109
+ _0x8935a = _0x8935a - 0x122;
110
+ const _0x5190a0 = a12_0x5190();
111
+ let _0x1a139b = _0x5190a0[_0x8935a];
112
+ if (a12_0x1a13['JvTkTY'] === undefined) {
113
+ var _0xa89c93 = function (_0x4e2556) {
114
+ const _0x22770d = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
115
+ let _0x1e2638 = '', _0x20964a = '';
116
+ for (let _0x1bd67a = 0x0, _0x508bf5, _0x2e48de, _0x45ad41 = 0x0; _0x2e48de = _0x4e2556['charAt'](_0x45ad41++); ~_0x2e48de && (_0x508bf5 = _0x1bd67a % 0x4 ? _0x508bf5 * 0x40 + _0x2e48de : _0x2e48de, _0x1bd67a++ % 0x4) ? _0x1e2638 += String['fromCharCode'](0xff & _0x508bf5 >> (-0x2 * _0x1bd67a & 0x6)) : 0x0) {
117
+ _0x2e48de = _0x22770d['indexOf'](_0x2e48de);
118
+ }
119
+ for (let _0x515b4f = 0x0, _0x4a029a = _0x1e2638['length']; _0x515b4f < _0x4a029a; _0x515b4f++) {
120
+ _0x20964a += '%' + ('00' + _0x1e2638['charCodeAt'](_0x515b4f)['toString'](0x10))['slice'](-0x2);
121
+ }
122
+ return decodeURIComponent(_0x20964a);
123
+ };
124
+ a12_0x1a13['GjGoOk'] = _0xa89c93, a12_0x1a13['msQRCP'] = {}, a12_0x1a13['JvTkTY'] = !![];
35
125
  }
126
+ const _0x54503d = _0x5190a0[0x0], _0x44ccaa = _0x8935a + _0x54503d, _0x1d81de = a12_0x1a13['msQRCP'][_0x44ccaa];
127
+ return !_0x1d81de ? (_0x1a139b = a12_0x1a13['GjGoOk'](_0x1a139b), a12_0x1a13['msQRCP'][_0x44ccaa] = _0x1a139b) : _0x1a139b = _0x1d81de, _0x1a139b;
36
128
  }
37
- /** Error thrown for PKCS#7 padding issues. */
38
129
  export class CryptoPaddingError extends CryptoError {
39
- constructor(code, message) {
40
- super(code, message, `${DOC_BASE}#padding`);
41
- this.name = 'CryptoPaddingError';
130
+ constructor(_0x2a64bb, _0x234fea) {
131
+ const _0x239fc7 = a12_0x1a13;
132
+ super(_0x2a64bb, _0x234fea, DOC_BASE + '#padding'), this['name'] = _0x239fc7(0x127);
42
133
  }
43
134
  }
44
- /** Error thrown during TLV serialization or deserialization. */
45
135
  export class CryptoSerializationError extends CryptoError {
46
- constructor(code, message) {
47
- super(code, message, `${DOC_BASE}#serialization`);
48
- this.name = 'CryptoSerializationError';
136
+ constructor(_0x5f2fcc, _0x459957) {
137
+ const _0x3bc81a = a12_0x1a13, _0x4a10b9 = { 'AqcOb': 'CryptoSerializationError' };
138
+ super(_0x5f2fcc, _0x459957, DOC_BASE + _0x3bc81a(0x14e)), this[_0x3bc81a(0x126)] = _0x4a10b9[_0x3bc81a(0x154)];
49
139
  }
50
140
  }
51
- /** Human-readable messages for each error code. */
52
141
  export const ERROR_MESSAGES = {
53
- SPLIT_FAILED: 'XorIDA split operation failed',
54
- RECONSTRUCTION_FAILED: 'XorIDA reconstruction failed',
55
- INSUFFICIENT_SHARES: 'Not enough shares provided for reconstruction',
56
- INVALID_SHARES: 'Shares have inconsistent UUID, n, or k values',
57
- INVALID_INDEX: 'Share index is out of range or duplicated',
58
- HMAC_FAILURE: 'HMAC integrity verification failed -- data may be corrupted',
59
- UUID_MISMATCH: 'Envelope UUID does not match TLV payload UUID',
60
- INVALID_PADDING: 'PKCS#7 padding is invalid or corrupted',
61
- INVALID_TLV: 'TLV buffer is malformed or truncated',
62
- BUFFER_OVERFLOW: 'TLV value length exceeds buffer bounds',
63
- MISSING_FIELD: 'Required TLV field is missing from serialized data',
64
- INVALID_CONFIG: 'Split configuration is invalid (n < 2, k < 2, or k > n)',
142
+ 'SPLIT_FAILED': a12_0x39904e(0x14a),
143
+ 'RECONSTRUCTION_FAILED': a12_0x39904e(0x12e),
144
+ 'INSUFFICIENT_SHARES': 'Not\x20enough\x20shares\x20provided\x20for\x20reconstruction',
145
+ 'INVALID_SHARES': a12_0x39904e(0x14d),
146
+ 'INVALID_INDEX': a12_0x39904e(0x149),
147
+ 'HMAC_FAILURE': a12_0x39904e(0x139),
148
+ 'UUID_MISMATCH': a12_0x39904e(0x145),
149
+ 'INVALID_PADDING': a12_0x39904e(0x12b),
150
+ 'INVALID_TLV': a12_0x39904e(0x148),
151
+ 'BUFFER_OVERFLOW': 'TLV\x20value\x20length\x20exceeds\x20buffer\x20bounds',
152
+ 'MISSING_FIELD': a12_0x39904e(0x152),
153
+ 'INVALID_CONFIG': a12_0x39904e(0x131)
65
154
  };
66
- /**
67
- * Detailed descriptions for each error code.
68
- * Maps error codes to comprehensive explanations including cause and resolution.
69
- */
70
155
  export const ERROR_DETAILS = {
71
- INVALID_PADDING: 'PKCS#7 padding bytes are invalid or inconsistent. Data may be corrupted.',
72
- HMAC_FAILURE: 'HMAC-SHA256 verification failed during reconstruction. One or more shares have been tampered with.',
73
- INVALID_SHARES: 'Shares have inconsistent lengths, duplicate indices, or mismatched parameters.',
74
- INSUFFICIENT_SHARES: 'Fewer shares provided than the required threshold k.',
75
- INVALID_INDEX: 'A share index is out of range (must be 0 to n-1).',
76
- UUID_MISMATCH: 'Shares reference different message UUIDs and cannot be combined.',
77
- INVALID_TLV: 'TLV data is malformed or truncated.',
78
- BUFFER_OVERFLOW: 'TLV length field exceeds available data.',
79
- MISSING_FIELD: 'A required TLV field (e.g., MESSAGE_UUID) is absent.',
80
- INVALID_TYPE: 'An unrecognized TLV type tag was encountered in a required position.',
81
- HMAC_MISMATCH: 'Standalone HMAC verification failed. Data or key is incorrect.',
82
- KEY_ERROR: 'HMAC key import failed (invalid length or format).',
83
- SPLIT_FAILED: 'XorIDA split operation failed due to invalid input or configuration.',
84
- RECONSTRUCTION_FAILED: 'XorIDA reconstruction failed. Check share integrity and parameters.',
85
- INVALID_CONFIG: 'Split configuration is invalid. Requires n >= 2, k >= 2, and k <= n.',
156
+ 'INVALID_PADDING': a12_0x39904e(0x14f),
157
+ 'HMAC_FAILURE': a12_0x39904e(0x142),
158
+ 'INVALID_SHARES': a12_0x39904e(0x12a),
159
+ 'INSUFFICIENT_SHARES': a12_0x39904e(0x135),
160
+ 'INVALID_INDEX': a12_0x39904e(0x134),
161
+ 'UUID_MISMATCH': 'Shares\x20reference\x20different\x20message\x20UUIDs\x20and\x20cannot\x20be\x20combined.',
162
+ 'INVALID_TLV': a12_0x39904e(0x144),
163
+ 'BUFFER_OVERFLOW': a12_0x39904e(0x13d),
164
+ 'MISSING_FIELD': 'A\x20required\x20TLV\x20field\x20(e.g.,\x20MESSAGE_UUID)\x20is\x20absent.',
165
+ 'INVALID_TYPE': a12_0x39904e(0x143),
166
+ 'HMAC_MISMATCH': a12_0x39904e(0x138),
167
+ 'KEY_ERROR': 'HMAC\x20key\x20import\x20failed\x20(invalid\x20length\x20or\x20format).',
168
+ 'SPLIT_FAILED': a12_0x39904e(0x136),
169
+ 'RECONSTRUCTION_FAILED': a12_0x39904e(0x13b),
170
+ 'INVALID_CONFIG': a12_0x39904e(0x151)
86
171
  };
87
- /**
88
- * Convert an unknown error into a CryptoError.
89
- *
90
- * @param error - The unknown error to convert
91
- * @returns A CryptoError instance
92
- */
93
- export function toCryptoError(error) {
94
- if (error instanceof CryptoError)
95
- return error;
96
- if (error instanceof Error) {
97
- return new CryptoError('SPLIT_FAILED', error.message);
98
- }
99
- return new CryptoError('SPLIT_FAILED', String(error));
100
- }
101
- /**
102
- * Type guard to check if an error is a CryptoError.
103
- *
104
- * @param error - The value to check
105
- * @returns true if the value is a CryptoError instance
106
- */
107
- export function isCryptoError(error) {
108
- return error instanceof CryptoError;
172
+ export function toCryptoError(_0x48bae9) {
173
+ const a12_0x514996 = {
174
+ _0x5a83f0: 0x153,
175
+ _0x28313c: 0x125,
176
+ _0x565600: 0x12c
177
+ }, _0x80085f = a12_0x1a13, _0x58f86c = {
178
+ 'gWhYX': function (_0xe51e7d, _0x386518) {
179
+ return _0xe51e7d instanceof _0x386518;
180
+ },
181
+ 'YKLVI': _0x80085f(a12_0x514996._0x5a83f0),
182
+ 'RsfDO': function (_0x18621b, _0x394d0b) {
183
+ return _0x18621b(_0x394d0b);
184
+ }
185
+ };
186
+ if (_0x58f86c['gWhYX'](_0x48bae9, CryptoError))
187
+ return _0x48bae9;
188
+ if (_0x48bae9 instanceof Error)
189
+ return new CryptoError(_0x58f86c[_0x80085f(a12_0x514996._0x28313c)], _0x48bae9[_0x80085f(0x130)]);
190
+ return new CryptoError(_0x58f86c[_0x80085f(a12_0x514996._0x28313c)], _0x58f86c[_0x80085f(a12_0x514996._0x565600)](String, _0x48bae9));
109
191
  }
192
+ export function isCryptoError(_0x20097a) {
193
+ const a12_0x15c08b = { _0x3ead36: 0x13e }, _0x155703 = a12_0x1a13, _0x51915d = {
194
+ 'QLpAm': function (_0x722a19, _0x47bafe) {
195
+ return _0x722a19 instanceof _0x47bafe;
196
+ }
197
+ };
198
+ return _0x51915d[_0x155703(a12_0x15c08b._0x3ead36)](_0x20097a, CryptoError);
199
+ }
@@ -1,66 +1,134 @@
1
- /**
2
- * HMAC-SHA256 integrity verification using Web Crypto API.
3
- *
4
- * Provides message-level integrity for the XorIDA pipeline.
5
- * The HMAC is computed over the padded payload (after TLV serialization + PKCS#7 padding)
6
- * and verified after reconstruction, before unpadding.
7
- *
8
- * Uses crypto.subtle for constant-time verification (no manual byte comparison).
9
- */
10
- /** HMAC key length in bytes. */
11
- const HMAC_KEY_LENGTH = 32;
12
- /** HMAC algorithm config. */
13
- const HMAC_ALGO = { name: 'HMAC', hash: 'SHA-256' };
14
- /** Copy a Uint8Array into a fresh ArrayBuffer (avoids SharedArrayBuffer type issues). */
15
- function toArrayBuffer(data) {
16
- const buf = new ArrayBuffer(data.byteLength);
17
- new Uint8Array(buf).set(data);
18
- return buf;
1
+ function a13_0x1ca6(_0x48a37a, _0x452647) {
2
+ _0x48a37a = _0x48a37a - 0xc2;
3
+ const _0x405f92 = a13_0x405f();
4
+ let _0x1ca601 = _0x405f92[_0x48a37a];
5
+ if (a13_0x1ca6['LsRwYR'] === undefined) {
6
+ var _0x7879cd = function (_0x1bfa6d) {
7
+ const _0x5a8e80 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
8
+ let _0x11c5cf = '', _0x1e2beb = '';
9
+ for (let _0xde76e9 = 0x0, _0x5a90c9, _0x572400, _0x5745c1 = 0x0; _0x572400 = _0x1bfa6d['charAt'](_0x5745c1++); ~_0x572400 && (_0x5a90c9 = _0xde76e9 % 0x4 ? _0x5a90c9 * 0x40 + _0x572400 : _0x572400, _0xde76e9++ % 0x4) ? _0x11c5cf += String['fromCharCode'](0xff & _0x5a90c9 >> (-0x2 * _0xde76e9 & 0x6)) : 0x0) {
10
+ _0x572400 = _0x5a8e80['indexOf'](_0x572400);
11
+ }
12
+ for (let _0x3ebeb1 = 0x0, _0x38e688 = _0x11c5cf['length']; _0x3ebeb1 < _0x38e688; _0x3ebeb1++) {
13
+ _0x1e2beb += '%' + ('00' + _0x11c5cf['charCodeAt'](_0x3ebeb1)['toString'](0x10))['slice'](-0x2);
14
+ }
15
+ return decodeURIComponent(_0x1e2beb);
16
+ };
17
+ a13_0x1ca6['YhruJl'] = _0x7879cd, a13_0x1ca6['WzgAox'] = {}, a13_0x1ca6['LsRwYR'] = !![];
18
+ }
19
+ const _0x5b54de = _0x405f92[0x0], _0x31dbe6 = _0x48a37a + _0x5b54de, _0xa5ec58 = a13_0x1ca6['WzgAox'][_0x31dbe6];
20
+ return !_0xa5ec58 ? (_0x1ca601 = a13_0x1ca6['YhruJl'](_0x1ca601), a13_0x1ca6['WzgAox'][_0x31dbe6] = _0x1ca601) : _0x1ca601 = _0xa5ec58, _0x1ca601;
19
21
  }
20
- /**
21
- * Import a raw key buffer for HMAC operations.
22
- * Copies to a fresh ArrayBuffer to satisfy Web Crypto API typing.
23
- */
24
- async function importKey(keyBytes, usage) {
25
- return crypto.subtle.importKey('raw', toArrayBuffer(keyBytes), HMAC_ALGO, false, [usage]);
22
+ function a13_0x405f() {
23
+ const _0x306756 = [
24
+ 'Ce9TBNi',
25
+ 'vMfUvK0',
26
+ 'mtuXmZmZnJHoz3z5u3m',
27
+ 'Aw1WB3j0s2v5',
28
+ 'mMziBKruBq',
29
+ 'yNL0zuXLBMD0Aa',
30
+ 'n2Thu2jTEa',
31
+ 'CMf3',
32
+ 'C3vIDgXL',
33
+ 'mZG5ndG0BhzpDuDY',
34
+ 'se1bqW',
35
+ 'u0Hblti1nG',
36
+ 'mta4ovbMug9uCG',
37
+ 'DMvYAwz5',
38
+ 'z2v0uMfUzg9TvMfSDwvZ',
39
+ 'mtKXmZb5qxDlvK0',
40
+ 'u2zlBMG',
41
+ 'ntuWotyZnMnUC1Lzwq',
42
+ 'C2v0',
43
+ 'uhrctha',
44
+ 'nez6Dw9wqq',
45
+ 'mtu1sg1evxjL',
46
+ 'ody1otuWnhDMA3r0Ca',
47
+ 'C2LNBG',
48
+ 'mJqYnJe5oujmALjABq',
49
+ 'mJa0mda2Ew1Zvgjy'
50
+ ];
51
+ a13_0x405f = function () {
52
+ return _0x306756;
53
+ };
54
+ return a13_0x405f();
26
55
  }
27
- /**
28
- * Generate a fresh random HMAC key and sign data with HMAC-SHA256.
29
- *
30
- * @param data - Bytes to sign (the padded payload)
31
- * @returns Object containing the raw key bytes and the 32-byte signature
32
- */
33
- export async function generateHMAC(data) {
34
- const keyBytes = new Uint8Array(HMAC_KEY_LENGTH);
35
- crypto.getRandomValues(keyBytes);
36
- const cryptoKey = await importKey(keyBytes, 'sign');
37
- const sig = await crypto.subtle.sign('HMAC', cryptoKey, toArrayBuffer(data));
38
- return { key: keyBytes, signature: new Uint8Array(sig) };
56
+ const a13_0x2b37a8 = a13_0x1ca6;
57
+ (function (_0x257b18, _0x5450d9) {
58
+ const a13_0x186c23 = {
59
+ _0x575645: 0xda,
60
+ _0x313a56: 0xcb,
61
+ _0x2b77cf: 0xcc,
62
+ _0x42e6e9: 0xd7,
63
+ _0x556f79: 0xc3,
64
+ _0x3fc653: 0xc6,
65
+ _0x5e81b2: 0xc8
66
+ }, _0x4645c0 = a13_0x1ca6, _0x3d18d0 = _0x257b18();
67
+ while (!![]) {
68
+ try {
69
+ const _0x2bf66c = -parseInt(_0x4645c0(a13_0x186c23._0x575645)) / 0x1 * (-parseInt(_0x4645c0(0xd5)) / 0x2) + -parseInt(_0x4645c0(0xcf)) / 0x3 * (parseInt(_0x4645c0(a13_0x186c23._0x313a56)) / 0x4) + -parseInt(_0x4645c0(a13_0x186c23._0x2b77cf)) / 0x5 * (parseInt(_0x4645c0(0xd0)) / 0x6) + -parseInt(_0x4645c0(a13_0x186c23._0x42e6e9)) / 0x7 * (-parseInt(_0x4645c0(0xcd)) / 0x8) + -parseInt(_0x4645c0(a13_0x186c23._0x556f79)) / 0x9 * (-parseInt(_0x4645c0(a13_0x186c23._0x3fc653)) / 0xa) + -parseInt(_0x4645c0(a13_0x186c23._0x5e81b2)) / 0xb + parseInt(_0x4645c0(0xd3)) / 0xc;
70
+ if (_0x2bf66c === _0x5450d9)
71
+ break;
72
+ else
73
+ _0x3d18d0['push'](_0x3d18d0['shift']());
74
+ } catch (_0x171634) {
75
+ _0x3d18d0['push'](_0x3d18d0['shift']());
76
+ }
77
+ }
78
+ }(a13_0x405f, 0x92b25));
79
+ const HMAC_KEY_LENGTH = 0x20, HMAC_ALGO = {
80
+ 'name': 'HMAC',
81
+ 'hash': a13_0x2b37a8(0xc2)
82
+ };
83
+ function toArrayBuffer(_0x416c6c) {
84
+ const a13_0xca334b = { _0x2ec83d: 0xd6 }, _0x456197 = a13_0x1ca6, _0x2d2005 = new ArrayBuffer(_0x416c6c[_0x456197(a13_0xca334b._0x2ec83d)]);
85
+ return new Uint8Array(_0x2d2005)[_0x456197(0xc9)](_0x416c6c), _0x2d2005;
39
86
  }
40
- /**
41
- * Verify an HMAC-SHA256 signature using constant-time comparison.
42
- *
43
- * Uses crypto.subtle.verify() which is constant-time by specification.
44
- * NEVER manually compare HMAC bytes (timing attack risk).
45
- *
46
- * @param key - Raw HMAC key bytes (32 bytes)
47
- * @param data - Data that was signed
48
- * @param signature - Expected HMAC-SHA256 signature (32 bytes)
49
- * @returns true if signature is valid, false otherwise
50
- */
51
- export async function verifyHMAC(key, data, signature) {
52
- const cryptoKey = await importKey(key, 'verify');
53
- return crypto.subtle.verify('HMAC', cryptoKey, toArrayBuffer(signature), toArrayBuffer(data));
87
+ async function importKey(_0x15b0d4, _0x30e7d2) {
88
+ const _0x2fa2c2 = a13_0x1ca6;
89
+ return crypto[_0x2fa2c2(0xd9)][_0x2fa2c2(0xd4)](_0x2fa2c2(0xd8), toArrayBuffer(_0x15b0d4), HMAC_ALGO, ![], [_0x30e7d2]);
54
90
  }
55
- /**
56
- * Sign data with a provided HMAC key (for cases where the key is already known).
57
- *
58
- * @param key - Raw HMAC key bytes (32 bytes)
59
- * @param data - Bytes to sign
60
- * @returns 32-byte HMAC-SHA256 signature
61
- */
62
- export async function signHMAC(key, data) {
63
- const cryptoKey = await importKey(key, 'sign');
64
- const sig = await crypto.subtle.sign('HMAC', cryptoKey, toArrayBuffer(data));
65
- return new Uint8Array(sig);
91
+ export async function generateHMAC(_0x23773a) {
92
+ const a13_0x2ef102 = {
93
+ _0x5c1074: 0xc5,
94
+ _0x2bcc79: 0xce,
95
+ _0x5aa2b7: 0xdb
96
+ }, _0x40e6b9 = a13_0x1ca6, _0x58f5c8 = {
97
+ 'PtBLp': function (_0x35fea8, _0x146c53, _0x7fd38c) {
98
+ return _0x35fea8(_0x146c53, _0x7fd38c);
99
+ },
100
+ 'VanVM': _0x40e6b9(0xce)
101
+ }, _0xe8a7ee = new Uint8Array(HMAC_KEY_LENGTH);
102
+ crypto[_0x40e6b9(a13_0x2ef102._0x5c1074)](_0xe8a7ee);
103
+ const _0x1954ff = await _0x58f5c8[_0x40e6b9(0xca)](importKey, _0xe8a7ee, _0x58f5c8[_0x40e6b9(0xd2)]), _0x438061 = await crypto[_0x40e6b9(0xd9)][_0x40e6b9(a13_0x2ef102._0x2bcc79)](_0x40e6b9(a13_0x2ef102._0x5aa2b7), _0x1954ff, toArrayBuffer(_0x23773a));
104
+ return {
105
+ 'key': _0xe8a7ee,
106
+ 'signature': new Uint8Array(_0x438061)
107
+ };
66
108
  }
109
+ export async function verifyHMAC(_0x1cf411, _0x4ac8be, _0x30879b) {
110
+ const a13_0x22b7fb = {
111
+ _0x4b5755: 0xc4,
112
+ _0x25235f: 0xd9
113
+ }, _0xbd78c4 = a13_0x1ca6, _0x64865e = {
114
+ 'SfKnh': function (_0x2baf2b, _0x1130c1, _0x2d76fa) {
115
+ return _0x2baf2b(_0x1130c1, _0x2d76fa);
116
+ },
117
+ 'TiMOI': function (_0x23cd33, _0x46599c) {
118
+ return _0x23cd33(_0x46599c);
119
+ }
120
+ }, _0x38c19e = await _0x64865e[_0xbd78c4(0xc7)](importKey, _0x1cf411, _0xbd78c4(a13_0x22b7fb._0x4b5755));
121
+ return crypto[_0xbd78c4(a13_0x22b7fb._0x25235f)][_0xbd78c4(a13_0x22b7fb._0x4b5755)](_0xbd78c4(0xdb), _0x38c19e, toArrayBuffer(_0x30879b), _0x64865e['TiMOI'](toArrayBuffer, _0x4ac8be));
122
+ }
123
+ export async function signHMAC(_0x27bf8c, _0x5a0b28) {
124
+ const a13_0x47233c = { _0x37ac87: 0xce }, _0x312e22 = a13_0x1ca6, _0x565241 = {
125
+ 'DMaSm': function (_0xbdf52a, _0x254b1b, _0x22645e) {
126
+ return _0xbdf52a(_0x254b1b, _0x22645e);
127
+ },
128
+ 'ujumj': _0x312e22(0xce),
129
+ 'pOmnr': function (_0x1796e6, _0x572008) {
130
+ return _0x1796e6(_0x572008);
131
+ }
132
+ }, _0xdf5cfa = await _0x565241['DMaSm'](importKey, _0x27bf8c, _0x565241['ujumj']), _0x18ab85 = await crypto[_0x312e22(0xd9)][_0x312e22(a13_0x47233c._0x37ac87)](_0x312e22(0xdb), _0xdf5cfa, _0x565241[_0x312e22(0xd1)](toArrayBuffer, _0x5a0b28));
133
+ return new Uint8Array(_0x18ab85);
134
+ }