@private.me/xbind 1.3.0 → 2.3.4

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 (305) hide show
  1. package/LICENSES.md +212 -0
  2. package/README.md +388 -6
  3. package/dist-standalone/_deps/mldsa-wasm/dist/mldsa.js +1 -1920
  4. package/dist-standalone/_deps/shared/cjs/errors.js +1 -275
  5. package/dist-standalone/_deps/shared/cjs/index.js +1 -138
  6. package/dist-standalone/_deps/shared/cjs/types.js +1 -90
  7. package/dist-standalone/_deps/shared/errors.js +1 -262
  8. package/dist-standalone/_deps/shared/index.js +1 -77
  9. package/dist-standalone/_deps/shared/types.js +1 -91
  10. package/dist-standalone/_deps/ux-helpers/cjs/errors.js +1 -1
  11. package/dist-standalone/_deps/ux-helpers/cjs/index.js +1 -1
  12. package/dist-standalone/_deps/ux-helpers/cjs/pagination.js +1 -1
  13. package/dist-standalone/_deps/ux-helpers/cjs/progress.js +1 -1
  14. package/dist-standalone/_deps/ux-helpers/cjs/search.js +1 -1
  15. package/dist-standalone/_deps/ux-helpers/cjs/types.js +1 -1
  16. package/dist-standalone/_deps/ux-helpers/errors.js +1 -1
  17. package/dist-standalone/_deps/ux-helpers/index.js +1 -1
  18. package/dist-standalone/_deps/ux-helpers/pagination.js +1 -1
  19. package/dist-standalone/_deps/ux-helpers/progress.js +1 -1
  20. package/dist-standalone/_deps/ux-helpers/search.js +1 -1
  21. package/dist-standalone/_deps/xchange/auto-accept.js +1 -1
  22. package/dist-standalone/_deps/xchange/cjs/auto-accept.js +1 -1
  23. package/dist-standalone/_deps/xchange/cjs/errors.js +1 -1
  24. package/dist-standalone/_deps/xchange/cjs/index.js +1 -1
  25. package/dist-standalone/_deps/xchange/cjs/invite-client.js +1 -1
  26. package/dist-standalone/_deps/xchange/cjs/lazy-init.js +1 -1
  27. package/dist-standalone/_deps/xchange/cjs/trust-integration.js +1 -1
  28. package/dist-standalone/_deps/xchange/cjs/xchange.js +1 -1
  29. package/dist-standalone/_deps/xchange/errors.js +1 -1
  30. package/dist-standalone/_deps/xchange/index.js +1 -1
  31. package/dist-standalone/_deps/xchange/invite-client.js +1 -1
  32. package/dist-standalone/_deps/xchange/lazy-init.js +1 -1
  33. package/dist-standalone/_deps/xchange/trust-integration.js +1 -1
  34. package/dist-standalone/_deps/xchange/xchange.js +1 -1
  35. package/dist-standalone/_deps/xregistry/cjs/discovery.js +1 -1
  36. package/dist-standalone/_deps/xregistry/cjs/errors.js +1 -1
  37. package/dist-standalone/_deps/xregistry/cjs/index.js +1 -1
  38. package/dist-standalone/_deps/xregistry/cjs/registry.js +1 -1
  39. package/dist-standalone/_deps/xregistry/cjs/schema.js +1 -1
  40. package/dist-standalone/_deps/xregistry/cjs/types.js +1 -1
  41. package/dist-standalone/_deps/xregistry/discovery.js +1 -1
  42. package/dist-standalone/_deps/xregistry/errors.js +1 -1
  43. package/dist-standalone/_deps/xregistry/index.js +1 -1
  44. package/dist-standalone/_deps/xregistry/registry.js +1 -1
  45. package/dist-standalone/_deps/xregistry/schema.js +1 -1
  46. package/dist-standalone/_deps/xregistry/types.js +1 -1
  47. package/dist-standalone/agent-call.js +1 -642
  48. package/dist-standalone/agent-sdk.js +1 -328
  49. package/dist-standalone/agent.d.ts +95 -5
  50. package/dist-standalone/agent.js +1 -1545
  51. package/dist-standalone/approval.js +1 -193
  52. package/dist-standalone/async-iterators.d.ts +275 -0
  53. package/dist-standalone/async-iterators.js +1 -0
  54. package/dist-standalone/auth.js +1 -219
  55. package/dist-standalone/auto-accept.js +1 -229
  56. package/dist-standalone/backup-config.js +1 -201
  57. package/dist-standalone/backup.d.ts +114 -0
  58. package/dist-standalone/backup.js +1 -0
  59. package/dist-standalone/batch-operations.d.ts +297 -0
  60. package/dist-standalone/batch-operations.js +1 -0
  61. package/dist-standalone/cancellation.d.ts +301 -0
  62. package/dist-standalone/cancellation.js +1 -0
  63. package/dist-standalone/checkpoint.js +1 -186
  64. package/dist-standalone/circuit-breaker.d.ts +351 -0
  65. package/dist-standalone/circuit-breaker.js +1 -0
  66. package/dist-standalone/cjs/agent-call.js +1 -651
  67. package/dist-standalone/cjs/agent-sdk.js +1 -332
  68. package/dist-standalone/cjs/agent.js +1 -1582
  69. package/dist-standalone/cjs/approval.js +1 -199
  70. package/dist-standalone/cjs/async-iterators.js +1 -0
  71. package/dist-standalone/cjs/auth.js +1 -225
  72. package/dist-standalone/cjs/auto-accept.js +1 -233
  73. package/dist-standalone/cjs/backup-config.js +1 -207
  74. package/dist-standalone/cjs/backup.js +1 -0
  75. package/dist-standalone/cjs/batch-operations.js +1 -0
  76. package/dist-standalone/cjs/cancellation.js +1 -0
  77. package/dist-standalone/cjs/checkpoint.js +1 -193
  78. package/dist-standalone/cjs/circuit-breaker.js +1 -0
  79. package/dist-standalone/cjs/cli/init.js +1 -486
  80. package/dist-standalone/cjs/config-validation.js +1 -0
  81. package/dist-standalone/cjs/connect.js +1 -312
  82. package/dist-standalone/cjs/connection-pool.js +1 -0
  83. package/dist-standalone/cjs/correlation-id.js +1 -339
  84. package/dist-standalone/cjs/crypto-utils.js +1 -0
  85. package/dist-standalone/cjs/debug-mode.js +1 -0
  86. package/dist-standalone/cjs/did-document.js +1 -101
  87. package/dist-standalone/cjs/did-privateme.js +1 -130
  88. package/dist-standalone/cjs/did-web.js +1 -201
  89. package/dist-standalone/cjs/discovery.js +1 -462
  90. package/dist-standalone/cjs/dual-mode.js +1 -251
  91. package/dist-standalone/cjs/email-templates.js +1 -313
  92. package/dist-standalone/cjs/email-transport.js +1 -239
  93. package/dist-standalone/cjs/envelope.js +1 -510
  94. package/dist-standalone/cjs/errors.js +1 -826
  95. package/dist-standalone/cjs/event-emitter.js +1 -0
  96. package/dist-standalone/cjs/gateway-state.js +1 -55
  97. package/dist-standalone/cjs/gateway-transport.js +1 -120
  98. package/dist-standalone/cjs/graceful-degradation.js +1 -0
  99. package/dist-standalone/cjs/guardrails.js +1 -223
  100. package/dist-standalone/cjs/health-check.js +1 -0
  101. package/dist-standalone/cjs/http-compat.js +1 -272
  102. package/dist-standalone/cjs/http-status-map.js +1 -571
  103. package/dist-standalone/cjs/identity.js +1 -541
  104. package/dist-standalone/cjs/index.js +1 -237
  105. package/dist-standalone/cjs/invitation.js +1 -421
  106. package/dist-standalone/cjs/invite.js +1 -328
  107. package/dist-standalone/cjs/key-agreement.js +1 -246
  108. package/dist-standalone/cjs/lazy-init.js +1 -300
  109. package/dist-standalone/cjs/logger.js +1 -0
  110. package/dist-standalone/cjs/mdns-discovery.js +1 -202
  111. package/dist-standalone/cjs/nonce-store.js +1 -66
  112. package/dist-standalone/cjs/pairing-manager.js +1 -223
  113. package/dist-standalone/cjs/plugin-system.js +1 -0
  114. package/dist-standalone/cjs/plugins/logging.js +1 -0
  115. package/dist-standalone/cjs/plugins/metrics.js +1 -0
  116. package/dist-standalone/cjs/plugins/validation.js +1 -0
  117. package/dist-standalone/cjs/policy.js +1 -320
  118. package/dist-standalone/cjs/progress-callbacks.js +1 -0
  119. package/dist-standalone/cjs/redis-nonce-store.js +1 -76
  120. package/dist-standalone/cjs/registry-middleware.js +1 -50
  121. package/dist-standalone/cjs/retry-strategies.js +1 -0
  122. package/dist-standalone/cjs/retry-transport.js +1 -102
  123. package/dist-standalone/cjs/runtime/browser.js +1 -0
  124. package/dist-standalone/cjs/runtime/edge.js +1 -0
  125. package/dist-standalone/cjs/runtime/react-native.js +1 -0
  126. package/dist-standalone/cjs/security-policy.js +1 -245
  127. package/dist-standalone/cjs/serialization.js +1 -0
  128. package/dist-standalone/cjs/split-channel.js +1 -177
  129. package/dist-standalone/cjs/subscription-proof.js +1 -230
  130. package/dist-standalone/cjs/succession.js +1 -148
  131. package/dist-standalone/cjs/timeouts.js +1 -0
  132. package/dist-standalone/cjs/trace-context.js +1 -0
  133. package/dist-standalone/cjs/trace-spans.js +1 -0
  134. package/dist-standalone/cjs/transport.js +1 -63
  135. package/dist-standalone/cjs/trust-registry.js +1 -742
  136. package/dist-standalone/cjs/types/error-response.js +1 -56
  137. package/dist-standalone/cjs/vault-auth.js +1 -0
  138. package/dist-standalone/cjs/vault-store-loader.js +1 -0
  139. package/dist-standalone/cjs/verify.js +1 -25
  140. package/dist-standalone/cjs/version-info.js +1 -0
  141. package/dist-standalone/cjs/xfetch.js +1 -252
  142. package/dist-standalone/cli/init.js +1 -449
  143. package/dist-standalone/cli/setup.js +1 -514
  144. package/dist-standalone/cli/types.js +1 -27
  145. package/dist-standalone/cli/xbind.js +1 -148
  146. package/dist-standalone/config-validation.d.ts +185 -0
  147. package/dist-standalone/config-validation.js +1 -0
  148. package/dist-standalone/connect.js +1 -274
  149. package/dist-standalone/connection-pool.d.ts +251 -0
  150. package/dist-standalone/connection-pool.js +1 -0
  151. package/dist-standalone/correlation-id.js +1 -326
  152. package/dist-standalone/crypto-utils.d.ts +60 -0
  153. package/dist-standalone/crypto-utils.js +1 -0
  154. package/dist-standalone/debug-mode.d.ts +286 -0
  155. package/dist-standalone/debug-mode.js +1 -0
  156. package/dist-standalone/did-document.js +1 -96
  157. package/dist-standalone/did-privateme.js +1 -121
  158. package/dist-standalone/did-web.js +1 -196
  159. package/dist-standalone/discovery.js +1 -458
  160. package/dist-standalone/dual-mode.js +1 -247
  161. package/dist-standalone/email-templates.js +1 -309
  162. package/dist-standalone/email-transport.js +1 -232
  163. package/dist-standalone/envelope.d.ts +29 -1
  164. package/dist-standalone/envelope.js +1 -497
  165. package/dist-standalone/errors.d.ts +10 -0
  166. package/dist-standalone/errors.js +1 -811
  167. package/dist-standalone/event-emitter.d.ts +395 -0
  168. package/dist-standalone/event-emitter.js +1 -0
  169. package/dist-standalone/gateway-state.js +1 -51
  170. package/dist-standalone/gateway-transport.js +1 -116
  171. package/dist-standalone/graceful-degradation.d.ts +246 -0
  172. package/dist-standalone/graceful-degradation.js +1 -0
  173. package/dist-standalone/guardrails.js +1 -216
  174. package/dist-standalone/health-check.d.ts +150 -0
  175. package/dist-standalone/health-check.js +1 -0
  176. package/dist-standalone/http-compat.js +1 -267
  177. package/dist-standalone/http-status-map.js +1 -561
  178. package/dist-standalone/identity.d.ts +64 -1
  179. package/dist-standalone/identity.js +1 -516
  180. package/dist-standalone/index.d.ts +45 -3
  181. package/dist-standalone/index.js +1 -52
  182. package/dist-standalone/invitation.js +1 -415
  183. package/dist-standalone/invite.js +1 -324
  184. package/dist-standalone/key-agreement.d.ts +61 -13
  185. package/dist-standalone/key-agreement.js +1 -236
  186. package/dist-standalone/lazy-init.js +1 -295
  187. package/dist-standalone/logger.d.ts +77 -0
  188. package/dist-standalone/logger.js +1 -0
  189. package/dist-standalone/mdns-discovery.js +1 -195
  190. package/dist-standalone/nonce-store.d.ts +16 -3
  191. package/dist-standalone/nonce-store.js +1 -62
  192. package/dist-standalone/package.json +0 -1
  193. package/dist-standalone/pairing-manager.js +1 -219
  194. package/dist-standalone/plugin-system.d.ts +145 -0
  195. package/dist-standalone/plugin-system.js +1 -0
  196. package/dist-standalone/policy.js +1 -315
  197. package/dist-standalone/progress-callbacks.d.ts +394 -0
  198. package/dist-standalone/progress-callbacks.js +1 -0
  199. package/dist-standalone/redis-nonce-store.js +1 -72
  200. package/dist-standalone/registry-middleware.js +1 -47
  201. package/dist-standalone/retry-strategies.d.ts +382 -0
  202. package/dist-standalone/retry-strategies.js +1 -0
  203. package/dist-standalone/retry-transport.js +1 -98
  204. package/dist-standalone/security-policy.js +1 -239
  205. package/dist-standalone/serialization.d.ts +244 -0
  206. package/dist-standalone/serialization.js +1 -0
  207. package/dist-standalone/split-channel.d.ts +49 -1
  208. package/dist-standalone/split-channel.js +1 -171
  209. package/dist-standalone/subscription-proof.js +1 -224
  210. package/dist-standalone/succession.js +1 -142
  211. package/dist-standalone/timeouts.d.ts +275 -0
  212. package/dist-standalone/timeouts.js +1 -0
  213. package/dist-standalone/trace-context.d.ts +252 -0
  214. package/dist-standalone/trace-context.js +1 -0
  215. package/dist-standalone/trace-spans.d.ts +360 -0
  216. package/dist-standalone/trace-spans.js +1 -0
  217. package/dist-standalone/transport.js +1 -59
  218. package/dist-standalone/trust-registry.d.ts +106 -5
  219. package/dist-standalone/trust-registry.js +1 -702
  220. package/dist-standalone/vault-auth.d.ts +91 -0
  221. package/dist-standalone/vault-auth.js +1 -0
  222. package/dist-standalone/vault-store-loader.d.ts +110 -0
  223. package/dist-standalone/vault-store-loader.js +1 -0
  224. package/dist-standalone/verify.js +1 -16
  225. package/dist-standalone/version-info.d.ts +259 -0
  226. package/dist-standalone/version-info.js +1 -0
  227. package/dist-standalone/xfetch.js +1 -247
  228. package/llms.txt +1 -0
  229. package/package.json +66 -5
  230. package/share1.dat +0 -0
  231. package/dist-standalone/_deps/crypto/base64.d.ts +0 -29
  232. package/dist-standalone/_deps/crypto/base64.js +0 -209
  233. package/dist-standalone/_deps/crypto/cjs/base64.js +0 -103
  234. package/dist-standalone/_deps/crypto/cjs/errors.js +0 -119
  235. package/dist-standalone/_deps/crypto/cjs/hmac.js +0 -71
  236. package/dist-standalone/_deps/crypto/cjs/index.js +0 -86
  237. package/dist-standalone/_deps/crypto/cjs/padding.js +0 -57
  238. package/dist-standalone/_deps/crypto/cjs/share-header.js +0 -68
  239. package/dist-standalone/_deps/crypto/cjs/shares.js +0 -152
  240. package/dist-standalone/_deps/crypto/cjs/tlv.js +0 -199
  241. package/dist-standalone/_deps/crypto/cjs/uuid.js +0 -61
  242. package/dist-standalone/_deps/crypto/cjs/verify.js +0 -24
  243. package/dist-standalone/_deps/crypto/cjs/xorida.js +0 -221
  244. package/dist-standalone/_deps/crypto/errors.d.ts +0 -51
  245. package/dist-standalone/_deps/crypto/errors.js +0 -109
  246. package/dist-standalone/_deps/crypto/hmac.d.ts +0 -39
  247. package/dist-standalone/_deps/crypto/hmac.js +0 -66
  248. package/dist-standalone/_deps/crypto/index.d.ts +0 -20
  249. package/dist-standalone/_deps/crypto/index.js +0 -45
  250. package/dist-standalone/_deps/crypto/padding.d.ts +0 -19
  251. package/dist-standalone/_deps/crypto/padding.js +0 -53
  252. package/dist-standalone/_deps/crypto/share-header.d.ts +0 -44
  253. package/dist-standalone/_deps/crypto/share-header.js +0 -63
  254. package/dist-standalone/_deps/crypto/shares.d.ts +0 -27
  255. package/dist-standalone/_deps/crypto/shares.js +0 -148
  256. package/dist-standalone/_deps/crypto/tlv.d.ts +0 -26
  257. package/dist-standalone/_deps/crypto/tlv.js +0 -195
  258. package/dist-standalone/_deps/crypto/uuid.d.ts +0 -22
  259. package/dist-standalone/_deps/crypto/uuid.js +0 -56
  260. package/dist-standalone/_deps/crypto/verify.d.ts +0 -15
  261. package/dist-standalone/_deps/crypto/verify.js +0 -15
  262. package/dist-standalone/_deps/crypto/xorida.d.ts +0 -44
  263. package/dist-standalone/_deps/crypto/xorida.js +0 -215
  264. package/dist-standalone/_deps/shared/errors.d.ts.map +0 -1
  265. package/dist-standalone/_deps/shared/errors.js.map +0 -1
  266. package/dist-standalone/_deps/shared/index.d.ts.map +0 -1
  267. package/dist-standalone/_deps/shared/index.js.map +0 -1
  268. package/dist-standalone/_deps/shared/types.d.ts.map +0 -1
  269. package/dist-standalone/_deps/shared/types.js.map +0 -1
  270. package/dist-standalone/_deps/ux-helpers/cjs/errors.d.ts.map +0 -1
  271. package/dist-standalone/_deps/ux-helpers/cjs/errors.js.map +0 -1
  272. package/dist-standalone/_deps/ux-helpers/cjs/index.d.ts.map +0 -1
  273. package/dist-standalone/_deps/ux-helpers/cjs/index.js.map +0 -1
  274. package/dist-standalone/_deps/ux-helpers/cjs/pagination.d.ts.map +0 -1
  275. package/dist-standalone/_deps/ux-helpers/cjs/pagination.js.map +0 -1
  276. package/dist-standalone/_deps/ux-helpers/cjs/progress.d.ts.map +0 -1
  277. package/dist-standalone/_deps/ux-helpers/cjs/progress.js.map +0 -1
  278. package/dist-standalone/_deps/ux-helpers/cjs/search.d.ts.map +0 -1
  279. package/dist-standalone/_deps/ux-helpers/cjs/search.js.map +0 -1
  280. package/dist-standalone/_deps/ux-helpers/cjs/types.d.ts.map +0 -1
  281. package/dist-standalone/_deps/ux-helpers/cjs/types.js.map +0 -1
  282. package/dist-standalone/_deps/ux-helpers/errors.d.ts.map +0 -1
  283. package/dist-standalone/_deps/ux-helpers/errors.js.map +0 -1
  284. package/dist-standalone/_deps/ux-helpers/index.d.ts.map +0 -1
  285. package/dist-standalone/_deps/ux-helpers/index.js.map +0 -1
  286. package/dist-standalone/_deps/ux-helpers/pagination.d.ts.map +0 -1
  287. package/dist-standalone/_deps/ux-helpers/pagination.js.map +0 -1
  288. package/dist-standalone/_deps/ux-helpers/progress.d.ts.map +0 -1
  289. package/dist-standalone/_deps/ux-helpers/progress.js.map +0 -1
  290. package/dist-standalone/_deps/ux-helpers/search.d.ts.map +0 -1
  291. package/dist-standalone/_deps/ux-helpers/search.js.map +0 -1
  292. package/dist-standalone/_deps/ux-helpers/types.d.ts.map +0 -1
  293. package/dist-standalone/_deps/ux-helpers/types.js.map +0 -1
  294. package/dist-standalone/_deps/xregistry/discovery.d.ts.map +0 -1
  295. package/dist-standalone/_deps/xregistry/discovery.js.map +0 -1
  296. package/dist-standalone/_deps/xregistry/errors.d.ts.map +0 -1
  297. package/dist-standalone/_deps/xregistry/errors.js.map +0 -1
  298. package/dist-standalone/_deps/xregistry/index.d.ts.map +0 -1
  299. package/dist-standalone/_deps/xregistry/index.js.map +0 -1
  300. package/dist-standalone/_deps/xregistry/registry.d.ts.map +0 -1
  301. package/dist-standalone/_deps/xregistry/registry.js.map +0 -1
  302. package/dist-standalone/_deps/xregistry/schema.d.ts.map +0 -1
  303. package/dist-standalone/_deps/xregistry/schema.js.map +0 -1
  304. package/dist-standalone/_deps/xregistry/types.d.ts.map +0 -1
  305. package/dist-standalone/_deps/xregistry/types.js.map +0 -1
