@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,195 +1,364 @@
1
- /**
2
- * TLV (Type-Length-Value) serialization for Xail messages.
3
- *
4
- * Format: [Type: 1 byte][Length: 4 bytes uint32 BE][Value: Length bytes]
5
- *
6
- * Serialization order: MESSAGE_UUID, SENDER_ID, TIMESTAMP, CONTENT_TYPE,
7
- * MESSAGE_BODY, ATTACHMENT(s).
8
- *
9
- * HMAC key/signature and per-share metadata are NOT in the TLV payload —
10
- * they travel in the share envelope.
11
- */
12
- import { ok, err, TLV_TYPE } from"../shared/index.js";
13
- import { uuidToBytes, bytesToUuid } from './uuid.js';
14
- const TEXT_ENCODER = new TextEncoder();
15
- const TEXT_DECODER = new TextDecoder();
16
- /**
17
- * Serialize a XailMessage into a TLV byte stream.
18
- *
19
- * @param message - Message to serialize
20
- * @returns TLV-encoded byte array
21
- */
22
- export function serializeMessage(message) {
23
- const parts = [];
24
- // MESSAGE_UUID
25
- parts.push(encodeTlv(TLV_TYPE.MESSAGE_UUID, uuidToBytes(message.uuid)));
26
- // SENDER_ID
27
- parts.push(encodeTlv(TLV_TYPE.SENDER_ID, TEXT_ENCODER.encode(message.sender.name)));
28
- // SENDER_EMAIL (optional — preserves sender's email across reconstruction)
29
- const senderEmail = message.sender.channels[0]?.email;
30
- if (senderEmail) {
31
- parts.push(encodeTlv(TLV_TYPE.SENDER_EMAIL, TEXT_ENCODER.encode(senderEmail)));
32
- }
33
- // TIMESTAMP (8 bytes, uint64 big-endian)
34
- const tsBuf = new Uint8Array(8);
35
- const tsView = new DataView(tsBuf.buffer);
36
- // Split into high 32 and low 32 bits
37
- tsView.setUint32(0, Math.floor(message.timestamp / 0x100000000));
38
- tsView.setUint32(4, message.timestamp >>> 0);
39
- parts.push(encodeTlv(TLV_TYPE.TIMESTAMP, tsBuf));
40
- // CONTENT_TYPE
41
- parts.push(encodeTlv(TLV_TYPE.CONTENT_TYPE, TEXT_ENCODER.encode(message.contentType)));
42
- // MESSAGE_SUBJECT (optional)
43
- if (message.subject) {
44
- parts.push(encodeTlv(TLV_TYPE.MESSAGE_SUBJECT, TEXT_ENCODER.encode(message.subject)));
1
+ (function (_0x281023, _0x4026b8) {
2
+ const a18_0x1b45d2 = {
3
+ _0x383e4d: 0x1fe,
4
+ _0x3f17ce: 0x206,
5
+ _0x391094: 0x21c,
6
+ _0x357dc9: 0x217,
7
+ _0x3b6675: 0x226
8
+ }, _0x1e7663 = a18_0x5a3b, _0xe88f1f = _0x281023();
9
+ while (!![]) {
10
+ try {
11
+ const _0x8bd176 = -parseInt(_0x1e7663(a18_0x1b45d2._0x383e4d)) / 0x1 * (parseInt(_0x1e7663(a18_0x1b45d2._0x3f17ce)) / 0x2) + parseInt(_0x1e7663(0x201)) / 0x3 + parseInt(_0x1e7663(a18_0x1b45d2._0x391094)) / 0x4 * (-parseInt(_0x1e7663(0x216)) / 0x5) + parseInt(_0x1e7663(a18_0x1b45d2._0x357dc9)) / 0x6 + -parseInt(_0x1e7663(0x210)) / 0x7 + -parseInt(_0x1e7663(a18_0x1b45d2._0x3b6675)) / 0x8 + parseInt(_0x1e7663(0x219)) / 0x9;
12
+ if (_0x8bd176 === _0x4026b8)
13
+ break;
14
+ else
15
+ _0xe88f1f['push'](_0xe88f1f['shift']());
16
+ } catch (_0xa314fc) {
17
+ _0xe88f1f['push'](_0xe88f1f['shift']());
18
+ }
45
19
  }
46
- // MESSAGE_BODY
47
- parts.push(encodeTlv(TLV_TYPE.MESSAGE_BODY, TEXT_ENCODER.encode(message.body)));
48
- // ATTACHMENTs
49
- for (const att of message.attachments) {
50
- parts.push(encodeTlv(TLV_TYPE.ATTACHMENT, encodeAttachment(att)));
20
+ }(a18_0x1d1a, 0x47590));
21
+ import {
22
+ ok,
23
+ err,
24
+ TLV_TYPE
25
+ } from"../shared/index.js";
26
+ import {
27
+ uuidToBytes,
28
+ bytesToUuid
29
+ } from './uuid.js';
30
+ function a18_0x1d1a() {
31
+ const _0x400188 = [
32
+ 'C2vJDxjL',
33
+ 'mJeZnJK0uhvhwKfe',
34
+ 'vgPqAwq',
35
+ 'DhjuEva',
36
+ 'yNL0zu9MzNnLDa',
37
+ 'Dgv4Dc9ODg1S',
38
+ 'z2v0vwLUDdmY',
39
+ 'suDPuKG',
40
+ 'yM9KEq',
41
+ 'y29UDgvUDfr5Cgu',
42
+ 'qwLfzvi',
43
+ 'mtqWoduYnM5QAuTWDG',
44
+ 'BhrpAvu',
45
+ 'CLDMwfC',
46
+ 'wLDOufm',
47
+ 'vfbSAKC',
48
+ 'zMXVB3i',
49
+ 'mtiYnxLQsg5JBW',
50
+ 'ote4mty4uMf6rMLl',
51
+ 'y2HHBM5LBhm',
52
+ 'nti1nJqWnxfREuXhsa',
53
+ 'Dgv4Dc9WBgfPBG',
54
+ 'tuLtu0Lor19gsuvmra',
55
+ 'mJa2ohLZtMLbCq',
56
+ 'C1z5zNa',
57
+ 'tuvtu0fhrv9tvujkrunu',
58
+ 'u0vorevsx0Le',
59
+ 'tuvtu0fhrv9vvuLe',
60
+ 'C2vUzgvY',
61
+ 'u0vorevsx0vnquLm',
62
+ 'DgLTzxn0yw1W',
63
+ 'C2v0vwLUDdmY',
64
+ 'yKfdDNe',
65
+ 'nZKXnZeYEu5ntLfe',
66
+ 'zw1HAwW',
67
+ 'vvvjrcbTDxn0igjLide2igj5DgvZ',
68
+ 'wwPUr3a',
69
+ 'tuvtu0fhrv9ct0rz',
70
+ 'q09ovevovf9uwvbf',
71
+ 'veLnrvnuqu1q',
72
+ 'vLbRDhK',
73
+ 'zgvJB2rL',
74
+ 'BMfTzq',
75
+ 'q21qCM0',
76
+ 'BwrUDMK',
77
+ 'tezuu3O',
78
+ 'C2v0',
79
+ 'zw5JB2rL',
80
+ 'vMfMsgm',
81
+ 'su5wquXjrf9utfy',
82
+ 'C3vIAMvJDa',
83
+ 'yxr0ywnOBwvUDhm',
84
+ 's3Dgr2e',
85
+ 'Dg9tDhjPBMC',
86
+ 'DxvPza',
87
+ 'zgf0yq',
88
+ 't0HhAMG',
89
+ 'C2XPy2u',
90
+ 'Aw1HCa',
91
+ 'nfHSDfzsua',
92
+ 'BgvUz3rO',
93
+ 'ChvZAa',
94
+ 'mtiYodiWnKf0sunbBG',
95
+ 'qvruqunituvova',
96
+ 'yNvMzMvY',
97
+ 'vhj1BMnHDgvKifrmvIbOzwfKzxi'
98
+ ];
99
+ a18_0x1d1a = function () {
100
+ return _0x400188;
101
+ };
102
+ return a18_0x1d1a();
103
+ }
104
+ const TEXT_ENCODER = new TextEncoder(), TEXT_DECODER = new TextDecoder();
105
+ export function serializeMessage(_0x8bb994) {
106
+ const a18_0x450975 = {
107
+ _0x216969: 0x200,
108
+ _0x4b99c9: 0x220,
109
+ _0x443d36: 0x1f7,
110
+ _0x158439: 0x1f9,
111
+ _0x29194f: 0x221,
112
+ _0x28b11f: 0x22f,
113
+ _0x3c7a28: 0x218,
114
+ _0x4f7447: 0x227,
115
+ _0x152b09: 0x1f2,
116
+ _0x495bb2: 0x203,
117
+ _0x2c2d57: 0x215,
118
+ _0x4781c5: 0x223,
119
+ _0x48934a: 0x200,
120
+ _0x2af775: 0x22c,
121
+ _0x4efa75: 0x1f5,
122
+ _0x497c43: 0x20d,
123
+ _0x25d765: 0x202,
124
+ _0x4fcf9d: 0x1f7,
125
+ _0x1ca673: 0x1f1,
126
+ _0x22847b: 0x1ff
127
+ }, _0xe51417 = a18_0x5a3b, _0x3c38a5 = {
128
+ 'BLGjP': function (_0x32d222, _0x34dc91, _0x174b0f) {
129
+ return _0x32d222(_0x34dc91, _0x174b0f);
130
+ },
131
+ 'KwFGa': function (_0x4ad718, _0x65be05) {
132
+ return _0x4ad718(_0x65be05);
133
+ },
134
+ 'mdnvi': function (_0x225f70, _0x14d30f) {
135
+ return _0x225f70 / _0x14d30f;
136
+ }
137
+ }, _0x45f578 = [];
138
+ _0x45f578[_0xe51417(a18_0x450975._0x216969)](_0x3c38a5['BLGjP'](encodeTlv, TLV_TYPE[_0xe51417(a18_0x450975._0x4b99c9)], _0x3c38a5[_0xe51417(a18_0x450975._0x443d36)](uuidToBytes, _0x8bb994[_0xe51417(a18_0x450975._0x158439)]))), _0x45f578[_0xe51417(0x200)](encodeTlv(TLV_TYPE['SENDER_ID'], TEXT_ENCODER[_0xe51417(0x1f2)](_0x8bb994[_0xe51417(a18_0x450975._0x29194f)][_0xe51417(a18_0x450975._0x28b11f)])));
139
+ const _0x2427d2 = _0x8bb994['sender'][_0xe51417(a18_0x450975._0x3c7a28)][0x0]?.[_0xe51417(a18_0x450975._0x4f7447)];
140
+ _0x2427d2 && _0x45f578[_0xe51417(0x200)](encodeTlv(TLV_TYPE['SENDER_EMAIL'], TEXT_ENCODER[_0xe51417(a18_0x450975._0x152b09)](_0x2427d2)));
141
+ const _0x1a998c = new Uint8Array(0x8), _0xa9f7bb = new DataView(_0x1a998c[_0xe51417(a18_0x450975._0x495bb2)]);
142
+ _0xa9f7bb[_0xe51417(0x224)](0x0, Math[_0xe51417(a18_0x450975._0x2c2d57)](_0x3c38a5[_0xe51417(0x1ef)](_0x8bb994['timestamp'], 0x100000000))), _0xa9f7bb[_0xe51417(0x224)](0x4, _0x8bb994[_0xe51417(a18_0x450975._0x4781c5)] >>> 0x0), _0x45f578[_0xe51417(a18_0x450975._0x48934a)](encodeTlv(TLV_TYPE[_0xe51417(a18_0x450975._0x2af775)], _0x1a998c)), _0x45f578[_0xe51417(0x200)](encodeTlv(TLV_TYPE[_0xe51417(0x22b)], TEXT_ENCODER[_0xe51417(0x1f2)](_0x8bb994[_0xe51417(0x20e)])));
143
+ _0x8bb994['subject'] && _0x45f578[_0xe51417(0x200)](encodeTlv(TLV_TYPE[_0xe51417(0x21e)], TEXT_ENCODER['encode'](_0x8bb994[_0xe51417(a18_0x450975._0x4efa75)])));
144
+ _0x45f578[_0xe51417(a18_0x450975._0x48934a)](encodeTlv(TLV_TYPE[_0xe51417(0x22a)], TEXT_ENCODER['encode'](_0x8bb994[_0xe51417(a18_0x450975._0x497c43)])));
145
+ for (const _0x3ff70e of _0x8bb994[_0xe51417(0x1f6)]) {
146
+ _0x45f578[_0xe51417(0x200)](encodeTlv(TLV_TYPE[_0xe51417(a18_0x450975._0x25d765)], _0x3c38a5[_0xe51417(a18_0x450975._0x4fcf9d)](encodeAttachment, _0x3ff70e)));
51
147
  }
52
- // Concatenate all parts
53
- const totalLen = parts.reduce((sum, p) => sum + p.length, 0);
54
- const result = new Uint8Array(totalLen);
55
- let offset = 0;
56
- for (const part of parts) {
57
- result.set(part, offset);
58
- offset += part.length;
148
+ const _0x87c80 = _0x45f578['reduce']((_0x48b58c, _0x272b50) => _0x48b58c + _0x272b50[_0xe51417(0x1ff)], 0x0), _0x1f913c = new Uint8Array(_0x87c80);
149
+ let _0x206bc7 = 0x0;
150
+ for (const _0x2c1f04 of _0x45f578) {
151
+ _0x1f913c[_0xe51417(a18_0x450975._0x1ca673)](_0x2c1f04, _0x206bc7), _0x206bc7 += _0x2c1f04[_0xe51417(a18_0x450975._0x22847b)];
59
152
  }
60
- return result;
153
+ return _0x1f913c;
61
154
  }
62
- /**
63
- * Deserialize a TLV byte stream into a XailMessage.
64
- *
65
- * @param data - TLV-encoded byte array
66
- * @returns Deserialized message, or SerializationError if invalid
67
- */
68
- export function deserializeMessage(data) {
69
- let uuid = '';
70
- let senderName = '';
71
- let senderEmail = '';
72
- let subject = '';
73
- let timestamp = 0;
74
- let contentType = 'text/plain';
75
- let body = '';
76
- const attachments = [];
77
- let offset = 0;
78
- while (offset < data.length) {
79
- if (offset + 5 > data.length) {
80
- return err({ code: 'INVALID_TLV', message: 'Truncated TLV header' });
81
- }
82
- const type = data[offset];
83
- const view = new DataView(data.buffer, data.byteOffset + offset + 1, 4);
84
- const length = view.getUint32(0);
85
- offset += 5;
86
- if (offset + length > data.length) {
87
- return err({ code: 'BUFFER_OVERFLOW', message: `TLV value exceeds data length at type 0x${type.toString(16)}` });
88
- }
89
- const value = data.slice(offset, offset + length);
90
- offset += length;
91
- switch (type) {
92
- case TLV_TYPE.MESSAGE_UUID:
93
- if (value.length !== 16) {
94
- return err({ code: 'INVALID_TLV', message: 'UUID must be 16 bytes' });
95
- }
96
- uuid = bytesToUuid(value);
97
- break;
98
- case TLV_TYPE.SENDER_ID:
99
- senderName = TEXT_DECODER.decode(value);
100
- break;
101
- case TLV_TYPE.SENDER_EMAIL:
102
- senderEmail = TEXT_DECODER.decode(value);
103
- break;
104
- case TLV_TYPE.TIMESTAMP: {
105
- if (value.length !== 8) {
106
- return err({ code: 'INVALID_TLV', message: 'Timestamp must be 8 bytes' });
107
- }
108
- const tsView = new DataView(value.buffer, value.byteOffset, 8);
109
- const hi = tsView.getUint32(0);
110
- const lo = tsView.getUint32(4);
111
- timestamp = hi * 0x100000000 + lo;
155
+ export function deserializeMessage(_0x376c61) {
156
+ const a18_0x1c0ccb = {
157
+ _0x128776: 0x204,
158
+ _0x593ba8: 0x21b,
159
+ _0x3dcfb5: 0x205,
160
+ _0x40ea2e: 0x207,
161
+ _0x3ce2ed: 0x1fb,
162
+ _0x3fbc43: 0x1f4,
163
+ _0x5492e9: 0x209,
164
+ _0xd09d93: 0x1ff,
165
+ _0xd15f26: 0x1f0,
166
+ _0x426010: 0x1ee,
167
+ _0x153652: 0x1ff,
168
+ _0x4c54db: 0x20b,
169
+ _0x425a6d: 0x211,
170
+ _0x54925e: 0x20a,
171
+ _0x20b00a: 0x21e,
172
+ _0x5cabc2: 0x20f,
173
+ _0x5d82ed: 0x20c
174
+ }, _0x115b5b = a18_0x5a3b, _0x4cf8cd = {
175
+ 'TjPid': _0x115b5b(0x21a),
176
+ 'OHGjh': function (_0x4e79a8, _0x27a8f2) {
177
+ return _0x4e79a8 < _0x27a8f2;
178
+ },
179
+ 'WtNGY': function (_0x459e95, _0x1c61b0) {
180
+ return _0x459e95 + _0x1c61b0;
181
+ },
182
+ 'bACvq': function (_0x3dea17, _0x183f21) {
183
+ return _0x3dea17(_0x183f21);
184
+ },
185
+ 'ZWhPS': _0x115b5b(a18_0x1c0ccb._0x128776),
186
+ 'TPljG': function (_0x256773, _0x2f7889) {
187
+ return _0x256773 + _0x2f7889;
188
+ },
189
+ 'VPkty': 'BUFFER_OVERFLOW',
190
+ 'rWfXW': function (_0x1ea329, _0xbd17e) {
191
+ return _0x1ea329 + _0xbd17e;
192
+ },
193
+ 'LFTSz': _0x115b5b(0x1f4),
194
+ 'EqtKr': function (_0x5984bf, _0x2208b8) {
195
+ return _0x5984bf(_0x2208b8);
196
+ },
197
+ 'CmPrm': function (_0x5ce2d5, _0x2841bb) {
198
+ return _0x5ce2d5 !== _0x2841bb;
199
+ },
200
+ 'ltOiU': function (_0x1dcafd, _0x1fcf55) {
201
+ return _0x1dcafd === _0x1fcf55;
202
+ },
203
+ 'YjnGp': function (_0xf0f8cc, _0x4502ba) {
204
+ return _0xf0f8cc === _0x4502ba;
205
+ },
206
+ 'sVyfp': _0x115b5b(a18_0x1c0ccb._0x593ba8),
207
+ 'AiEeR': 'Missing\x20MESSAGE_UUID',
208
+ 'trTyP': function (_0x265f01, _0x180652) {
209
+ return _0x265f01(_0x180652);
210
+ },
211
+ 'IGiRH': _0x115b5b(a18_0x1c0ccb._0x3dcfb5)
212
+ };
213
+ let _0x447210 = '', _0x46d882 = '', _0x511a4a = '', _0x31ba42 = '', _0x479650 = 0x0, _0x2f131f = _0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0x40ea2e)], _0x1745f2 = '';
214
+ const _0x1ec1e8 = [];
215
+ let _0x4cb51d = 0x0;
216
+ while (_0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0x3ce2ed)](_0x4cb51d, _0x376c61[_0x115b5b(0x1ff)])) {
217
+ if (_0x4cf8cd['WtNGY'](_0x4cb51d, 0x5) > _0x376c61[_0x115b5b(0x1ff)])
218
+ return _0x4cf8cd[_0x115b5b(0x225)](err, {
219
+ 'code': _0x115b5b(a18_0x1c0ccb._0x3fbc43),
220
+ 'message': _0x4cf8cd[_0x115b5b(0x213)]
221
+ });
222
+ const _0x3b3dc3 = _0x376c61[_0x4cb51d], _0x664c93 = new DataView(_0x376c61[_0x115b5b(0x203)], _0x376c61[_0x115b5b(a18_0x1c0ccb._0x5492e9)] + _0x4cb51d + 0x1, 0x4), _0x19b5cd = _0x664c93['getUint32'](0x0);
223
+ _0x4cb51d += 0x5;
224
+ if (_0x4cf8cd[_0x115b5b(0x214)](_0x4cb51d, _0x19b5cd) > _0x376c61['length'])
225
+ return _0x4cf8cd['bACvq'](err, {
226
+ 'code': _0x4cf8cd[_0x115b5b(0x22d)],
227
+ 'message': 'TLV\x20value\x20exceeds\x20data\x20length\x20at\x20type\x200x' + _0x3b3dc3[_0x115b5b(0x1f8)](0x10)
228
+ });
229
+ const _0x9bcb67 = _0x376c61['slice'](_0x4cb51d, _0x4cf8cd[_0x115b5b(0x212)](_0x4cb51d, _0x19b5cd));
230
+ _0x4cb51d += _0x19b5cd;
231
+ switch (_0x3b3dc3) {
232
+ case TLV_TYPE['MESSAGE_UUID']:
233
+ if (_0x9bcb67[_0x115b5b(a18_0x1c0ccb._0xd09d93)] !== 0x10)
234
+ return err({
235
+ 'code': _0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0xd15f26)],
236
+ 'message': _0x115b5b(0x228)
237
+ });
238
+ _0x447210 = _0x4cf8cd['EqtKr'](bytesToUuid, _0x9bcb67);
239
+ break;
240
+ case TLV_TYPE[_0x115b5b(0x21f)]:
241
+ _0x46d882 = TEXT_DECODER[_0x115b5b(0x22e)](_0x9bcb67);
242
+ break;
243
+ case TLV_TYPE[_0x115b5b(0x222)]:
244
+ _0x511a4a = TEXT_DECODER[_0x115b5b(0x22e)](_0x9bcb67);
245
+ break;
246
+ case TLV_TYPE[_0x115b5b(0x22c)]: {
247
+ if (_0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0x426010)](_0x9bcb67[_0x115b5b(a18_0x1c0ccb._0x153652)], 0x8))
248
+ return _0x4cf8cd[_0x115b5b(0x225)](err, {
249
+ 'code': _0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0xd15f26)],
250
+ 'message': 'Timestamp\x20must\x20be\x208\x20bytes'
251
+ });
252
+ const _0x1b1185 = new DataView(_0x9bcb67[_0x115b5b(0x203)], _0x9bcb67[_0x115b5b(0x209)], 0x8), _0x232861 = _0x1b1185[_0x115b5b(a18_0x1c0ccb._0x4c54db)](0x0), _0x3def23 = _0x1b1185['getUint32'](0x4);
253
+ _0x479650 = _0x232861 * 0x100000000 + _0x3def23;
112
254
  break;
113
255
  }
114
- case TLV_TYPE.CONTENT_TYPE: {
115
- const ct = TEXT_DECODER.decode(value);
116
- if (ct === 'text/plain' || ct === 'text/html') {
117
- contentType = ct;
118
- }
256
+ case TLV_TYPE['CONTENT_TYPE']: {
257
+ const _0x896575 = TEXT_DECODER['decode'](_0x9bcb67);
258
+ (_0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0x425a6d)](_0x896575, _0x4cf8cd['TjPid']) || _0x4cf8cd[_0x115b5b(0x229)](_0x896575, _0x115b5b(a18_0x1c0ccb._0x54925e))) && (_0x2f131f = _0x896575);
119
259
  break;
120
260
  }
