@xkwdstore/agent 2.0.1 → 2.0.3

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 CHANGED
@@ -1,245 +1,252 @@
1
- # @xkwdstore/agent
2
-
3
- Terminal-only, cryptographically authenticated CLI for XKWDStore browser automation.
4
-
5
- ## Installation — staged Protocol-v2 release
6
-
7
- > **Staged release notice**
8
- >
9
- > Protocol-v2 installer prepared for Agent 2.0.1. Public installation becomes
10
- > active after `@xkwdstore/agent@2.0.1` is published to npm. Until the
11
- > package is published, version 2.0.1 is **not usable** through the public
12
- > installer; the pinned `npx` command below will fail on a clean machine.
13
-
14
- Once the package is published, end users install with a one-line PowerShell
15
- command that creates a desktop launcher pinned to this version:
16
-
17
- ```powershell
18
- irm https://raw.githubusercontent.com/EssaGhazwani/TW-manager-install/main/install.ps1 | iex
19
- ```
20
-
21
- The generated launcher runs the pinned future command:
22
-
23
- ```powershell
24
- npx --yes @xkwdstore/agent@2.0.1 start
25
- ```
26
-
27
- Automated installer tests use `-NoLaunch` or a mocked `npx` command so the
28
- real pinned package is never executed from the public registry during
29
- installation validation.
30
-
31
- ## Platform Support
32
-
33
- | Platform | Status |
34
- |----------|--------|
35
- | **Windows** | Implementation present. ACL hardening awaits real Windows runner CI. |
36
- | **Linux (with Secret Service / libsecret)** | Implementation present. Pending platform verification on CI. |
37
- | **macOS** | **Unsupported.** Fails closed with an explicit error. No macOS Keychain integration is implemented. |
38
-
39
- ## Requirements
40
-
41
- - **Node.js 22 or later** — check with `node --version`
42
- - **Google Chrome** installed on your computer
43
- - A terminal (PowerShell, Windows Terminal, or Linux shell)
44
- - **Linux**: `gnome-keyring` or `seahorse` (provides `libsecret` / `secret-tool`)
45
-
46
- ## First Run
47
-
48
- On first run, the agent will:
49
-
50
- 1. Generate an Ed25519 key pair locally on your computer.
51
- 2. Open your browser to x.kwdstore.com for authorization.
52
- 3. Wait for you to sign in and approve the computer.
53
- 4. Connect securely after approval.
54
-
55
- **No pairing code. No email prompt. No API key. No download. No installer.**
56
-
57
- The private key is stored using your operating system's secure credential storage:
58
- - **Windows**: DPAPI (current-user scope) — pending ACL hardening CI verification
59
- - **Linux**: Secret Service / libsecret
60
- - **macOS**: Not supported — fails with an explicit error
61
-
62
- The private key **never leaves your computer**, never appears in logs, and never
63
- appears in command-line arguments.
64
-
65
- ## Subsequent Runs
66
-
67
- After first authorization, the agent connects automatically.
68
-
69
- No browser approval is needed unless:
70
- - The device key was deleted
71
- - The device was revoked from the dashboard
72
- - Secure storage was reset
73
- - The server no longer recognizes the public key
74
-
75
- ## Commands
76
-
77
- | Command | Description |
78
- |---------|-------------|
79
- | `start` | Start the agent (connect, run browser sessions) |
80
- | `status` | Show device and connection status |
81
- | `logout` | Delete local device identity (requires re-authorization) |
82
- | `revoke-local` | Delete local device identity and credentials |
83
- | `doctor` | Run diagnostic checks |
84
- | `version` | Print version information |
85
- | `help` | Show help |
86
-
87
- ### Options
88
-
89
- - `--server=<url>` — Server URL (default: `https://x.kwdstore.com`)
90
- - `--replace` — Replace a running instance (safe takeover)
91
-
92
- ## Stopping the Agent
93
-
94
- Press **Ctrl+C** in the terminal. The agent closes all browser sessions and
95
- disconnects cleanly. No background process remains.
96
-
97
- ## Data Storage
98
-
99
- The agent stores runtime data in your operating system's standard application-data
100
- directory:
101
-
102
- | Platform | Location |
103
- |----------|----------|
104
- | Windows | `%LOCALAPPDATA%\XKWDStore\` |
105
- | Linux | `${XDG_DATA_HOME:-~/.local/share}/xkwdstore/` |
106
-
107
- This directory contains:
108
- - Chrome profiles (persistent cookies and browser storage)
109
- - Bounded logs (no cookies, tokens, private keys, or secrets)
110
- - Non-secret device metadata (deviceId, publicKey, fingerprint)
111
- - Temporary runtime files
112
-
113
- **Nothing is written to Desktop, Documents, Downloads, or OneDrive.**
114
-
115
- ## Security
116
-
117
- ### Device Identity
118
-
119
- The device identity is an **Ed25519 key pair** generated locally. The server
120
- authenticates the computer by verifying signatures made by the private key.
121
- Hardware attributes (hostname, OS, architecture) are collected for display and
122
- anomaly detection only — they are **not** authentication credentials.
123
-
124
- ### WebSocket Authentication
125
-
126
- Every WebSocket connection uses **Ed25519 challenge-response**:
127
- 1. Server sends a challenge with a random nonce.
128
- 2. Client signs the challenge with its private key.
129
- 3. Server verifies the signature against the registered public key.
130
-
131
- No HTTP credential exchange. No in-memory ticket. No bearer token in the URL.
132
-
133
- ### Revocation
134
-
135
- A device can be revoked from the dashboard. Revocation immediately prevents all
136
- future challenge-response authentication. Active connections are closed when
137
- the server processes the revocation event — this requires the
138
- `protocolV2Revocation` integration test to pass.
139
-
140
- ### Windows Private Key Storage
141
-
142
- 1. Key is DPAPI-protected through stdin.
143
- 2. Encrypted envelope is written to disk.
144
- 3. A restricted DACL is applied via PowerShell.
145
- 4. ACL application is verified (not best-effort): the write **fails** if the
146
- ACL cannot be applied or verified.
147
-
148
- **Status**: Implementation present. ACL fail-closed tests require a real
149
- Windows runner (pending CI billing restoration).
150
-
151
- ## What This Agent Does NOT Do
152
-
153
- - ❌ Download or install a browser (uses your system Chrome)
154
- - ❌ Run a self-updater (you pin the version in the command)
155
- - ❌ Poll GitHub for manifests
156
- - ❌ Require a pairing code
157
- - ❌ Require an email in the terminal
158
- - ❌ Keep a tray application running
159
- - ❌ Install a Windows service
160
- - ❌ Create a Scheduled Task
161
- - ❌ Write to Desktop, Documents, Downloads, or OneDrive
162
- - ❌ Store private keys in plaintext
163
- - ❌ Use `curl | sh` or `Invoke-WebRequest | Invoke-Expression`
164
- - ❌ Support macOS (fails closed)
165
-
166
- ## Version Management
167
-
168
- The agent does NOT update itself. To use a newer version, change the version
169
- number in the command. The pinned future command for this release is:
170
-
171
- ```powershell
172
- npx --yes @xkwdstore/agent@2.0.1 start
173
- ```
174
-
175
- > Version 2.0.1 is not usable through the public installer until it is
176
- > published to npm.
177
-
178
- The server checks compatibility at startup and displays a clear message if the
179
- agent version is no longer supported.
180
-
181
- ## Privacy
182
-
183
- The agent collects and sends the following non-secret information to the server:
184
- - Hostname (for display)
185
- - Operating system and version
186
- - CPU architecture
187
- - Current OS username
188
- - Chrome version
189
- - A locally-salted hash of machine identifiers (for anomaly detection, not
190
- authentication)
191
-
192
- The agent does **not** send:
193
- - Raw motherboard serial numbers
194
- - Raw disk serial numbers
195
- - Raw machine GUIDs
196
- - Private keys
197
- - Cookies or browser storage
198
- - Passwords or tokens
199
-
200
- ## Troubleshooting
201
-
202
- Run `xkwd-agent doctor` to check:
203
- - Node.js version
204
- - Chrome installation
205
- - Secure storage availability
206
- - Data directory
207
- - Device enrollment status
208
- - Server connectivity
209
-
210
- ### Chrome Not Found
211
-
212
- ```
213
- Google Chrome was not found.
214
- Install Chrome and run the command again.
215
- No browser was downloaded or installed automatically.
216
- ```
217
-
218
- Install Google Chrome from https://www.google.com/chrome/ and run the command again.
219
-
220
- ### Secure Storage Unavailable (Linux)
221
-
222
- ```
223
- Secure key storage is unavailable on this system.
224
- ```
225
-
226
- Install `gnome-keyring` or `seahorse` (provides `libsecret` / `secret-tool`).
227
-
228
- ### macOS Not Supported
229
-
230
- ```
231
- macOS is not supported. The agent fails closed on macOS.
232
- ```
233
-
234
- The agent does not implement macOS Keychain integration. Use a Linux or Windows computer.
235
-
236
- ### Already Running
237
-
238
- ```
239
- XKWDStore Agent is already running on this computer.
240
- PID: ...
241
- Started: ...
242
- Device: ...
243
- ```
244
-
1
+ # @xkwdstore/agent
2
+
3
+ Terminal-only, cryptographically authenticated CLI for XKWDStore browser automation.
4
+
5
+ ## Installation
6
+
7
+ > **@xkwdstore/agent 2.0.2 is now publicly available on npm.**
8
+ >
9
+ > Version 2.0.2 (Protocol-v2 Windows browser-launch fix) is the current
10
+ > published version on the official npm registry.
11
+
12
+ End users install by downloading the installer file first, then running it
13
+ (the installer explicitly forbids piping a remote script directly into
14
+ execution). This creates a desktop launcher pinned to this version:
15
+
16
+ ```powershell
17
+ $installer = "$env:TEMP\xkwdstore-install.ps1"
18
+ Invoke-WebRequest -Uri "https://raw.githubusercontent.com/EssaGhazwani/TW-manager-install/main/install.ps1" -OutFile $installer
19
+ powershell.exe -NoProfile -ExecutionPolicy Bypass -File $installer
20
+ ```
21
+
22
+ Or, from CMD:
23
+
24
+ ```cmd
25
+ curl -L -o "%TEMP%\xkwdstore-install.ps1" https://raw.githubusercontent.com/EssaGhazwani/TW-manager-install/main/install.ps1 && powershell -NoProfile -ExecutionPolicy Bypass -File "%TEMP%\xkwdstore-install.ps1"
26
+ ```
27
+
28
+ The generated launcher runs the pinned command:
29
+
30
+ ```powershell
31
+ npx --yes @xkwdstore/agent@2.0.2 start
32
+ ```
33
+
34
+ Automated installer tests use `-NoLaunch` or a mocked `npx` command so the
35
+ real pinned package is never executed from the public registry during
36
+ installation validation.
37
+
38
+ ## Platform Support
39
+
40
+ | Platform | Status |
41
+ |----------|--------|
42
+ | **Windows** | Implementation present. ACL hardening awaits real Windows runner CI. |
43
+ | **Linux (with Secret Service / libsecret)** | Implementation present. Pending platform verification on CI. |
44
+ | **macOS** | **Unsupported.** Fails closed with an explicit error. No macOS Keychain integration is implemented. |
45
+
46
+ ## Requirements
47
+
48
+ - **Node.js 22 or later** — check with `node --version`
49
+ - **Google Chrome** installed on your computer
50
+ - A terminal (PowerShell, Windows Terminal, or Linux shell)
51
+ - **Linux**: `gnome-keyring` or `seahorse` (provides `libsecret` / `secret-tool`)
52
+
53
+ ## First Run
54
+
55
+ On first run, the agent will:
56
+
57
+ 1. Generate an Ed25519 key pair locally on your computer.
58
+ 2. Open your browser to x.kwdstore.com for authorization.
59
+ 3. Wait for you to sign in and approve the computer.
60
+ 4. Connect securely after approval.
61
+
62
+ **No pairing code. No email prompt. No API key. No download. No installer.**
63
+
64
+ The private key is stored using your operating system's secure credential storage:
65
+ - **Windows**: DPAPI (current-user scope) — pending ACL hardening CI verification
66
+ - **Linux**: Secret Service / libsecret
67
+ - **macOS**: Not supported — fails with an explicit error
68
+
69
+ The private key **never leaves your computer**, never appears in logs, and never
70
+ appears in command-line arguments.
71
+
72
+ ## Subsequent Runs
73
+
74
+ After first authorization, the agent connects automatically.
75
+
76
+ No browser approval is needed unless:
77
+ - The device key was deleted
78
+ - The device was revoked from the dashboard
79
+ - Secure storage was reset
80
+ - The server no longer recognizes the public key
81
+
82
+ ## Commands
83
+
84
+ | Command | Description |
85
+ |---------|-------------|
86
+ | `start` | Start the agent (connect, run browser sessions) |
87
+ | `status` | Show device and connection status |
88
+ | `logout` | Delete local device identity (requires re-authorization) |
89
+ | `revoke-local` | Delete local device identity and credentials |
90
+ | `doctor` | Run diagnostic checks |
91
+ | `version` | Print version information |
92
+ | `help` | Show help |
93
+
94
+ ### Options
95
+
96
+ - `--server=<url>` — Server URL (default: `https://x.kwdstore.com`)
97
+ - `--replace` — Replace a running instance (safe takeover)
98
+
99
+ ## Stopping the Agent
100
+
101
+ Press **Ctrl+C** in the terminal. The agent closes all browser sessions and
102
+ disconnects cleanly. No background process remains.
103
+
104
+ ## Data Storage
105
+
106
+ The agent stores runtime data in your operating system's standard application-data
107
+ directory:
108
+
109
+ | Platform | Location |
110
+ |----------|----------|
111
+ | Windows | `%LOCALAPPDATA%\XKWDStore\` |
112
+ | Linux | `${XDG_DATA_HOME:-~/.local/share}/xkwdstore/` |
113
+
114
+ This directory contains:
115
+ - Chrome profiles (persistent cookies and browser storage)
116
+ - Bounded logs (no cookies, tokens, private keys, or secrets)
117
+ - Non-secret device metadata (deviceId, publicKey, fingerprint)
118
+ - Temporary runtime files
119
+
120
+ **Nothing is written to Desktop, Documents, Downloads, or OneDrive.**
121
+
122
+ ## Security
123
+
124
+ ### Device Identity
125
+
126
+ The device identity is an **Ed25519 key pair** generated locally. The server
127
+ authenticates the computer by verifying signatures made by the private key.
128
+ Hardware attributes (hostname, OS, architecture) are collected for display and
129
+ anomaly detection only — they are **not** authentication credentials.
130
+
131
+ ### WebSocket Authentication
132
+
133
+ Every WebSocket connection uses **Ed25519 challenge-response**:
134
+ 1. Server sends a challenge with a random nonce.
135
+ 2. Client signs the challenge with its private key.
136
+ 3. Server verifies the signature against the registered public key.
137
+
138
+ No HTTP credential exchange. No in-memory ticket. No bearer token in the URL.
139
+
140
+ ### Revocation
141
+
142
+ A device can be revoked from the dashboard. Revocation immediately prevents all
143
+ future challenge-response authentication. Active connections are closed when
144
+ the server processes the revocation event — this requires the
145
+ `protocolV2Revocation` integration test to pass.
146
+
147
+ ### Windows Private Key Storage
148
+
149
+ 1. Key is DPAPI-protected through stdin.
150
+ 2. Encrypted envelope is written to disk.
151
+ 3. A restricted DACL is applied via PowerShell.
152
+ 4. ACL application is verified (not best-effort): the write **fails** if the
153
+ ACL cannot be applied or verified.
154
+
155
+ **Status**: Implementation present. ACL fail-closed tests require a real
156
+ Windows runner (pending CI billing restoration).
157
+
158
+ ## What This Agent Does NOT Do
159
+
160
+ - ❌ Download or install a browser (uses your system Chrome)
161
+ - ❌ Run a self-updater (you pin the version in the command)
162
+ - ❌ Poll GitHub for manifests
163
+ - ❌ Require a pairing code
164
+ - ❌ Require an email in the terminal
165
+ - ❌ Keep a tray application running
166
+ - ❌ Install a Windows service
167
+ - ❌ Create a Scheduled Task
168
+ - ❌ Write to Desktop, Documents, Downloads, or OneDrive
169
+ - ❌ Store private keys in plaintext
170
+ - ❌ Use `curl | sh` or `Invoke-WebRequest | Invoke-Expression`
171
+ - ❌ Support macOS (fails closed)
172
+
173
+ ## Version Management
174
+
175
+ The agent does NOT update itself. To use a newer version, change the version
176
+ number in the command. The pinned future command for this release is:
177
+
178
+ ```powershell
179
+ npx --yes @xkwdstore/agent@2.0.2 start
180
+ ```
181
+
182
+ > Version 2.0.2 is the current published version. Version 2.0.1 was the
183
+ > previous release. The pinned command reflects the latest published version.
184
+ >
185
+ > The server checks compatibility at startup and displays a clear message if
186
+ > the agent version is no longer supported.
187
+
188
+ ## Privacy
189
+
190
+ The agent collects and sends the following non-secret information to the server:
191
+ - Hostname (for display)
192
+ - Operating system and version
193
+ - CPU architecture
194
+ - Current OS username
195
+ - Chrome version
196
+ - A locally-salted hash of machine identifiers (for anomaly detection, not
197
+ authentication)
198
+
199
+ The agent does **not** send:
200
+ - Raw motherboard serial numbers
201
+ - Raw disk serial numbers
202
+ - Raw machine GUIDs
203
+ - Private keys
204
+ - Cookies or browser storage
205
+ - Passwords or tokens
206
+
207
+ ## Troubleshooting
208
+
209
+ Run `xkwd-agent doctor` to check:
210
+ - Node.js version
211
+ - Chrome installation
212
+ - Secure storage availability
213
+ - Data directory
214
+ - Device enrollment status
215
+ - Server connectivity
216
+
217
+ ### Chrome Not Found
218
+
219
+ ```
220
+ Google Chrome was not found.
221
+ Install Chrome and run the command again.
222
+ No browser was downloaded or installed automatically.
223
+ ```
224
+
225
+ Install Google Chrome from https://www.google.com/chrome/ and run the command again.
226
+
227
+ ### Secure Storage Unavailable (Linux)
228
+
229
+ ```
230
+ Secure key storage is unavailable on this system.
231
+ ```
232
+
233
+ Install `gnome-keyring` or `seahorse` (provides `libsecret` / `secret-tool`).
234
+
235
+ ### macOS Not Supported
236
+
237
+ ```
238
+ macOS is not supported. The agent fails closed on macOS.
239
+ ```
240
+
241
+ The agent does not implement macOS Keychain integration. Use a Linux or Windows computer.
242
+
243
+ ### Already Running
244
+
245
+ ```
246
+ XKWDStore Agent is already running on this computer.
247
+ PID: ...
248
+ Started: ...
249
+ Device: ...
250
+ ```
251
+
245
252
  Use `xkwd-agent start --replace` to safely replace the running instance.
package/package.json CHANGED
@@ -1,55 +1,55 @@
1
- {
2
- "name": "@xkwdstore/agent",
3
- "version": "2.0.1",
4
- "description": "XKWDStore Agent — terminal-only, cryptographically authenticated CLI for browser automation",
5
- "main": "src/cli.js",
6
- "bin": {
7
- "xkwd-agent": "src/cli.js"
8
- },
9
- "scripts": {
10
- "start": "node src/cli.js start",
11
- "dev": "node src/cli.js start",
12
- "test": "node --test tests/*.test.js",
13
- "build": "echo 'No build step — this is a pure npm CLI package'"
14
- },
15
- "engines": {
16
- "node": ">=22.0.0"
17
- },
18
- "files": [
19
- "src/cli.js",
20
- "src/deviceKeyStore.js",
21
- "src/chromeDetector.js",
22
- "src/enrollmentClient.js",
23
- "src/processLock.js",
24
- "src/wsClient.js",
25
- "src/challengeCodec.js",
26
- "src/sessionHandler.js",
27
- "src/fingerprint.js",
28
- "src/fingerprintStore.js",
29
- "src/profilePath.js",
30
- "src/stealth.js",
31
- "src/leaseClient.js",
32
- "src/proxyEgress.js",
33
- "src/proxyPolicy.js",
34
- "src/configStore.js",
35
- "src/secretStore.js",
36
- "src/actions/",
37
- "README.md",
38
- "LICENSE"
39
- ],
40
- "dependencies": {
41
- "otpauth": "^9.3.0",
42
- "playwright-core": "^1.58.2",
43
- "ws": "^8.19.0"
44
- },
45
- "repository": {
46
- "type": "git",
47
- "url": "git+https://github.com/EssaGhazwani/TW-manager.git",
48
- "directory": "apps/local-agent"
49
- },
50
- "license": "UNLICENSED",
51
- "private": false,
52
- "publishConfig": {
53
- "access": "public"
54
- }
1
+ {
2
+ "name": "@xkwdstore/agent",
3
+ "version": "2.0.3",
4
+ "description": "XKWDStore Agent — terminal-only, cryptographically authenticated CLI for browser automation",
5
+ "main": "src/cli.js",
6
+ "bin": {
7
+ "xkwd-agent": "src/cli.js"
8
+ },
9
+ "scripts": {
10
+ "start": "node src/cli.js start",
11
+ "dev": "node src/cli.js start",
12
+ "test": "node --test tests/*.test.js",
13
+ "build": "echo 'No build step — this is a pure npm CLI package'"
14
+ },
15
+ "engines": {
16
+ "node": ">=22.0.0"
17
+ },
18
+ "files": [
19
+ "src/cli.js",
20
+ "src/deviceKeyStore.js",
21
+ "src/chromeDetector.js",
22
+ "src/enrollmentClient.js",
23
+ "src/processLock.js",
24
+ "src/wsClient.js",
25
+ "src/challengeCodec.js",
26
+ "src/sessionHandler.js",
27
+ "src/fingerprint.js",
28
+ "src/fingerprintStore.js",
29
+ "src/profilePath.js",
30
+ "src/stealth.js",
31
+ "src/leaseClient.js",
32
+ "src/proxyEgress.js",
33
+ "src/proxyPolicy.js",
34
+ "src/configStore.js",
35
+ "src/secretStore.js",
36
+ "src/actions/",
37
+ "README.md",
38
+ "LICENSE"
39
+ ],
40
+ "dependencies": {
41
+ "otpauth": "^9.3.0",
42
+ "playwright-core": "^1.58.2",
43
+ "ws": "^8.19.0"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/EssaGhazwani/TW-manager.git",
48
+ "directory": "apps/local-agent"
49
+ },
50
+ "license": "UNLICENSED",
51
+ "private": false,
52
+ "publishConfig": {
53
+ "access": "public"
54
+ }
55
55
  }