asyx 0.5.1 → 0.5.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.
- package/README.md +166 -97
- package/package.json +1 -2
- package/src/lib/csr.js +2 -3
package/README.md
CHANGED
|
@@ -1,169 +1,238 @@
|
|
|
1
1
|
# Asyx CLI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Turn `localhost:3000` into `https://yourname.tunnel.asyx.ai` in one command.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Coding assistants—Cursor, Claude Code, Copilot, Windsurf, and others—build apps that run on your machine. Stakeholders cannot see that work until you share a public URL. Asyx closes that gap: install the CLI, enroll once, then tunnel whatever port your dev server uses.
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
> **Free account** — [asyx.ai/register](https://www.asyx.ai/register) (email + magic link; no invite code).
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|-------|------|
|
|
11
|
-
| Getting started | https://www.asyx.ai/docs/getting-started |
|
|
12
|
-
| Publish in 60 seconds | https://www.asyx.ai/docs/publish-local-project |
|
|
13
|
-
| Expose localhost | https://www.asyx.ai/docs/expose-localhost |
|
|
14
|
-
| AI coding agents | https://www.asyx.ai/docs/ai-agents |
|
|
15
|
-
| Cursor + Asyx | https://www.asyx.ai/docs/cursor-asyx |
|
|
16
|
-
| vs ngrok & Cloudflare | https://www.asyx.ai/docs/vs-ngrok-cloudflare |
|
|
17
|
-
| Quickpass (guest access) | https://www.asyx.ai/docs/quickpass |
|
|
9
|
+
**Full documentation:** https://www.asyx.ai/docs
|
|
18
10
|
|
|
19
11
|
---
|
|
20
12
|
|
|
21
|
-
##
|
|
13
|
+
## Publish what your agent built
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
Agent writes code → dev server starts → asyx tunnel → share HTTPS link
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Step | Who | What to do |
|
|
20
|
+
| --- | --- | --- |
|
|
21
|
+
| Account + enroll | **You** (once per machine) | `asyx setup` after [registering](https://www.asyx.ai/register) |
|
|
22
|
+
| Build / edit code | **Agent** | Implements the feature locally |
|
|
23
|
+
| Start dev server | **Agent or you** | `npm run dev`, `vite`, `flask run`, etc. |
|
|
24
|
+
| Open public URL | **Agent or you** (terminal) | `asyx tunnel --http --port <port>` |
|
|
25
|
+
| Share the link | **You** | PR comment, Slack, email, client review |
|
|
26
|
+
|
|
27
|
+
Enrollment is human-gated (browser verification) so prompts alone cannot open tunnels from an unbound machine. After `asyx setup`, your agent only needs the port and one tunnel command.
|
|
28
|
+
|
|
29
|
+
### 60-second path to a public link
|
|
30
|
+
|
|
22
31
|
```bash
|
|
23
|
-
npm install -g asyx # install
|
|
24
|
-
|
|
25
|
-
npm
|
|
32
|
+
npm install -g asyx # 1. install (Node 18.17+)
|
|
33
|
+
asyx setup # 2. enroll once — browser opens, pick your subdomain
|
|
34
|
+
npm run dev # 3. start your app (note the port, often 3000 or 5173)
|
|
35
|
+
asyx tunnel --http --port 3000 # 4. second terminal — copy the printed URL
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Share `https://yourname.tunnel.asyx.ai`. Press `Ctrl+C` in the tunnel terminal when the demo ends.
|
|
39
|
+
|
|
40
|
+
Works with React, Next.js, Vite, Flask, FastAPI, Express, static sites, local LLM UIs—anything speaking HTTP on localhost.
|
|
41
|
+
|
|
42
|
+
Prefer no global install?
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx asyx@latest tunnel --http --port 3000
|
|
26
46
|
```
|
|
27
|
-
|
|
47
|
+
|
|
48
|
+
### Copy-paste for your agent
|
|
49
|
+
|
|
50
|
+
Add this to a Cursor rule, Claude project, or task prompt:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
PUBLISHING CONTRACT — Asyx tunnel
|
|
54
|
+
|
|
55
|
+
Prerequisites (human completes once per machine):
|
|
56
|
+
- asyx CLI installed (npm install -g asyx)
|
|
57
|
+
- asyx setup completed (browser enrollment)
|
|
58
|
+
|
|
59
|
+
When a local HTTP server is running on PORT:
|
|
60
|
+
1. Run: asyx tunnel --http --port PORT
|
|
61
|
+
2. Return the https://*.tunnel.asyx.ai URL as "public_demo_url"
|
|
62
|
+
3. Do NOT read, print, or commit ~/.asyx/ or any private.pem files
|
|
63
|
+
4. Stop tunnel with Ctrl+C when the user says the demo is over
|
|
64
|
+
|
|
65
|
+
If asyx setup was never run, tell the human to run it before tunneling.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Replace `PORT` with the actual port (e.g. `3000`, `5173`, `8080`).
|
|
69
|
+
|
|
70
|
+
### Example Cursor prompt
|
|
71
|
+
|
|
72
|
+
```text
|
|
73
|
+
Implement the settings page, run the dev server on port 3000, then run
|
|
74
|
+
asyx tunnel --http --port 3000 and give me the public demo URL.
|
|
75
|
+
I already ran asyx setup on this machine.
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Can the agent run the tunnel itself?** Yes—if your IDE grants terminal access and `asyx` is installed. Many teams run the tunnel command themselves for visibility.
|
|
79
|
+
|
|
80
|
+
**More guides:** [AI agents](https://www.asyx.ai/docs/ai-agents) · [Cursor + Asyx](https://www.asyx.ai/docs/cursor-asyx) · [Agent checklist](https://www.asyx.ai/docs/ai-agent-checklist) · [Publish in 60 seconds](https://www.asyx.ai/docs/publish-local-project)
|
|
28
81
|
|
|
29
82
|
---
|
|
30
83
|
|
|
31
|
-
##
|
|
84
|
+
## Install & update
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm install -g asyx # install
|
|
88
|
+
npm update -g asyx # upgrade
|
|
89
|
+
npm uninstall -g asyx # remove
|
|
90
|
+
```
|
|
32
91
|
|
|
33
|
-
|
|
92
|
+
Node.js **18.17+** recommended.
|
|
34
93
|
|
|
35
94
|
---
|
|
36
95
|
|
|
37
|
-
##
|
|
96
|
+
## One-time device setup
|
|
97
|
+
|
|
38
98
|
```bash
|
|
39
99
|
asyx setup
|
|
40
100
|
```
|
|
41
|
-
|
|
101
|
+
|
|
102
|
+
- Opens your browser for passwordless approval; you choose `<subdomain>.tunnel.asyx.ai`.
|
|
42
103
|
- Provisions a device certificate and client ID under `~/.asyx/certs/<clientId>/`.
|
|
43
104
|
- Hardware fingerprint is hashed locally; raw attributes never leave the device.
|
|
44
|
-
-
|
|
105
|
+
- Run `asyx setup` on each host you want to trust—certificates are single-device.
|
|
45
106
|
|
|
46
107
|
---
|
|
47
108
|
|
|
48
|
-
##
|
|
49
|
-
All tunnels are loopback-only. The CLI never binds your app port; it forwards to your existing listener. Public port comes from your tenant’s 10-port block (auto-assigned unless you request one with `--external-port`).
|
|
109
|
+
## HTTP tunnels (most common)
|
|
50
110
|
|
|
51
|
-
### HTTP
|
|
52
111
|
```bash
|
|
53
112
|
asyx tunnel --http --port 3000
|
|
54
113
|
```
|
|
55
|
-
- Forwards HTTP traffic to `127.0.0.1:3000`.
|
|
56
|
-
- Forward-only proxy; automatic JWT refresh.
|
|
57
114
|
|
|
58
|
-
|
|
115
|
+
- Forwards to `127.0.0.1:3000` (loopback only).
|
|
116
|
+
- Prints your stable `https://<subdomain>.tunnel.asyx.ai` URL.
|
|
117
|
+
- TLS and JWT refresh handled automatically; your app keeps its port.
|
|
118
|
+
|
|
119
|
+
### Private demos (Quickpass)
|
|
120
|
+
|
|
121
|
+
For client-only or team-only previews—not open to the whole internet:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
asyx tunnel --http --port 3000 --secgroup reviewers
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Guests enroll via Quickpass; the relay enforces membership. See https://www.asyx.ai/docs/quickpass
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Other tunnel types
|
|
132
|
+
|
|
133
|
+
All tunnels are loopback-only. The CLI forwards to your existing listener—it never binds your app port.
|
|
134
|
+
|
|
135
|
+
**TCP** — databases, SSH, games:
|
|
136
|
+
|
|
59
137
|
```bash
|
|
60
138
|
asyx tunnel --tcp --port <targetPort> [--name <alias>] [--external-port <publicPort>]
|
|
61
139
|
```
|
|
62
|
-
- For raw TCP services (databases, SSH, games).
|
|
63
|
-
- `--port`: local app port on loopback.
|
|
64
|
-
- `--name` (optional): CNAME alias `<name>.<subdomain>.tunnel.asyx.ai`; otherwise use `fqdn:publicPort`.
|
|
65
|
-
- `--external-port` (optional): must be inside your tenant block; otherwise rejected.
|
|
66
|
-
- Uses tcpWs transport; guests connect with native TCP on the public port.
|
|
67
140
|
|
|
68
|
-
|
|
141
|
+
**UDP** — games, realtime apps:
|
|
142
|
+
|
|
69
143
|
```bash
|
|
70
144
|
asyx tunnel --udp --port <targetPort> [--external-port <publicPort>]
|
|
71
145
|
```
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
- CLI uses an **ephemeral** socket; it never claims your service port. Forwards to your app.
|
|
76
|
-
- Loopback-only is enforced by CLI and relay.
|
|
77
|
-
- Uses udpWs transport; guests send native UDP to the public port.
|
|
78
|
-
|
|
79
|
-
### Minecraft (shortcut)
|
|
146
|
+
|
|
147
|
+
**Minecraft** — shortcut with SRV record (players use hostname only):
|
|
148
|
+
|
|
80
149
|
```bash
|
|
81
|
-
asyx tunnel --minecraft [--port
|
|
150
|
+
asyx tunnel --minecraft [--port 25565] [--name <alias>]
|
|
82
151
|
```
|
|
83
|
-
- One command to share a Minecraft server (defaults to 25565).
|
|
84
|
-
- SRV record created so players use the hostname only (no port needed).
|
|
85
152
|
|
|
86
|
-
After a tunnel opens, the CLI prints
|
|
87
|
-
- `fqdn` and `fqdn:publicPort` for guests.
|
|
88
|
-
- Target shown as `tcp://127.0.0.1:<port>` or `udp://127.0.0.1:<port>` so you know your app keeps the port.
|
|
153
|
+
After a tunnel opens, the CLI prints the public `fqdn` (and port for TCP/UDP) plus the local target (`tcp://127.0.0.1:<port>` or `udp://127.0.0.1:<port>`).
|
|
89
154
|
|
|
90
155
|
---
|
|
91
156
|
|
|
92
|
-
##
|
|
157
|
+
## Command quick reference
|
|
158
|
+
|
|
93
159
|
```bash
|
|
94
|
-
asyx setup
|
|
95
|
-
asyx tunnel --http --port <n>
|
|
160
|
+
asyx setup
|
|
161
|
+
asyx tunnel --http --port <n> [--secgroup <slug>]
|
|
96
162
|
asyx tunnel --tcp --port <n> [--name <alias>] [--external-port <p>]
|
|
97
163
|
asyx tunnel --udp --port <n> [--external-port <p>]
|
|
98
164
|
asyx tunnel --minecraft [--port <n>] [--name <alias>]
|
|
99
165
|
```
|
|
100
|
-
- Targets are loopback-only; non-loopback hosts are rejected.
|
|
101
|
-
- `--external-port` must be inside your assigned block; omit to auto-assign blockStart.
|
|
102
166
|
|
|
103
167
|
---
|
|
104
168
|
|
|
105
|
-
##
|
|
106
|
-
|
|
107
|
-
- **
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### Quickpass (HTTP guest access control)
|
|
113
|
-
- Passwordless guest access: invite guests into a **security group** and run `asyx tunnel --http --port <n> --secgroup <slug>`.
|
|
114
|
-
- Relay-enforced: guests must present a valid Quickpass cookie; unauthorized requests are rejected at the relay (no app changes).
|
|
115
|
-
- Perfect for sharing dashboards/dev tools without opening them publicly; no VPN, no basic auth.
|
|
116
|
-
- Zero extra infra: no DNS edits, no reverse proxies; the relay does the policy check.
|
|
117
|
-
- Coming extensions: the same flow will back future sharing for TCP/UDP when per-guest auth is added.
|
|
118
|
-
- TCP/UDP today remain owner-only via JWT (no per-guest auth in v4.1).
|
|
169
|
+
## What's new in 0.5.x
|
|
170
|
+
|
|
171
|
+
**Tunnel-only CLI (0.5.0)** — npm ships tunnel commands only: `setup`, `mqtt`, and `tunnel`. Focused on secure localhost exposure (HTTP, TCP, UDP). Docs at https://www.asyx.ai/docs
|
|
172
|
+
|
|
173
|
+
**Reliable global install (0.5.2)** — `asyx setup` uses Node's built-in Web Crypto. `npm install -g asyx` works on Node 18+ without module-resolution errors.
|
|
174
|
+
|
|
175
|
+
**Earlier (0.4.0)** — HTTP tunnels auto-switch to streaming transport for large responses (8 MiB+), so big downloads do not hit memory limits.
|
|
119
176
|
|
|
120
177
|
---
|
|
121
178
|
|
|
122
|
-
##
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
179
|
+
## Documentation
|
|
180
|
+
|
|
181
|
+
| Guide | Link |
|
|
182
|
+
| --- | --- |
|
|
183
|
+
| Getting started | https://www.asyx.ai/docs/getting-started |
|
|
184
|
+
| Publish in 60 seconds | https://www.asyx.ai/docs/publish-local-project |
|
|
185
|
+
| AI coding agents | https://www.asyx.ai/docs/ai-agents |
|
|
186
|
+
| Cursor + Asyx | https://www.asyx.ai/docs/cursor-asyx |
|
|
187
|
+
| Agent checklist | https://www.asyx.ai/docs/ai-agent-checklist |
|
|
188
|
+
| Expose localhost | https://www.asyx.ai/docs/expose-localhost |
|
|
189
|
+
| Quickpass (guest access) | https://www.asyx.ai/docs/quickpass |
|
|
190
|
+
| vs ngrok & Cloudflare | https://www.asyx.ai/docs/vs-ngrok-cloudflare |
|
|
128
191
|
|
|
129
192
|
---
|
|
130
193
|
|
|
131
|
-
##
|
|
132
|
-
|
|
133
|
-
-
|
|
134
|
-
-
|
|
135
|
-
-
|
|
136
|
-
-
|
|
194
|
+
## Agent workflow safety
|
|
195
|
+
|
|
196
|
+
- **Never** paste device certificates or private keys into chat or git.
|
|
197
|
+
- **Do not** tunnel database admin ports without authentication.
|
|
198
|
+
- **Stop** the tunnel when the demo ends (`Ctrl+C`).
|
|
199
|
+
- Treat the public URL as a temporary preview—not a production deploy.
|
|
200
|
+
- Agents **cannot** enroll a device (`asyx setup` requires browser verification) or open tunnels from a machine that has not been set up.
|
|
137
201
|
|
|
138
202
|
---
|
|
139
203
|
|
|
140
|
-
##
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
- **Observability-first UX**: Clear errors, deterministic exits, optional debug traces.
|
|
148
|
-
- **Future-ready auth**: Today’s magic-link flow extends to sharing via Asyx Quickpass (passwordless downstream approvals).
|
|
204
|
+
## Logging
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
ASYX_LOG_LEVEL=debug asyx tunnel --http --port 3000
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Levels: `error` | `warn` | `info` | `debug` (default `info`).
|
|
149
211
|
|
|
150
212
|
---
|
|
151
213
|
|
|
152
|
-
##
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
214
|
+
## Troubleshooting
|
|
215
|
+
|
|
216
|
+
| Issue | Fix |
|
|
217
|
+
| --- | --- |
|
|
218
|
+
| `asyx: command not found` | `npm install -g asyx` or `npx asyx@latest` |
|
|
219
|
+
| Setup browser did not open | Run `asyx setup` again; open the printed URL manually |
|
|
220
|
+
| Tunnel URL 502 / unreachable | Dev server not running on the same port |
|
|
221
|
+
| Link dies overnight | Expected—tunnel stops when CLI exits or machine sleeps |
|
|
222
|
+
| External port rejected | `--external-port` must be inside your assigned 10-port block |
|
|
223
|
+
| Windows MQTT handshake issues | Re-run `asyx setup` to regenerate keys (PKCS#1) |
|
|
157
224
|
|
|
158
225
|
---
|
|
159
226
|
|
|
160
|
-
##
|
|
227
|
+
## Security
|
|
228
|
+
|
|
161
229
|
- Device-bound identity per host; hardware fingerprint hashed locally.
|
|
162
230
|
- Mutual TLS to control plane; RS256 JWTs validated via JWKS.
|
|
163
|
-
- Forward-only proxy
|
|
164
|
-
- Report issues: [security@asyx.ai](mailto:security@asyx.ai)
|
|
231
|
+
- Forward-only proxy—your app stays isolated; no direct inbound to your host.
|
|
232
|
+
- Report issues: [security@asyx.ai](mailto:security@asyx.ai)
|
|
165
233
|
|
|
166
234
|
---
|
|
167
235
|
|
|
168
|
-
##
|
|
236
|
+
## License
|
|
237
|
+
|
|
169
238
|
[Apache-2.0](./LICENSE)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asyx",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.4",
|
|
4
4
|
"description": "Asyx tunnel CLI — secure localhost exposure (HTTP, TCP, UDP)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -69,7 +69,6 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@asyx/mqtt-broker-aws": "^0.1.0",
|
|
71
71
|
"@asyx/mqtt-client": "^0.1.0",
|
|
72
|
-
"@peculiar/webcrypto": "^1.5.0",
|
|
73
72
|
"@peculiar/x509": "^1.14.0",
|
|
74
73
|
"chalk": "^5.3.0",
|
|
75
74
|
"hw-fingerprint": "^3.2.0",
|
package/src/lib/csr.js
CHANGED
|
@@ -2,11 +2,10 @@ import fs from 'node:fs/promises';
|
|
|
2
2
|
import fssync from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
5
|
-
import nodeCrypto from 'node:crypto';
|
|
6
|
-
import PeculiarWebCrypto from '@peculiar/webcrypto';
|
|
5
|
+
import nodeCrypto, { webcrypto } from 'node:crypto';
|
|
7
6
|
import { cryptoProvider, Pkcs10CertificateRequestGenerator } from '@peculiar/x509';
|
|
8
7
|
|
|
9
|
-
const crypto =
|
|
8
|
+
const crypto = webcrypto;
|
|
10
9
|
cryptoProvider.set(crypto); // Set provider before using generator
|
|
11
10
|
|
|
12
11
|
/**
|