121
- case TLV_TYPE.MESSAGE_SUBJECT:
122
- subject = TEXT_DECODER.decode(value);
123
- break;
124
- case TLV_TYPE.MESSAGE_BODY:
125
- body = TEXT_DECODER.decode(value);
126
- break;
127
- case TLV_TYPE.ATTACHMENT:
128
- attachments.push(decodeAttachment(value));
129
- break;
130
- default:
131
- // Unknown type — skip (forward compatibility)
132
- break;
261
+ case TLV_TYPE[_0x115b5b(a18_0x1c0ccb._0x20b00a)]:
262
+ _0x31ba42 = TEXT_DECODER[_0x115b5b(0x22e)](_0x9bcb67);
263
+ break;
264
+ case TLV_TYPE['MESSAGE_BODY']:
265
+ _0x1745f2 = TEXT_DECODER[_0x115b5b(0x22e)](_0x9bcb67);
266
+ break;
267
+ case TLV_TYPE[_0x115b5b(0x202)]:
268
+ _0x1ec1e8['push'](decodeAttachment(_0x9bcb67));
269
+ break;
270
+ default:
271
+ break;
133
272
  }
134
273
  }
135
- if (!uuid) {
136
- return err({ code: 'MISSING_FIELD', message: 'Missing MESSAGE_UUID' });
137
- }
138
- return ok({
139
- uuid,
140
- sender: {
141
- name: senderName,
142
- channels: senderEmail
143
- ? [{ provider: 'imap', email: senderEmail }]
144
- : [],
145
- securityTier: null,
146
- isEnterprise: false,
274
+ if (!_0x447210)
275
+ return err({
276
+ 'code': _0x4cf8cd[_0x115b5b(0x21d)],
277
+ 'message': _0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0x5cabc2)]
278
+ });
279
+ return _0x4cf8cd[_0x115b5b(0x208)](ok, {
280
+ 'uuid': _0x447210,
281
+ 'sender': {
282
+ 'name': _0x46d882,
283
+ 'channels': _0x511a4a ? [{
284
+ 'provider': _0x115b5b(0x1fd),
285
+ 'email': _0x511a4a
286
+ }] : [],
287
+ 'securityTier': null,
288
+ 'isEnterprise': ![]
147
289
  },
148
- recipients: [],
149
- ...(subject ? { subject } : {}),
150
- body,
151
- contentType,
152
- attachments,
153
- timestamp,
154
- messageType: 'secure',
290
+ 'recipients': [],
291
+ ..._0x31ba42 ? { 'subject': _0x31ba42 } : {},
292
+ 'body': _0x1745f2,
293
+ 'contentType': _0x2f131f,
294
+ 'attachments': _0x1ec1e8,
295
+ 'timestamp': _0x479650,
296
+ 'messageType': _0x4cf8cd[_0x115b5b(a18_0x1c0ccb._0x5d82ed)]
155
297
  });
156
298
  }