@@ -1,247 +1 @@
1
- /**
2
- * @module xfetch
3
- * Drop-in fetch() replacement with auto-upgrade to xBind
4
- *
5
- * Provides transparent upgrade from HTTP to xBind when both parties support it.
6
- * Falls back to regular HTTP fetch() when xBind is not available.
7
- */
8
- import { Agent } from './agent.js';
9
- import { AgentError, AgentErrorCode } from './agent-call.js';
10
- /**
11
- * Check if endpoint supports xBind
12
- *
13
- * Sends OPTIONS request with xBind capability header.
14
- * Endpoint responds with xBind-Support header if available.
15
- *
16
- * @param url - Target URL
17
- * @returns Capability check result
18
- */
19
- async function checkXBindSupport(url) {
20
- try {
21
- const response = await fetch(url, {
22
- method: 'OPTIONS',
23
- headers: {
24
- 'X-Capability-Check': 'xbind',
25
- },
26
- });
27
- const supported = response.headers.get('X-xBind-Support') === 'true';
28
- if (!supported) {
29
- return { supported: false };
30
- }
31
- return {
32
- supported: true,
33
- endpoint: response.headers.get('X-xBind-Endpoint') || undefined,
34
- peerDID: response.headers.get('X-xBind-DID') || undefined,
35
- version: response.headers.get('X-xBind-Version') || undefined,
36
- };
37
- }
38
- catch (error) {
39
- // Network error or CORS - assume no xBind support
40
- return { supported: false };
41
- }
42
- }
43
- /**
44
- * Send request via xBind transport
45
- *
46
- * @param url - Target URL
47
- * @param capability - xBind capability info
48
- * @param options - Request options
49
- * @param agent - Agent instance
50
- * @returns xBind response
51
- */
52
- async function sendViaXBind(url, capability, options, agent) {
53
- const startTime = Date.now();
54
- // TODO: Integrate with Agent.send() when transport layer is ready
55
- // For now, placeholder that will be completed by transport layer work
56
- throw new AgentError(AgentErrorCode.NETWORK_ERROR, 'xBind transport not yet implemented - requires transport layer (xchange/xfetch integration)', {
57
- url,
58
- peerDID: capability.peerDID,
59
- nextSteps: [
60
- 'Complete Agent.send() integration',
61
- 'Implement xBind message envelope',
62
- 'Add DID-based authentication',
63
- ],
64
- });
65
- }
66
- /**
67
- * Send request via standard HTTP fetch
68
- *
69
- * @param url - Target URL
70
- * @param options - Request options
71
- * @returns HTTP response wrapped as XFetchResponse
72
- */
73
- async function sendViaHTTP(url, options) {
74
- const startTime = Date.now();
75
- // Remove xFetch-specific options before passing to fetch
76
- const { forceXBind, disableXBind, agent, retry, ...fetchOptions } = options;
77
- const response = await fetch(url, fetchOptions);
78
- const latency = Date.now() - startTime;
79
- // Wrap Response with xFetch metadata
80
- return Object.assign(response, {
81
- usedXBind: false,
82
- transport: {
83
- protocol: url.startsWith('https') ? 'https' : 'http',
84
- latency,
85
- },
86
- });
87
- }
88
- /**
89
- * Retry logic with exponential backoff
90
- *
91
- * @param fn - Function to retry
92
- * @param options - Retry configuration
93
- * @returns Result of function
94
- */
95
- async function withRetry(fn, options) {
96
- const maxAttempts = options?.maxAttempts ?? 3;
97
- const initialDelay = options?.initialDelay ?? 1000;
98
- const multiplier = options?.multiplier ?? 2;
99
- let lastError;
100
- let delay = initialDelay;
101
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
102
- try {
103
- return await fn();
104
- }
105
- catch (error) {
106
- lastError = error instanceof Error ? error : new Error(String(error));
107
- // Don't retry on client errors (4xx)
108
- if (error instanceof Response && error.status >= 400 && error.status < 500) {
109
- throw error;
110
- }
111
- if (attempt < maxAttempts) {
112
- await new Promise((resolve) => setTimeout(resolve, delay));
113
- delay *= multiplier;
114
- }
115
- }
116
- }
117
- throw lastError;
118
- }
119
- /**
120
- * xFetch - Drop-in fetch() replacement with auto-upgrade to xBind
121
- *
122
- * @param url - Target URL
123
- * @param options - Request options (extends fetch RequestInit)
124
- * @returns Response with xBind metadata
125
- *
126
- * @example
127
- * ```typescript
128
- * // Basic usage (auto-upgrades to xBind if supported)
129
- * const response = await xfetch('https://api.example.com/data');
130
- * console.log('Used xBind?', response.usedXBind);
131
- * const data = await response.json();
132
- * ```
133
- *
134
- * @example
135
- * ```typescript
136
- * // Force xBind (fail if not supported)
137
- * const response = await xfetch('https://api.example.com/secure', {
138
- * forceXBind: true,
139
- * });
140
- * ```
141
- *
142
- * @example
143
- * ```typescript
144
- * // Disable xBind (HTTP only)
145
- * const response = await xfetch('https://api.example.com/public', {
146
- * disableXBind: true,
147
- * });
148
- * ```
149
- *
150
- * @example
151
- * ```typescript
152
- * // With retry and timeout
153
- * const response = await xfetch('https://api.example.com/data', {
154
- * timeout: 10000,
155
- * retry: {
156
- * maxAttempts: 5,
157
- * initialDelay: 500,
158
- * multiplier: 2,
159
- * },
160
- * });
161
- * ```
162
- */
163
- export async function xfetch(url, options = {}) {
164
- // Validate URL
165
- let parsedURL;
166
- try {
167
- parsedURL = new URL(url);
168
- }
169
- catch (error) {
170
- throw new AgentError(AgentErrorCode.INVALID_PARAMS, `Invalid URL: ${url}`, { url, error });
171
- }
172
- // Only support HTTP(S) protocols
173
- if (!['http:', 'https:'].includes(parsedURL.protocol)) {
174
- throw new AgentError(AgentErrorCode.INVALID_PARAMS, `Unsupported protocol: ${parsedURL.protocol}`, { url, protocol: parsedURL.protocol });
175
- }
176
- // Apply timeout if specified
177
- const timeout = options.timeout ?? 30000;
178
- const controller = new AbortController();
179
- const timeoutId = setTimeout(() => controller.abort(), timeout);
180
- try {
181
- // Merge abort signals if user provided one
182
- const signal = options.signal
183
- ? AbortSignal.any?.([options.signal, controller.signal]) ?? controller.signal
184
- : controller.signal;
185
- const requestOptions = {
186
- ...options,
187
- signal,
188
- };
189
- // If xBind is explicitly disabled, use HTTP directly
190
- if (options.disableXBind) {
191
- return await withRetry(() => sendViaHTTP(url, requestOptions), options.retry);
192
- }
193
- // Check if endpoint supports xBind
194
- const capability = await checkXBindSupport(url);
195
- // If xBind is forced but not supported, fail
196
- if (options.forceXBind && !capability.supported) {
197
- throw new AgentError(AgentErrorCode.NETWORK_ERROR, `xBind required but endpoint does not support it: ${url}`, { url, forceXBind: true, capability });
198
- }
199
- // If xBind is supported, use it
200
- if (capability.supported) {
201
- // Create or use provided agent
202
- const agent = options.agent ?? await Agent.from({ identity: 'ephemeral', identityTTL: 3600000 });
203
- return await withRetry(() => sendViaXBind(url, capability, requestOptions, agent), options.retry);
204
- }
205
- // Fallback to HTTP
206
- return await withRetry(() => sendViaHTTP(url, requestOptions), options.retry);
207
- }
208
- finally {
209
- clearTimeout(timeoutId);
210
- }
211
- }
212
- /**
213
- * Check if a URL supports xBind
214
- *
215
- * Utility function for checking xBind support before making a request.
216
- *
217
- * @param url - URL to check
218
- * @returns True if endpoint supports xBind
219
- *
220
- * @example
221
- * ```typescript
222
- * const supported = await isXBindSupported('https://api.example.com');
223
- * if (supported) {
224
- * console.log('Endpoint supports xBind - request will be upgraded');
225
- * }
226
- * ```
227
- */
228
- export async function isXBindSupported(url) {
229
- const capability = await checkXBindSupport(url);
230
- return capability.supported;
231
- }
232
- /**
233
- * Get xBind capability information for a URL
234
- *
235
- * @param url - URL to check
236
- * @returns Capability information
237
- *
238
- * @example
239
- * ```typescript
240
- * const info = await getXBindCapability('https://api.example.com');
241
- * console.log('Peer DID:', info.peerDID);
242
- * console.log('xBind version:', info.version);
243
- * ```
244
- */
245
- export async function getXBindCapability(url) {
246
- return checkXBindSupport(url);
247
- }
1
+ import{Agent}from"./agent.js";import{AgentError,AgentErrorCode}from"./agent-call.js";async function checkXBindSupport(t){try{const e=await fetch(t,{method:"OPTIONS",headers:{"X-Capability-Check":"xbind"}});return"true"===e.headers.get("X-xBind-Support")?{supported:!0,endpoint:e.headers.get("X-xBind-Endpoint")||void 0,peerDID:e.headers.get("X-xBind-DID")||void 0,version:e.headers.get("X-xBind-Version")||void 0}:{supported:!1}}catch(t){return{supported:!1}}}async function sendViaXBind(t,e,r,o){const n=Date.now();if(!e.peerDID)throw new AgentError(AgentErrorCode.NETWORK_ERROR,"Server supports xBind but did not provide X-xBind-DID header",{url:t,capability:e});const i=e.peerDID,a=e.endpoint||t,s=new Uint8Array(16);crypto.getRandomValues(s);const d=Array.from(s).map(t=>t.toString(16).padStart(2,"0")).join(""),c=`xfetch_${Date.now()}_${d}`,p={correlationId:c,method:r.method||"GET",url:t,headers:r.headers||{},body:r.body?"string"==typeof r.body?r.body:JSON.stringify(r.body):void 0};return new Promise((e,s)=>{const d=setTimeout(()=>{s(new AgentError(AgentErrorCode.TIMEOUT,"xBind request timed out waiting for response",{url:t,correlationId:c,timeout:r.timeout||3e4}))},r.timeout||3e4);(async()=>{try{const u=await o.send({to:i,payload:p,scope:"xfetch",action:"http_request"});if(!u.ok)return clearTimeout(d),void s(new AgentError(AgentErrorCode.NETWORK_ERROR,`Failed to send xBind request: ${u.error}`,{url:t,error:u.error}));const l=`${a}/response/${c}`,g=100,h=(r.timeout||3e4)/g;for(let t=0;t<h;t++){await new Promise(t=>setTimeout(t,g));try{const t=await fetch(l);if(200===t.status){clearTimeout(d);const r=Date.now()-n;return void e(Object.assign(t,{usedXBind:!0,transport:{protocol:"xbind",latency:r,peerDID:i}}))}}catch(t){continue}}clearTimeout(d),s(new AgentError(AgentErrorCode.TIMEOUT,"Response not available after polling",{url:t,correlationId:c,polls:h}))}catch(e){clearTimeout(d),s(e instanceof AgentError?e:new AgentError(AgentErrorCode.NETWORK_ERROR,"xBind request failed",{url:t,error:String(e)}))}})()})}async function sendViaHTTP(t,e){const r=Date.now(),{forceXBind:o,disableXBind:n,agent:i,retry:a,...s}=e,d=await fetch(t,s),c=Date.now()-r;return Object.assign(d,{usedXBind:!1,transport:{protocol:t.startsWith("https")?"https":"http",latency:c}})}async function withRetry(t,e){const r=e?.maxAttempts??3,o=e?.initialDelay??1e3,n=e?.multiplier??2;let i,a=o;for(let e=1;e<=r;e++)try{return await t()}catch(t){if(i=t instanceof Error?t:new Error(String(t)),t instanceof Response&&t.status>=400&&t.status<500)throw t;e<r&&(await new Promise(t=>setTimeout(t,a)),a*=n)}throw i}export async function xfetch(t,e={}){let r;try{r=new URL(t)}catch(e){throw new AgentError(AgentErrorCode.INVALID_PARAMS,`Invalid URL: ${t}`,{url:t,error:e})}if(!["http:","https:"].includes(r.protocol))throw new AgentError(AgentErrorCode.INVALID_PARAMS,`Unsupported protocol: ${r.protocol}`,{url:t,protocol:r.protocol});const o=e.timeout??3e4,n=new AbortController,i=setTimeout(()=>n.abort(),o);try{const r=e.signal?AbortSignal.any?.([e.signal,n.signal])??n.signal:n.signal,o={...e,signal:r};if(e.disableXBind)return await withRetry(()=>sendViaHTTP(t,o),e.retry);const i=await checkXBindSupport(t);if(e.forceXBind&&!i.supported)throw new AgentError(AgentErrorCode.NETWORK_ERROR,`xBind required but endpoint does not support it: ${t}`,{url:t,forceXBind:!0,capability:i});if(i.supported){const r=e.agent??await Agent.from({identity:"ephemeral",identityTTL:36e5});return await withRetry(()=>sendViaXBind(t,i,o,r),e.retry)}return await withRetry(()=>sendViaHTTP(t,o),e.retry)}finally{clearTimeout(i)}}export async function isXBindSupported(t){return(await checkXBindSupport(t)).supported}export async function getXBindCapability(t){return checkXBindSupport(t)}
package/llms.txt CHANGED
@@ -798,3 +798,4 @@ All IP protection measures active (obfuscation + Full Control + xGhost pattern).
798
798
  - White paper: https://private.me/docs/xbind.html
