@lifeaitools/clauth 0.4.0 → 0.5.0
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/.clauth-skill/SKILL.md +184 -184
- package/.clauth-skill/references/keys-guide.md +270 -270
- package/.clauth-skill/references/operator-guide.md +148 -148
- package/README.md +125 -125
- package/cli/api.js +113 -113
- package/cli/commands/install.js +291 -265
- package/cli/commands/scrub.js +231 -231
- package/cli/commands/serve.js +511 -1
- package/cli/commands/uninstall.js +164 -164
- package/cli/fingerprint.js +91 -91
- package/cli/index.js +5 -1
- package/install.ps1 +44 -44
- package/install.sh +38 -38
- package/package.json +54 -54
- package/scripts/bin/bootstrap-linux +0 -0
- package/scripts/bin/bootstrap-macos +0 -0
- package/scripts/bootstrap.cjs +43 -43
- package/scripts/build.sh +45 -45
- package/supabase/functions/auth-vault/index.ts +235 -235
- package/supabase/migrations/001_clauth_schema.sql +103 -103
- package/supabase/migrations/002_vault_helpers.sql +90 -90
- package/supabase/migrations/20260317_lockout.sql +26 -26
package/.clauth-skill/SKILL.md
CHANGED
|
@@ -1,184 +1,184 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: clauth
|
|
3
|
-
description: Install, configure, and operate clauth — the LIFEAI hardware-bound credential vault. Triggers on "install clauth", "set up my keys", "clauth install", "store my credentials", "set up the vault", or any mention of clauth or managing LIFEAI service credentials. When triggered for install, check GitHub MCP first, clone LIFEAI/clauth, and run the installer. Also handles ongoing clauth commands: status, get, write, enable, disable, add service, revoke.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# clauth — LIFEAI Credential Vault
|
|
7
|
-
|
|
8
|
-
Hardware-bound credential vault for the LIFEAI stack. Your machine is the second factor. Keys live in Supabase Vault (AES-256).
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
## How Claude Interfaces with clauth
|
|
13
|
-
|
|
14
|
-
> **CRITICAL:** Never pipe input to clauth or use interactive prompts. The CLI uses `inquirer` which produces ANSI garbage when stdin is piped. Always use one of the two methods below.
|
|
15
|
-
|
|
16
|
-
### Method 1 — CLI with `--pw` flag (simplest)
|
|
17
|
-
|
|
18
|
-
All clauth commands accept `-p` / `--pw <password>` to skip the interactive password prompt:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
clauth status -p "YourPassword"
|
|
22
|
-
clauth get github -p "YourPassword"
|
|
23
|
-
clauth test -p "YourPassword"
|
|
24
|
-
clauth enable github -p "YourPassword"
|
|
25
|
-
clauth write key github -p "YourPassword" # still prompts for the key value
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### Method 2 — Direct API calls (full control, no CLI needed)
|
|
29
|
-
|
|
30
|
-
Call the auth-vault Edge Function directly. This is the most reliable method for Claude.
|
|
31
|
-
|
|
32
|
-
**Base URL:** `https://<project-ref>.supabase.co/functions/v1/auth-vault`
|
|
33
|
-
**Auth header:** `Authorization: Bearer <supabase-anon-key>`
|
|
34
|
-
**Method:** POST (all routes)
|
|
35
|
-
**Content-Type:** `application/json`
|
|
36
|
-
|
|
37
|
-
#### HMAC Token Derivation (must match server)
|
|
38
|
-
|
|
39
|
-
```js
|
|
40
|
-
import { createHmac, createHash, execSync } from "crypto";
|
|
41
|
-
|
|
42
|
-
// 1. Get machine hash (same as fingerprint.js)
|
|
43
|
-
// Windows:
|
|
44
|
-
const uuid = execSync("wmic csproduct get uuid /format:value", { encoding: "utf8" })
|
|
45
|
-
.match(/UUID=([A-F0-9-]+)/i)?.[1]?.trim();
|
|
46
|
-
const machineGuid = execSync(
|
|
47
|
-
"reg query HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",
|
|
48
|
-
{ encoding: "utf8" }
|
|
49
|
-
).match(/MachineGuid\s+REG_SZ\s+([a-f0-9-]+)/i)?.[1]?.trim();
|
|
50
|
-
const machineHash = createHash("sha256").update(`${uuid}:${machineGuid}`).digest("hex");
|
|
51
|
-
|
|
52
|
-
// 2. Derive HMAC token
|
|
53
|
-
const windowMs = 5 * 60 * 1000;
|
|
54
|
-
const window = Math.floor(Date.now() / windowMs);
|
|
55
|
-
const message = `${machineHash}:${window}`;
|
|
56
|
-
const token = createHmac("sha256", password).update(message).digest("hex");
|
|
57
|
-
const timestamp = window * windowMs;
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
#### API Routes
|
|
61
|
-
|
|
62
|
-
| Route | Body fields | Returns |
|
|
63
|
-
|-------|-------------|---------|
|
|
64
|
-
| `POST /status` | `machine_hash, token, timestamp, password` | `{ services: [...] }` |
|
|
65
|
-
| `POST /test` | `machine_hash, token, timestamp, password` | `{ ok: true }` |
|
|
66
|
-
| `POST /retrieve` | `+ service` | `{ value: "..." }` |
|
|
67
|
-
| `POST /write` | `+ service, value` | `{ ok: true }` |
|
|
68
|
-
| `POST /enable` | `+ service, enabled: bool` | `{ ok: true }` |
|
|
69
|
-
| `POST /add` | `+ name, label, key_type, description` | `{ ok: true }` |
|
|
70
|
-
| `POST /remove` | `+ service, confirm: true` | `{ ok: true }` |
|
|
71
|
-
| `POST /revoke` | `+ service, confirm: true` | `{ ok: true }` |
|
|
72
|
-
| `POST /register-machine` | `machine_hash, hmac_seed_hash, label, admin_token` | `{ ok: true }` |
|
|
73
|
-
|
|
74
|
-
All auth routes require: `machine_hash`, `token`, `timestamp`, `password`.
|
|
75
|
-
|
|
76
|
-
### Password Handling
|
|
77
|
-
|
|
78
|
-
- Ask the user for their clauth password **once per session**
|
|
79
|
-
- Store it in working memory for the duration of the conversation
|
|
80
|
-
- Never log or echo the password
|
|
81
|
-
- If the user says "use clauth" or "get my github key", ask for the password if you don't have it yet
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## When someone says "install clauth"
|
|
86
|
-
|
|
87
|
-
### Step 1 — Install from npm
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npm install -g @lifeaitools/clauth
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
If already installed, update:
|
|
94
|
-
```bash
|
|
95
|
-
npm update -g @lifeaitools/clauth
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### Step 2 — Run the installer
|
|
99
|
-
|
|
100
|
-
Use CLI flags to avoid interactive prompts:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
clauth install --ref <supabase-project-ref> --pat <personal-access-token>
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
**Project ref** — last part of the Supabase project URL:
|
|
107
|
-
`https://supabase.com/dashboard/project/` **`uvojezuorjgqzmhhgluu`**
|
|
108
|
-
|
|
109
|
-
**Personal Access Token (PAT):**
|
|
110
|
-
`https://supabase.com/dashboard/account/tokens` → Generate new token
|
|
111
|
-
*(NOT the anon key or service_role — this is your account-level token)*
|
|
112
|
-
|
|
113
|
-
The installer provisions everything and prints a **bootstrap token** — save it.
|
|
114
|
-
|
|
115
|
-
### Step 3 — Setup this machine
|
|
116
|
-
|
|
117
|
-
```bash
|
|
118
|
-
clauth setup --admin-token <bootstrap-token> -p <password>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Then verify:
|
|
122
|
-
```bash
|
|
123
|
-
clauth test -p <password>
|
|
124
|
-
clauth status -p <password>
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Step 4 — Write your first key
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
clauth write key github -p <password> # prompts for value
|
|
131
|
-
clauth enable github -p <password>
|
|
132
|
-
clauth get github -p <password>
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
See `references/keys-guide.md` for where to find every credential.
|
|
136
|
-
|
|
137
|
-
---
|
|
138
|
-
|
|
139
|
-
## Command reference
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
clauth install [--ref R] [--pat P] First-time: provision Supabase + install skill
|
|
143
|
-
clauth setup [--admin-token T] [-p P] Register this machine
|
|
144
|
-
clauth status [-p P] All services + state
|
|
145
|
-
clauth test [-p P] Verify HMAC connection
|
|
146
|
-
clauth list [-p P] Service names
|
|
147
|
-
|
|
148
|
-
clauth write key <service> [-p P] Store a credential
|
|
149
|
-
clauth write pw [-p P] Change password
|
|
150
|
-
clauth enable <svc|all> [-p P] Activate service
|
|
151
|
-
clauth disable <svc|all> [-p P] Suspend service
|
|
152
|
-
clauth get <service> [-p P] Retrieve a key
|
|
153
|
-
|
|
154
|
-
clauth add service <n> [-p P] Register new service
|
|
155
|
-
clauth remove service <n> [-p P] Remove service
|
|
156
|
-
clauth revoke <svc|all> [-p P] Delete key (destructive)
|
|
157
|
-
|
|
158
|
-
clauth scrub Scrub active transcript (most recent .jsonl)
|
|
159
|
-
clauth scrub <file> Scrub a specific file
|
|
160
|
-
clauth scrub all Scrub all transcripts in ~/.claude/projects/
|
|
161
|
-
clauth scrub all --force Rescrub everything (ignore markers)
|
|
162
|
-
|
|
163
|
-
clauth uninstall --ref R --pat P Full teardown (DB, Edge Fn, secrets, skill, config)
|
|
164
|
-
clauth uninstall --ref R --pat P --yes Skip confirmation
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Services
|
|
168
|
-
|
|
169
|
-
`github` `supabase-anon` `supabase-service` `supabase-db`
|
|
170
|
-
`vercel` `namecheap` `neo4j` `anthropic`
|
|
171
|
-
`r2` `r2-bucket` `cloudflare` `rocketreach`
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Troubleshooting
|
|
176
|
-
|
|
177
|
-
| Error | Fix |
|
|
178
|
-
|-------|-----|
|
|
179
|
-
| `machine_not_found` | Run `clauth setup` |
|
|
180
|
-
| `timestamp_expired` | Sync system clock |
|
|
181
|
-
| `invalid_token` | Wrong password |
|
|
182
|
-
| `service_disabled` | `clauth enable <service> -p <password>` |
|
|
183
|
-
| `no_key_stored` | `clauth write key <service> -p <password>` |
|
|
184
|
-
| ANSI garbage output | You piped stdin — use `-p` flag instead |
|
|
1
|
+
---
|
|
2
|
+
name: clauth
|
|
3
|
+
description: Install, configure, and operate clauth — the LIFEAI hardware-bound credential vault. Triggers on "install clauth", "set up my keys", "clauth install", "store my credentials", "set up the vault", or any mention of clauth or managing LIFEAI service credentials. When triggered for install, check GitHub MCP first, clone LIFEAI/clauth, and run the installer. Also handles ongoing clauth commands: status, get, write, enable, disable, add service, revoke.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# clauth — LIFEAI Credential Vault
|
|
7
|
+
|
|
8
|
+
Hardware-bound credential vault for the LIFEAI stack. Your machine is the second factor. Keys live in Supabase Vault (AES-256).
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## How Claude Interfaces with clauth
|
|
13
|
+
|
|
14
|
+
> **CRITICAL:** Never pipe input to clauth or use interactive prompts. The CLI uses `inquirer` which produces ANSI garbage when stdin is piped. Always use one of the two methods below.
|
|
15
|
+
|
|
16
|
+
### Method 1 — CLI with `--pw` flag (simplest)
|
|
17
|
+
|
|
18
|
+
All clauth commands accept `-p` / `--pw <password>` to skip the interactive password prompt:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
clauth status -p "YourPassword"
|
|
22
|
+
clauth get github -p "YourPassword"
|
|
23
|
+
clauth test -p "YourPassword"
|
|
24
|
+
clauth enable github -p "YourPassword"
|
|
25
|
+
clauth write key github -p "YourPassword" # still prompts for the key value
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Method 2 — Direct API calls (full control, no CLI needed)
|
|
29
|
+
|
|
30
|
+
Call the auth-vault Edge Function directly. This is the most reliable method for Claude.
|
|
31
|
+
|
|
32
|
+
**Base URL:** `https://<project-ref>.supabase.co/functions/v1/auth-vault`
|
|
33
|
+
**Auth header:** `Authorization: Bearer <supabase-anon-key>`
|
|
34
|
+
**Method:** POST (all routes)
|
|
35
|
+
**Content-Type:** `application/json`
|
|
36
|
+
|
|
37
|
+
#### HMAC Token Derivation (must match server)
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
import { createHmac, createHash, execSync } from "crypto";
|
|
41
|
+
|
|
42
|
+
// 1. Get machine hash (same as fingerprint.js)
|
|
43
|
+
// Windows:
|
|
44
|
+
const uuid = execSync("wmic csproduct get uuid /format:value", { encoding: "utf8" })
|
|
45
|
+
.match(/UUID=([A-F0-9-]+)/i)?.[1]?.trim();
|
|
46
|
+
const machineGuid = execSync(
|
|
47
|
+
"reg query HKLM\\SOFTWARE\\Microsoft\\Cryptography /v MachineGuid",
|
|
48
|
+
{ encoding: "utf8" }
|
|
49
|
+
).match(/MachineGuid\s+REG_SZ\s+([a-f0-9-]+)/i)?.[1]?.trim();
|
|
50
|
+
const machineHash = createHash("sha256").update(`${uuid}:${machineGuid}`).digest("hex");
|
|
51
|
+
|
|
52
|
+
// 2. Derive HMAC token
|
|
53
|
+
const windowMs = 5 * 60 * 1000;
|
|
54
|
+
const window = Math.floor(Date.now() / windowMs);
|
|
55
|
+
const message = `${machineHash}:${window}`;
|
|
56
|
+
const token = createHmac("sha256", password).update(message).digest("hex");
|
|
57
|
+
const timestamp = window * windowMs;
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
#### API Routes
|
|
61
|
+
|
|
62
|
+
| Route | Body fields | Returns |
|
|
63
|
+
|-------|-------------|---------|
|
|
64
|
+
| `POST /status` | `machine_hash, token, timestamp, password` | `{ services: [...] }` |
|
|
65
|
+
| `POST /test` | `machine_hash, token, timestamp, password` | `{ ok: true }` |
|
|
66
|
+
| `POST /retrieve` | `+ service` | `{ value: "..." }` |
|
|
67
|
+
| `POST /write` | `+ service, value` | `{ ok: true }` |
|
|
68
|
+
| `POST /enable` | `+ service, enabled: bool` | `{ ok: true }` |
|
|
69
|
+
| `POST /add` | `+ name, label, key_type, description` | `{ ok: true }` |
|
|
70
|
+
| `POST /remove` | `+ service, confirm: true` | `{ ok: true }` |
|
|
71
|
+
| `POST /revoke` | `+ service, confirm: true` | `{ ok: true }` |
|
|
72
|
+
| `POST /register-machine` | `machine_hash, hmac_seed_hash, label, admin_token` | `{ ok: true }` |
|
|
73
|
+
|
|
74
|
+
All auth routes require: `machine_hash`, `token`, `timestamp`, `password`.
|
|
75
|
+
|
|
76
|
+
### Password Handling
|
|
77
|
+
|
|
78
|
+
- Ask the user for their clauth password **once per session**
|
|
79
|
+
- Store it in working memory for the duration of the conversation
|
|
80
|
+
- Never log or echo the password
|
|
81
|
+
- If the user says "use clauth" or "get my github key", ask for the password if you don't have it yet
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## When someone says "install clauth"
|
|
86
|
+
|
|
87
|
+
### Step 1 — Install from npm
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install -g @lifeaitools/clauth
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
If already installed, update:
|
|
94
|
+
```bash
|
|
95
|
+
npm update -g @lifeaitools/clauth
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Step 2 — Run the installer
|
|
99
|
+
|
|
100
|
+
Use CLI flags to avoid interactive prompts:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
clauth install --ref <supabase-project-ref> --pat <personal-access-token>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Project ref** — last part of the Supabase project URL:
|
|
107
|
+
`https://supabase.com/dashboard/project/` **`uvojezuorjgqzmhhgluu`**
|
|
108
|
+
|
|
109
|
+
**Personal Access Token (PAT):**
|
|
110
|
+
`https://supabase.com/dashboard/account/tokens` → Generate new token
|
|
111
|
+
*(NOT the anon key or service_role — this is your account-level token)*
|
|
112
|
+
|
|
113
|
+
The installer provisions everything and prints a **bootstrap token** — save it.
|
|
114
|
+
|
|
115
|
+
### Step 3 — Setup this machine
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
clauth setup --admin-token <bootstrap-token> -p <password>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Then verify:
|
|
122
|
+
```bash
|
|
123
|
+
clauth test -p <password>
|
|
124
|
+
clauth status -p <password>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 4 — Write your first key
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
clauth write key github -p <password> # prompts for value
|
|
131
|
+
clauth enable github -p <password>
|
|
132
|
+
clauth get github -p <password>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
See `references/keys-guide.md` for where to find every credential.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Command reference
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
clauth install [--ref R] [--pat P] First-time: provision Supabase + install skill
|
|
143
|
+
clauth setup [--admin-token T] [-p P] Register this machine
|
|
144
|
+
clauth status [-p P] All services + state
|
|
145
|
+
clauth test [-p P] Verify HMAC connection
|
|
146
|
+
clauth list [-p P] Service names
|
|
147
|
+
|
|
148
|
+
clauth write key <service> [-p P] Store a credential
|
|
149
|
+
clauth write pw [-p P] Change password
|
|
150
|
+
clauth enable <svc|all> [-p P] Activate service
|
|
151
|
+
clauth disable <svc|all> [-p P] Suspend service
|
|
152
|
+
clauth get <service> [-p P] Retrieve a key
|
|
153
|
+
|
|
154
|
+
clauth add service <n> [-p P] Register new service
|
|
155
|
+
clauth remove service <n> [-p P] Remove service
|
|
156
|
+
clauth revoke <svc|all> [-p P] Delete key (destructive)
|
|
157
|
+
|
|
158
|
+
clauth scrub Scrub active transcript (most recent .jsonl)
|
|
159
|
+
clauth scrub <file> Scrub a specific file
|
|
160
|
+
clauth scrub all Scrub all transcripts in ~/.claude/projects/
|
|
161
|
+
clauth scrub all --force Rescrub everything (ignore markers)
|
|
162
|
+
|
|
163
|
+
clauth uninstall --ref R --pat P Full teardown (DB, Edge Fn, secrets, skill, config)
|
|
164
|
+
clauth uninstall --ref R --pat P --yes Skip confirmation
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Services
|
|
168
|
+
|
|
169
|
+
`github` `supabase-anon` `supabase-service` `supabase-db`
|
|
170
|
+
`vercel` `namecheap` `neo4j` `anthropic`
|
|
171
|
+
`r2` `r2-bucket` `cloudflare` `rocketreach`
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Troubleshooting
|
|
176
|
+
|
|
177
|
+
| Error | Fix |
|
|
178
|
+
|-------|-----|
|
|
179
|
+
| `machine_not_found` | Run `clauth setup` |
|
|
180
|
+
| `timestamp_expired` | Sync system clock |
|
|
181
|
+
| `invalid_token` | Wrong password |
|
|
182
|
+
| `service_disabled` | `clauth enable <service> -p <password>` |
|
|
183
|
+
| `no_key_stored` | `clauth write key <service> -p <password>` |
|
|
184
|
+
| ANSI garbage output | You piped stdin — use `-p` flag instead |
|