157
- /** Encode a single TLV entry. */
158
- function encodeTlv(type, value) {
159
- const entry = new Uint8Array(5 + value.length);
160
- entry[0] = type;
161
- const view = new DataView(entry.buffer, 1, 4);
162
- view.setUint32(0, value.length);
163
- entry.set(value, 5);
164
- return entry;
299
+ function encodeTlv(_0x569fa6, _0x3249d7) {
300
+ const a18_0x29ca8f = {
301
+ _0x5e603d: 0x1f3,
302
+ _0x15b008: 0x1ff,
303
+ _0x9a3d78: 0x1f1
304
+ }, _0x2a589c = a18_0x5a3b, _0x1dc6d7 = {
305
+ 'VafHc': function (_0x1bf0b3, _0x14c218) {
306
+ return _0x1bf0b3 + _0x14c218;
307
+ }
308
+ }, _0x4eab88 = new Uint8Array(_0x1dc6d7[_0x2a589c(a18_0x29ca8f._0x5e603d)](0x5, _0x3249d7[_0x2a589c(0x1ff)]));
309
+ _0x4eab88[0x0] = _0x569fa6;
310
+ const _0x2f2135 = new DataView(_0x4eab88[_0x2a589c(0x203)], 0x1, 0x4);
311
+ return _0x2f2135[_0x2a589c(0x224)](0x0, _0x3249d7[_0x2a589c(a18_0x29ca8f._0x15b008)]), _0x4eab88[_0x2a589c(a18_0x29ca8f._0x9a3d78)](_0x3249d7, 0x5), _0x4eab88;
165
312
  }
166
- /**
167
- * Encode an attachment: filename (null-terminated, up to 255 bytes) + content.
168
- */
169
- function encodeAttachment(att) {
170
- const nameBytes = TEXT_ENCODER.encode(att.filename);
171
- const mimeBytes = TEXT_ENCODER.encode(att.mimeType);
172
- // Format: [nameLen:1][name][mimeLen:1][mime][data]
173
- const result = new Uint8Array(1 + nameBytes.length + 1 + mimeBytes.length + att.data.length);
174
- let off = 0;
175
- result[off++] = nameBytes.length;
176
- result.set(nameBytes, off);
177
- off += nameBytes.length;
178
- result[off++] = mimeBytes.length;
179
- result.set(mimeBytes, off);
180
- off += mimeBytes.length;
181
- result.set(att.data, off);
182
- return result;
313
+ function a18_0x5a3b(_0x45a539, _0xfa5fbc) {
314
+ _0x45a539 = _0x45a539 - 0x1ee;
315
+ const _0x1d1a9b = a18_0x1d1a();
316
+ let _0x5a3b35 = _0x1d1a9b[_0x45a539];
317
+ if (a18_0x5a3b['VJpSAE'] === undefined) {
318
+ var _0x29050f = function (_0x380f15) {
319
+ const _0xa17451 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
320
+ let _0x5d6cc0 = '', _0x557d12 = '';
321
+ for (let _0x112a5c = 0x0, _0x362081, _0x1bed7f, _0x3ec866 = 0x0; _0x1bed7f = _0x380f15['charAt'](_0x3ec866++); ~_0x1bed7f && (_0x362081 = _0x112a5c % 0x4 ? _0x362081 * 0x40 + _0x1bed7f : _0x1bed7f, _0x112a5c++ % 0x4) ? _0x5d6cc0 += String['fromCharCode'](0xff & _0x362081 >> (-0x2 * _0x112a5c & 0x6)) : 0x0) {
322
+ _0x1bed7f = _0xa17451['indexOf'](_0x1bed7f);
323
+ }
324
+ for (let _0x42d887 = 0x0, _0x1ed803 = _0x5d6cc0['length']; _0x42d887 < _0x1ed803; _0x42d887++) {
325
+ _0x557d12 += '%' + ('00' + _0x5d6cc0['charCodeAt'](_0x42d887)['toString'](0x10))['slice'](-0x2);
326
+ }
327
+ return decodeURIComponent(_0x557d12);
328
+ };
329
+ a18_0x5a3b['ooBjdv'] = _0x29050f, a18_0x5a3b['MQQhnc'] = {}, a18_0x5a3b['VJpSAE'] = !![];
330
+ }
331
+ const _0x1a09cc = _0x1d1a9b[0x0], _0x208471 = _0x45a539 + _0x1a09cc, _0x2e6f85 = a18_0x5a3b['MQQhnc'][_0x208471];
332
+ return !_0x2e6f85 ? (_0x5a3b35 = a18_0x5a3b['ooBjdv'](_0x5a3b35), a18_0x5a3b['MQQhnc'][_0x208471] = _0x5a3b35) : _0x5a3b35 = _0x2e6f85, _0x5a3b35;
183
333
  }
184
- /** Decode an attachment from the encoded format. */
185
- function decodeAttachment(data) {
186
- let off = 0;
187
- const nameLen = data[off++];
188
- const filename = TEXT_DECODER.decode(data.slice(off, off + nameLen));
189
- off += nameLen;
190
- const mimeLen = data[off++];
191
- const mimeType = TEXT_DECODER.decode(data.slice(off, off + mimeLen));
192
- off += mimeLen;
193
- const content = data.slice(off);
194
- return { filename, mimeType, data: content };
334
+ function encodeAttachment(_0x836e24) {
335
+ const a18_0x240d25 = {
336
+ _0x48f86c: 0x1ff,
337
+ _0x3cb6eb: 0x1f1,
338
+ _0x117e26: 0x1fa
339
+ }, _0x4f76b2 = a18_0x5a3b, _0x137fcb = {
340
+ 'AgAiv': function (_0x18041c, _0x124f04) {
341
+ return _0x18041c + _0x124f04;
342
+ }
343
+ }, _0x4becfd = TEXT_ENCODER[_0x4f76b2(0x1f2)](_0x836e24['filename']), _0x3cadd5 = TEXT_ENCODER['encode'](_0x836e24['mimeType']), _0x1012cc = new Uint8Array(_0x137fcb['AgAiv'](_0x137fcb['AgAiv'](0x1 + _0x4becfd[_0x4f76b2(0x1ff)], 0x1), _0x3cadd5['length']) + _0x836e24[_0x4f76b2(0x1fa)]['length']);
344
+ let _0x201391 = 0x0;
345
+ return _0x1012cc[_0x201391++] = _0x4becfd[_0x4f76b2(a18_0x240d25._0x48f86c)], _0x1012cc['set'](_0x4becfd, _0x201391), _0x201391 += _0x4becfd[_0x4f76b2(0x1ff)], _0x1012cc[_0x201391++] = _0x3cadd5[_0x4f76b2(0x1ff)], _0x1012cc[_0x4f76b2(0x1f1)](_0x3cadd5, _0x201391), _0x201391 += _0x3cadd5[_0x4f76b2(0x1ff)], _0x1012cc[_0x4f76b2(a18_0x240d25._0x3cb6eb)](_0x836e24[_0x4f76b2(a18_0x240d25._0x117e26)], _0x201391), _0x1012cc;
195
346
  }
347
+ function decodeAttachment(_0x2ae091) {
348
+ const a18_0x5dab09 = {
349
+ _0x1bfc63: 0x22e,
350
+ _0x4289e5: 0x1fc,
351
+ _0x5e982b: 0x1fc
352
+ }, _0x55a642 = a18_0x5a3b;
353
+ let _0x52c9e6 = 0x0;
354
+ const _0x1a0f4b = _0x2ae091[_0x52c9e6++], _0x4e62b3 = TEXT_DECODER[_0x55a642(0x22e)](_0x2ae091[_0x55a642(0x1fc)](_0x52c9e6, _0x52c9e6 + _0x1a0f4b));
355
+ _0x52c9e6 += _0x1a0f4b;
356
+ const _0x5f2fb2 = _0x2ae091[_0x52c9e6++], _0x4c970a = TEXT_DECODER[_0x55a642(a18_0x5dab09._0x1bfc63)](_0x2ae091[_0x55a642(a18_0x5dab09._0x4289e5)](_0x52c9e6, _0x52c9e6 + _0x5f2fb2));
357
+ _0x52c9e6 += _0x5f2fb2;
358
+ const _0x451963 = _0x2ae091[_0x55a642(a18_0x5dab09._0x5e982b)](_0x52c9e6);
359
+ return {
360
+ 'filename': _0x4e62b3,
361
+ 'mimeType': _0x4c970a,
362
+ 'data': _0x451963
363
+ };
364
+ }