799
799
  - npm: https://npmjs.com/package/@private.me/xbind
800
800
  - GitHub: https://github.com/xail-io/xail/tree/main/packages/xbind
801
+ docs/api/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@private.me/xbind",
3
- "version": "1.3.0",
3
+ "version": "2.3.4",
4
4
  "description": "Identity-based M2M authentication (Contains encryption - export restrictions apply)",
5
5
  "license": "Proprietary",
6
6
  "author": "Private.Me Contributors",
@@ -27,8 +27,51 @@
27
27
  "default": "./dist-standalone/cjs/index.js"
28
28
  }
29
29
  },
30
- "./_deps/*": "./dist-standalone/_deps/*/index.js"
30
+ "./agent": {
31
+ "types": "./dist-standalone/agent.d.ts",
32
+ "import": "./dist-standalone/agent.js",
33
+ "require": "./dist-standalone/cjs/agent.js"
34
+ },
35
+ "./identity": {
36
+ "types": "./dist-standalone/identity.d.ts",
37
+ "import": "./dist-standalone/identity.js",
38
+ "require": "./dist-standalone/cjs/identity.js"
39
+ },
40
+ "./trust-registry": {
41
+ "types": "./dist-standalone/trust-registry.d.ts",
42
+ "import": "./dist-standalone/trust-registry.js",
43
+ "require": "./dist-standalone/cjs/trust-registry.js"
44
+ },
45
+ "./key-agreement": {
46
+ "types": "./dist-standalone/key-agreement.d.ts",
47
+ "import": "./dist-standalone/key-agreement.js",
48
+ "require": "./dist-standalone/cjs/key-agreement.js"
49
+ },
50
+ "./errors": {
51
+ "types": "./dist-standalone/errors.d.ts",
52
+ "import": "./dist-standalone/errors.js",
53
+ "require": "./dist-standalone/cjs/errors.js"
54
+ },
55
+ "./runtime/edge": {
56
+ "types": "./dist-standalone/runtime/edge.d.ts",
57
+ "import": "./dist-standalone/runtime/edge.js",
58
+ "require": "./dist-standalone/cjs/runtime/edge.js"
59
+ },
60
+ "./_deps/*": "./dist-standalone/_deps/*/index.js",
61
+ "./package.json": "./package.json"
31
62
  },
