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