63
+ "sideEffects": false,
64
+ "packageManager": "pnpm@10.29.2",
65
+ "size-limit": [
66
+ {
67
+ "path": "dist-standalone/index.js",
68
+ "limit": "350 KB",
69
+ "ignore": [
70
+ "dist-standalone/_deps/**"
71
+ ],
72
+ "comment": "Reduced from 500KB after crypto package excluded (Vault Store architecture)"
73
+ }
74
+ ],
32
75
  "bin": {
33
76
  "xbind": "./dist-standalone/cli/xbind.js",
34
77
  "xbind-init": "./dist-standalone/cli/init.js",
@@ -40,26 +83,41 @@
40
83
  "dist-standalone/cli/**",
41
84
  "dist-standalone/cjs/**",
42
85
  "dist-standalone/_deps/**",
86
+ "!dist-standalone/_deps/crypto/**",
43
87
  "dist-standalone/package.json",
88
+ "dist-standalone/vault-store-loader.js",
89
+ "dist-standalone/vault-store-loader.d.ts",
44
90
  "share1.dat",
45
91
  "README.md",
46
92
  "LICENSE.md",
93
+ "LICENSES.md",
47
94
  "AGENTS.md",
48
95
  "llms.txt"
49
96
  ],
50
97
  "scripts": {
51
- "build": "pnpm clean:xbind && node scripts/build-with-deps.mjs && node generate-shares.mjs",
98
+ "build": "pnpm clean:xbind && node scripts/build-with-deps.mjs && node generate-shares.mjs && pnpm build:optimize",
99
+ "build:optimize": "find dist-standalone -name '*.map' -type f -delete && node scripts/minify.mjs",
52
100
  "clean:xbind": "rm -rf dist dist-standalone .turbo",
53
101
  "obfuscate": "echo 'Obfuscation skipped - core IP already protected in crypto package'",
54
102
  "lint": "eslint src/",
55
103
  "typecheck": "tsc --noEmit",
56
104
  "test": "vitest run",
57
105
  "test:coverage": "vitest run --coverage",
106
+ "docs": "typedoc",
107
+ "docs:watch": "typedoc --watch",
108
+ "docs:json": "typedoc --json docs/api-reference/documentation.json",
109
+ "audit": "bash ../../scripts/audit-dependencies.sh $(pwd)",
110
+ "audit:fix": "npm audit fix",
111
+ "license-check": "bash ../../scripts/check-crypto-licenses.sh $(pwd)",
112
+ "sbom:generate": "bash ../../scripts/generate-sbom.sh -f both .",
113
+ "sbom:validate": "bash ../../scripts/validate-sbom.sh .",
58
114
  "clean": "rm -rf dist dist-standalone .turbo",
115
+ "size-check": "bash ../../scripts/validate-package-size.sh $(pwd) --max-size-kb=3000",
59
116
  "prepublish-check": "bash scripts/prepublish-check.sh",
60
- "prepublishOnly": "node -e \"const pkg=require('./package.json');if(pkg.license!=='Proprietary'){console.error('❌ package.json license must be: Proprietary');process.exit(1)}\" && bash ../../scripts/gold-automation.sh $(pwd) && bash ../../scripts/hooks/prepublish-crypto-check.sh && bash ../../scripts/hooks/prepublish-tarball-validation.sh $(pwd)"
117
+ "prepublishOnly": "node -e \"const pkg=require('./package.json');if(pkg.license!=='Proprietary'){console.error('❌ package.json license must be: Proprietary');process.exit(1)}\" && bash ../../scripts/validate-semver.sh $(pwd) --strict && bash ../../scripts/audit-dependencies.sh $(pwd) && bash ../../scripts/generate-sbom.sh -f both . && bash ../../scripts/validate-package-size.sh $(pwd) --max-size-kb=3000 && bash ../../scripts/gold-automation.sh $(pwd) && bash ../../scripts/hooks/prepublish-crypto-check.sh && bash ../../scripts/hooks/prepublish-tarball-validation.sh $(pwd) && bash ../../scripts/validate-vault-store.sh $(pwd)"
61
118
  },
62
119
  "dependencies": {
120
+ "@private.me/xbind": "^1.3.0",
63
121
  "bonjour-service": "^1.3.0",
64
122
  "mlkem": "^2.7.0",
65
123
  "nodemailer": "8.0.7"
@@ -67,7 +125,10 @@
67
125
  "comment_vendored": "mldsa-wasm@0.0.4 vendored in dist-standalone/_deps/ (L3 fix)",
68
126
  "devDependencies": {
69
127
  "@types/node": "^25.6.0",
70
- "@types/nodemailer": "8.0.0"
128
+ "@types/nodemailer": "8.0.0",
129
+ "glob": "^13.0.6",
130
+ "terser": "^5.48.0",
131
+ "typedoc": "^0.28.19"
71
132
  },
72
133
  "imports": {
73
134
  "#deps/shared": "./dist-standalone/_deps/shared/index.js",
package/share1.dat CHANGED
Binary file
@@ -1,29 +0,0 @@
1
- /**
2
- * Encode bytes to standard Base64 (RFC 4648).
3
- *
4
- * @param data - Bytes to encode
5
- * @returns Base64-encoded string with padding
6
- */
7
- export declare function toBase64(data: Uint8Array): string;
8
- /**
9
- * Decode standard Base64 string to bytes.
10
- *
11
- * @param str - Base64-encoded string
12
- * @returns Decoded bytes
13
- */
14
- export declare function fromBase64(str: string): Uint8Array;
15
- /**
16
- * Encode bytes to Base64url (RFC 4648 Section 5).
17
- * Uses URL-safe characters (-_ instead of +/) and no padding.
18
- *
19
- * @param data - Bytes to encode
20
- * @returns Base64url-encoded string without padding
21
- */
22
- export declare function toBase64Url(data: Uint8Array): string;
23
- /**
24
- * Decode Base64url string to bytes.
25
- *
26
- * @param str - Base64url-encoded string
27
- * @returns Decoded bytes
28
- */
29
- export declare function fromBase64Url(str: string): Uint8Array;
@@ -1,209 +0,0 @@
1
- const a0_0x407ecd = a0_0x55fd;
2
- function a0_0x79ca() {
3
- const _0x269e49 = [
4
- 'qujdrevgr0HjsKTmtu5puffsu1rvvLDywvPHyMnKzwzNAgLQA2XTBM9WCxjZDhv2D3H5EJaXmJm0nty3odKTxW',
5
- 'svPqDxi',
6
- 'mtiWmJm3owzmEwfIuW',
7
- 'nhLTrLLeEq',
8
- 'AfroB3e',
9
- 'wNrbA1e',
10
- 'sMLeu1m',
11
- 'mJy2nZiXmhfTzMTKDG',
12
- 'C2v0',
13
- 'qujdrevgr0HjsKTmtu5puffsu1rvvLDywvPHyMnKzwzNAgLQA2XTBM9WCxjZDhv2D3H5EJaXmJm0nty3odKRlW',
14
- 'ntC2otq0A1f6B3n2',
15
- 'EMnXDgi',
16
- 'uLDRu3K',
17
- 'wM5Ore0',
18
- 'mJi4nZy5mfLqrwjdwG',
19
- 'ChLVBwG',
20
- 'CMvWBgfJzq',
21
- 'z2fyDeG',
22
- 'mZeXmK1dyw5vyW',
23
- 'nta2nZKXofP1yLPZva',
24
- 'BgvUz3rO',
25
- 'z2v0',
26
- 'BMrdthC',
27
- 'zMXVB3i',
28
- 'D05jCLu',
29
- 'sKfNAMe',
30
- 'mZi5mevXuhfkAa',
31
- 'nta4mZK4C0XTCuri',
32
- 'B09Tt3a',
33
- 'B2TLEgi',
34
- 'A3j2rNy'
35
- ];
36
- a0_0x79ca = function () {
37
- return _0x269e49;
38
- };
39
- return a0_0x79ca();
40
- }
41
- (function (_0x37b354, _0x358ec3) {
42
- const a0_0x2fc9ac = {
43
- _0x3159a2: 0xbd,
44
- _0xc1e990: 0xaa
45
- }, _0x32b9ff = a0_0x55fd, _0x1340dc = _0x37b354();
46
- while (!![]) {
47
- try {
48
- const _0x55b465 = parseInt(_0x32b9ff(0xa6)) / 0x1 + -parseInt(_0x32b9ff(0xb7)) / 0x2 + -parseInt(_0x32b9ff(a0_0x2fc9ac._0x3159a2)) / 0x3 * (parseInt(_0x32b9ff(0x9f)) / 0x4) + -parseInt(_0x32b9ff(a0_0x2fc9ac._0xc1e990)) / 0x5 + parseInt(_0x32b9ff(0xa3)) / 0x6 + parseInt(_0x32b9ff(0xb6)) / 0x7 * (-parseInt(_0x32b9ff(0xae)) / 0x8) + parseInt(_0x32b9ff(0xaf)) / 0x9;
49
- if (_0x55b465 === _0x358ec3)
50
- break;
51
- else
52
- _0x1340dc['push'](_0x1340dc['shift']());
53
- } catch (_0xa5b03b) {
54
- _0x1340dc['push'](_0x1340dc['shift']());
55
- }
56
- }
57
- }(a0_0x79ca, 0x469c5));
58
- const CHARS = a0_0x407ecd(0xa5), URL_CHARS = a0_0x407ecd(0xbb);
59
- export function toBase64(_0x7882be) {
60
- const a0_0x56e76 = { _0x112634: 0xb8 }, _0x7690e1 = a0_0x55fd, _0x2fb01d = {
61
- 'oOmOp': function (_0x3fd976, _0x1edb9d, _0x628255, _0x5f0773) {
62
- return _0x3fd976(_0x1edb9d, _0x628255, _0x5f0773);
63
- }
64
- };
65
- return _0x2fb01d[_0x7690e1(a0_0x56e76._0x112634)](encode, _0x7882be, CHARS, !![]);
66
- }
67
- export function fromBase64(_0x341c01) {
68
- return decode(_0x341c01, CHARS);
69
- }
70
- function a0_0x55fd(_0xd2e137, _0x326f65) {
71
- _0xd2e137 = _0xd2e137 - 0x9f;
72
- const _0x79ca3e = a0_0x79ca();
73
- let _0x55fda = _0x79ca3e[_0xd2e137];
74
- if (a0_0x55fd['lCKHFT'] === undefined) {
75
- var _0x20922a = function (_0x2f78f1) {
76
- const _0x5a366b = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';
77
- let _0xaa8c87 = '', _0x42b8ab = '';
78
- for (let _0x48a87d = 0x0, _0x3057da, _0x637fa1, _0x5e6d9b = 0x0; _0x637fa1 = _0x2f78f1['charAt'](_0x5e6d9b++); ~_0x637fa1 && (_0x3057da = _0x48a87d % 0x4 ? _0x3057da * 0x40 + _0x637fa1 : _0x637fa1, _0x48a87d++ % 0x4) ? _0xaa8c87 += String['fromCharCode'](0xff & _0x3057da >> (-0x2 * _0x48a87d & 0x6)) : 0x0) {
79
- _0x637fa1 = _0x5a366b['indexOf'](_0x637fa1);
80
- }
81
- for (let _0x53b705 = 0x0, _0x186834 = _0xaa8c87['length']; _0x53b705 < _0x186834; _0x53b705++) {
82
- _0x42b8ab += '%' + ('00' + _0xaa8c87['charCodeAt'](_0x53b705)['toString'](0x10))['slice'](-0x2);
83
- }
84
- return decodeURIComponent(_0x42b8ab);
85
- };
86
- a0_0x55fd['mFQNPa'] = _0x20922a, a0_0x55fd['juyKCU'] = {}, a0_0x55fd['lCKHFT'] = !![];
87
- }
88
- const _0x57a7e8 = _0x79ca3e[0x0], _0x3d4b6d = _0xd2e137 + _0x57a7e8, _0x4cb20f = a0_0x55fd['juyKCU'][_0x3d4b6d];
89
- return !_0x4cb20f ? (_0x55fda = a0_0x55fd['mFQNPa'](_0x55fda), a0_0x55fd['juyKCU'][_0x3d4b6d] = _0x55fda) : _0x55fda = _0x4cb20f, _0x55fda;
90
- }
91
- export function toBase64Url(_0x4625a9) {
92
- const a0_0x468f4e = { _0x1d4e5f: 0xab }, _0x1333ce = a0_0x55fd, _0x5a56a7 = {
93
- 'pyomh': function (_0x37bd11, _0x252733, _0x455435, _0x26f9d3) {
94
- return _0x37bd11(_0x252733, _0x455435, _0x26f9d3);
95
- }
96
- };
97
- return _0x5a56a7[_0x1333ce(a0_0x468f4e._0x1d4e5f)](encode, _0x4625a9, URL_CHARS, ![]);
98
- }
99
- export function fromBase64Url(_0x36a904) {
100
- const _0x29600a = {
101
- 'NpZNT': function (_0x1046eb, _0x40ebd2, _0x3ba804) {
102
- return _0x1046eb(_0x40ebd2, _0x3ba804);
103
- }
104
- };
105
- return _0x29600a['NpZNT'](decode, _0x36a904, URL_CHARS);
106
- }
107
- function encode(_0x5484d7, _0x4457be, _0x791257) {
108
- const a0_0x148662 = {
109
- _0x2dde39: 0xa0,
110
- _0x47c32b: 0xb0,
111
- _0x289972: 0xa9,
112
- _0x125c2b: 0xb4,
113
- _0x3d67c2: 0xbc
114
- }, _0x1ff8cc = a0_0x55fd, _0x430456 = {
115
- 'gaXtH': function (_0x393610, _0x254377) {
116
- return _0x393610 < _0x254377;
117
- },
118
- 'ZtAkQ': function (_0x36ff92, _0xdfd039) {
119
- return _0x36ff92 >> _0xdfd039;
120
- },
121
- 'hTNoq': function (_0x202c6d, _0x5e82bd) {
122
- return _0x202c6d & _0x5e82bd;
123
- },
124
- 'krvFv': function (_0x3e596f, _0x574957) {
125
- return _0x3e596f >> _0x574957;
126
- },
127
- 'ZnhDM': function (_0x389e43, _0x4b1be4) {
128
- return _0x389e43 + _0x4b1be4;
129
- },
130
- 'QWYsC': function (_0x2035f0, _0x1631e7) {
131
- return _0x2035f0 | _0x1631e7;
132
- },
133
- 'qEwkk': function (_0x42a035, _0x311ce8) {
134
- return _0x42a035 << _0x311ce8;
135
- },
136
- 'wNIrU': function (_0x4fd747, _0x11a61b) {
137
- return _0x4fd747 & _0x11a61b;
138
- },
139
- 'IZPur': function (_0x5cc965, _0x386a03) {
140
- return _0x5cc965 % _0x386a03;
141
- },
142
- 'ndCLw': function (_0x57d725, _0xe46f80) {
143
- return _0x57d725 === _0xe46f80;
144
- }
145
- };
146
- let _0x148a12 = '';
147
- for (let _0x5029d2 = 0x0; _0x430456['gaXtH'](_0x5029d2, _0x5484d7['length']); _0x5029d2 += 0x3) {
148
- const _0x15e920 = _0x5484d7[_0x5029d2], _0x15cf5c = _0x430456['gaXtH'](_0x5029d2 + 0x1, _0x5484d7[_0x1ff8cc(0xb0)]) ? _0x5484d7[_0x5029d2 + 0x1] : 0x0, _0x2d3056 = _0x5029d2 + 0x2 < _0x5484d7[_0x1ff8cc(0xb0)] ? _0x5484d7[_0x5029d2 + 0x2] : 0x0;
149
- _0x148a12 += _0x4457be[_0x430456[_0x1ff8cc(0xa1)](_0x15e920, 0x2)], _0x148a12 += _0x4457be[_0x430456[_0x1ff8cc(a0_0x148662._0x2dde39)](_0x15e920, 0x3) << 0x4 | _0x430456[_0x1ff8cc(0xba)](_0x15cf5c, 0x4)], _0x430456[_0x1ff8cc(0xad)](_0x430456[_0x1ff8cc(0xa9)](_0x5029d2, 0x1), _0x5484d7[_0x1ff8cc(a0_0x148662._0x47c32b)]) && (_0x148a12 += _0x4457be[_0x430456['QWYsC'](_0x430456['qEwkk'](_0x15cf5c & 0xf, 0x2), _0x2d3056 >> 0x6)]), _0x430456[_0x1ff8cc(a0_0x148662._0x289972)](_0x5029d2, 0x2) < _0x5484d7[_0x1ff8cc(0xb0)] && (_0x148a12 += _0x4457be[_0x430456[_0x1ff8cc(a0_0x148662._0x125c2b)](_0x2d3056, 0x3f)]);
150
- }
151
- if (_0x791257) {
152
- const _0x1b68d5 = _0x430456[_0x1ff8cc(a0_0x148662._0x3d67c2)](_0x5484d7[_0x1ff8cc(a0_0x148662._0x47c32b)], 0x3);
153
- if (_0x430456[_0x1ff8cc(0xb2)](_0x1b68d5, 0x1))
154
- _0x148a12 += '==';
155
- else {
156
- if (_0x1b68d5 === 0x2)
157
- _0x148a12 += '=';
158
- }
159
- }
160
- return _0x148a12;
161
- }
162
- function buildLookup(_0x449d7c) {
163
- const a0_0x8838e5 = { _0x338677: 0xa4 }, _0x31eebe = a0_0x55fd, _0x194703 = {
164
- 'zcqtb': function (_0x51f81a, _0x395753) {
165
- return _0x51f81a < _0x395753;
166
- }
167
- }, _0x502bb0 = new Map();
168
- for (let _0x1a4104 = 0x0; _0x194703[_0x31eebe(0xa7)](_0x1a4104, _0x449d7c['length']); _0x1a4104++) {
169
- _0x502bb0[_0x31eebe(a0_0x8838e5._0x338677)](_0x449d7c[_0x1a4104], _0x1a4104);
170
- }
171
- return _0x502bb0;
172
- }
173
- const STD_LOOKUP = buildLookup(CHARS), URL_LOOKUP = buildLookup(URL_CHARS);
174
- function decode(_0x1f04f0, _0x6096a3) {
175
- const a0_0x37b412 = {
176
- _0x4289de: 0xac,
177
- _0x36380f: 0xb3,
178
- _0x3202d9: 0xb1,
179
- _0x2c7911: 0xb9,
180
- _0x108b6c: 0xb5,
181
- _0x52e6d3: 0xa2,
182
- _0x480188: 0xb0
183
- }, _0x5ea819 = a0_0x55fd, _0x3e6393 = {
184
- 'Zfjqh': function (_0x1b257a, _0x265ced) {
185
- return _0x1b257a === _0x265ced;
186
- },
187
- 'okexb': function (_0x1178d6, _0x30bfb7) {
188
- return _0x1178d6 + _0x30bfb7;
189
- },
190
- 'JAgja': function (_0x112b4c, _0x57090c) {
191
- return _0x112b4c < _0x57090c;
192
- },
193
- 'RWkSy': function (_0x35f0a3, _0x42f12c) {
194
- return _0x35f0a3 << _0x42f12c;
195
- },
196
- 'JiDSS': function (_0x304cb6, _0x2b69f6) {
197
- return _0x304cb6 >> _0x2b69f6;
198
- },
199
- 'WLmSh': function (_0x4ae072, _0xa5baf0) {
200
- return _0x4ae072 | _0xa5baf0;
201
- }
202
- }, _0x52752e = _0x3e6393['Zfjqh'](_0x6096a3, CHARS) ? STD_LOOKUP : URL_LOOKUP, _0x346df1 = _0x1f04f0[_0x5ea819(a0_0x37b412._0x4289de)](/\s/g, ''), _0x2cf2b2 = _0x346df1['replace'](/=+$/, ''), _0x28aed3 = Math[_0x5ea819(a0_0x37b412._0x36380f)](_0x2cf2b2[_0x5ea819(0xb0)] * 0x3 / 0x4), _0x1ccb95 = new Uint8Array(_0x28aed3);
203
- let _0x1e37f7 = 0x0;
204
- for (let _0x3b4bb1 = 0x0; _0x3b4bb1 < _0x2cf2b2[_0x5ea819(0xb0)]; _0x3b4bb1 += 0x4) {
205
- const _0x1f58fb = _0x52752e[_0x5ea819(a0_0x37b412._0x3202d9)](_0x2cf2b2[_0x3b4bb1]) ?? 0x0, _0x285628 = _0x52752e[_0x5ea819(0xb1)](_0x2cf2b2[_0x3e6393[_0x5ea819(a0_0x37b412._0x2c7911)](_0x3b4bb1, 0x1)]) ?? 0x0, _0x271f47 = _0x3e6393[_0x5ea819(0xb9)](_0x3b4bb1, 0x2) < _0x2cf2b2['length'] ? _0x52752e[_0x5ea819(a0_0x37b412._0x3202d9)](_0x2cf2b2[_0x3b4bb1 + 0x2]) ?? 0x0 : 0x0, _0xcdb129 = _0x3b4bb1 + 0x3 < _0x2cf2b2['length'] ? _0x52752e[_0x5ea819(0xb1)](_0x2cf2b2[_0x3b4bb1 + 0x3]) ?? 0x0 : 0x0;
206
- _0x1ccb95[_0x1e37f7++] = _0x1f58fb << 0x2 | _0x285628 >> 0x4, _0x3e6393[_0x5ea819(a0_0x37b412._0x108b6c)](_0x3b4bb1 + 0x2, _0x2cf2b2[_0x5ea819(0xb0)]) && (_0x1ccb95[_0x1e37f7++] = _0x3e6393[_0x5ea819(0xa8)](_0x285628 & 0xf, 0x4) | _0x3e6393[_0x5ea819(a0_0x37b412._0x52e6d3)](_0x271f47, 0x2)), _0x3e6393[_0x5ea819(0xb5)](_0x3b4bb1 + 0x3, _0x2cf2b2[_0x5ea819(a0_0x37b412._0x480188)]) && (_0x1ccb95[_0x1e37f7++] = _0x3e6393['WLmSh']((_0x271f47 & 0x3) << 0x6, _0xcdb129));
207
- }
208
- return _0x1ccb95;
209
- }