@lifeaitools/clauth 0.1.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 +141 -0
- package/.clauth-skill/references/keys-guide.md +270 -0
- package/.clauth-skill/references/operator-guide.md +148 -0
- package/README.md +101 -0
- package/cli/api.js +108 -0
- package/cli/commands/install.js +258 -0
- package/cli/fingerprint.js +91 -0
- package/cli/index.js +403 -0
- package/install.ps1 +44 -0
- package/install.sh +38 -0
- package/package.json +54 -0
- package/scripts/bin/bootstrap-linux +0 -0
- package/scripts/bin/bootstrap-macos +0 -0
- package/scripts/bin/bootstrap-win.exe +0 -0
- package/scripts/bootstrap.cjs +43 -0
- package/scripts/build.sh +45 -0
- package/supabase/functions/auth-vault/index.ts +326 -0
- package/supabase/migrations/001_clauth_schema.sql +94 -0
- package/supabase/migrations/002_vault_helpers.sql +90 -0
|
@@ -0,0 +1,141 @@
|
|
|
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
|
+
## When someone says "install clauth"
|
|
13
|
+
|
|
14
|
+
### Step 1 — Check GitHub MCP is connected
|
|
15
|
+
|
|
16
|
+
Look at your available tools. You need a GitHub/git tool that can clone a repository.
|
|
17
|
+
|
|
18
|
+
If GitHub MCP is NOT connected, stop and tell the user:
|
|
19
|
+
|
|
20
|
+
> "To install clauth I need your GitHub connection. In Claude, go to Settings → Integrations and connect GitHub, then come back and say 'install clauth' again."
|
|
21
|
+
|
|
22
|
+
Do not proceed without it.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### Step 2 — Clone the repo
|
|
27
|
+
|
|
28
|
+
Use bash to clone into `~/.clauth`:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git clone https://github.com/LIFEAI/clauth.git ~/.clauth
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
If `~/.clauth` already exists:
|
|
35
|
+
```bash
|
|
36
|
+
cd ~/.clauth && git pull
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
### Step 3 — Run the bootstrap binary
|
|
42
|
+
|
|
43
|
+
**Windows:**
|
|
44
|
+
```powershell
|
|
45
|
+
& "$env:USERPROFILE\.clauth\scripts\bin\bootstrap-win.exe"
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Mac/Linux:**
|
|
49
|
+
```bash
|
|
50
|
+
~/.clauth/scripts/bin/bootstrap-linux
|
|
51
|
+
# Mac:
|
|
52
|
+
~/.clauth/scripts/bin/bootstrap-macos
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
This binary:
|
|
56
|
+
- Runs `npm install`
|
|
57
|
+
- Links `clauth` globally
|
|
58
|
+
- Chains to `clauth install` automatically
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Step 4 — clauth install (automatic)
|
|
63
|
+
|
|
64
|
+
`clauth install` runs automatically. It asks for two Supabase items:
|
|
65
|
+
|
|
66
|
+
**Project ref** — last part of your Supabase project URL:
|
|
67
|
+
`https://supabase.com/dashboard/project/` **`uvojezuorjgqzmhhgluu`**
|
|
68
|
+
|
|
69
|
+
**Personal Access Token (PAT):**
|
|
70
|
+
`https://supabase.com/dashboard/account/tokens` → Generate new token
|
|
71
|
+
*(NOT the anon key or service_role — this is your account-level token)*
|
|
72
|
+
|
|
73
|
+
Then it provisions everything, tests it, installs this skill, and prints a **bootstrap token** — save it.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Step 5 — clauth setup
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
clauth setup
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Asks: machine label, password, bootstrap token (from step 4).
|
|
84
|
+
|
|
85
|
+
Then verify:
|
|
86
|
+
```
|
|
87
|
+
clauth test → PASS
|
|
88
|
+
clauth status → 12 services ready
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### Step 6 — Write your first key
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
clauth write key github # prompts for value
|
|
97
|
+
clauth enable github
|
|
98
|
+
clauth get github
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
See `references/keys-guide.md` for where to find every credential.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Command reference
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
clauth install First-time: provision Supabase + install skill
|
|
109
|
+
clauth setup Register this machine (after install)
|
|
110
|
+
clauth status All services + state
|
|
111
|
+
clauth test Verify HMAC connection
|
|
112
|
+
clauth list Service names
|
|
113
|
+
|
|
114
|
+
clauth write key <service> Store a credential
|
|
115
|
+
clauth write pw Change password
|
|
116
|
+
clauth enable <svc|all> Activate service
|
|
117
|
+
clauth disable <svc|all> Suspend service
|
|
118
|
+
clauth get <service> Retrieve a key
|
|
119
|
+
|
|
120
|
+
clauth add service <n> Register new service
|
|
121
|
+
clauth remove service <n> Remove service
|
|
122
|
+
clauth revoke <svc|all> Delete key (destructive)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Services
|
|
126
|
+
|
|
127
|
+
`github` `supabase-anon` `supabase-service` `supabase-db`
|
|
128
|
+
`vercel` `namecheap` `neo4j` `anthropic`
|
|
129
|
+
`r2` `r2-bucket` `cloudflare` `rocketreach`
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Troubleshooting
|
|
134
|
+
|
|
135
|
+
| Error | Fix |
|
|
136
|
+
|-------|-----|
|
|
137
|
+
| `machine_not_found` | Run `clauth setup` |
|
|
138
|
+
| `timestamp_expired` | Sync system clock |
|
|
139
|
+
| `invalid_token` | Wrong password |
|
|
140
|
+
| `service_disabled` | `clauth enable <service>` |
|
|
141
|
+
| `no_key_stored` | `clauth write key <service>` |
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# clauth Keys Guide
|
|
2
|
+
|
|
3
|
+
Plain-English explanations of every credential clauth manages. Read this before setup.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## The Most Important Key for Install: Supabase Personal Access Token (PAT)
|
|
8
|
+
|
|
9
|
+
This is the first thing the installer asks for and the most commonly confused item.
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
sbp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This is your **account-level** token — not tied to any one project. It gives the installer permission to create tables, deploy the edge function, and store secrets in your project.
|
|
16
|
+
|
|
17
|
+
**Where to get it:**
|
|
18
|
+
> https://supabase.com/dashboard/account/tokens → "Generate new token"
|
|
19
|
+
> Name it anything, e.g. "clauth-install"
|
|
20
|
+
|
|
21
|
+
**This is NOT:**
|
|
22
|
+
- Your anon key (that starts with `eyJ...`)
|
|
23
|
+
- Your service_role key (also starts with `eyJ...`)
|
|
24
|
+
- Your project URL
|
|
25
|
+
|
|
26
|
+
The PAT is only needed once during install. After that, clauth uses the anon key + HMAC for everything.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## The Most Confusing Part: Supabase Has 4 Different Keys
|
|
31
|
+
|
|
32
|
+
This is where most people get stuck. Supabase gives you multiple keys and they look similar. Here's what each one is:
|
|
33
|
+
|
|
34
|
+
### 1. `NEXT_PUBLIC_SUPABASE_URL` — The Project URL
|
|
35
|
+
```
|
|
36
|
+
https://uvojezuorjgqzmhhgluu.supabase.co
|
|
37
|
+
```
|
|
38
|
+
This is just a URL. Not a secret. It's the address of your Supabase project. You can find it in:
|
|
39
|
+
> Supabase Dashboard → Project Settings → API → Project URL
|
|
40
|
+
|
|
41
|
+
**clauth uses this as:** `Supabase project URL` during `clauth setup`
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
### 2. Anon Key (Public JWT) — `supabase-anon` in clauth
|
|
46
|
+
```
|
|
47
|
+
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ... (very long)
|
|
48
|
+
```
|
|
49
|
+
This is a **public key** — it's safe to put in frontend code. It only has the permissions that your Row Level Security (RLS) policies allow. Think of it as a "guest pass" to your database.
|
|
50
|
+
|
|
51
|
+
**Where to find it:**
|
|
52
|
+
> Supabase Dashboard → Project Settings → API → Project API Keys → `anon` `public`
|
|
53
|
+
|
|
54
|
+
**clauth uses this for:** Calling the Edge Function (every request). Used during `clauth setup` as `Supabase anon key`.
|
|
55
|
+
|
|
56
|
+
**Also called:** `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_DEFAULT_KEY` or `sb_publishable_...` in newer Supabase projects. Same thing, different name format.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### 3. Service Role Key — `supabase-service` in clauth
|
|
61
|
+
```
|
|
62
|
+
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...role":"service_role"... (very long)
|
|
63
|
+
```
|
|
64
|
+
This is an **admin key** — it bypasses all RLS policies and can read/write anything. Treat this like a root password. Never put it in frontend code.
|
|
65
|
+
|
|
66
|
+
**Where to find it:**
|
|
67
|
+
> Supabase Dashboard → Project Settings → API → Project API Keys → `service_role` `secret`
|
|
68
|
+
|
|
69
|
+
**clauth stores this as:** `supabase-service`
|
|
70
|
+
|
|
71
|
+
**Also called:** `sb_secret_...` in newer Supabase projects. Same thing.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
### 4. Database Connection String — `supabase-db` in clauth
|
|
76
|
+
```
|
|
77
|
+
postgres://postgres.uvojezuorjgqzmhhgluu:[YOUR-PASSWORD]@aws-0-us-west-1.pooler.supabase.com:6543/postgres
|
|
78
|
+
```
|
|
79
|
+
This is for direct SQL access — tools like Drizzle, Prisma, or raw psql use this. Two versions exist:
|
|
80
|
+
- **Pooled** (port 6543) — for apps with many connections (use this)
|
|
81
|
+
- **Direct** (port 5432) — for migrations only
|
|
82
|
+
|
|
83
|
+
**Where to find it:**
|
|
84
|
+
> Supabase Dashboard → Project Settings → Database → Connection string → URI
|
|
85
|
+
|
|
86
|
+
**Note:** Replace `[YOUR-PASSWORD]` with the password you set when creating the project.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## GitHub
|
|
91
|
+
|
|
92
|
+
### Personal Access Token (PAT) — `github` in clauth
|
|
93
|
+
```
|
|
94
|
+
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
95
|
+
```
|
|
96
|
+
This is what lets programs act as you on GitHub — push code, manage repos, etc.
|
|
97
|
+
|
|
98
|
+
**Where to create one:**
|
|
99
|
+
> GitHub.com → Settings (your profile, top right) → Developer settings → Personal access tokens → Tokens (classic) → Generate new token
|
|
100
|
+
|
|
101
|
+
**Scopes you need for LIFEAI work:**
|
|
102
|
+
- `repo` — full repo access
|
|
103
|
+
- `workflow` — GitHub Actions
|
|
104
|
+
- `read:org` — read org membership
|
|
105
|
+
- `admin:org` — if you need to manage the org
|
|
106
|
+
|
|
107
|
+
**clauth stores this as:** `github`
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Vercel
|
|
112
|
+
|
|
113
|
+
### API Token + Team ID — `vercel` in clauth (keypair)
|
|
114
|
+
Two values stored together as JSON: `{"token":"...","team_id":"..."}`
|
|
115
|
+
|
|
116
|
+
**API Token:**
|
|
117
|
+
> Vercel Dashboard → Account Settings → Tokens → Create Token
|
|
118
|
+
> Name it something like "LIFEAI-clauth"
|
|
119
|
+
|
|
120
|
+
**Team ID:**
|
|
121
|
+
> Vercel Dashboard → Team Settings → General → Team ID
|
|
122
|
+
> Looks like: `team_xxxxxxxxxxxxxxxxxxxxxxxx`
|
|
123
|
+
|
|
124
|
+
**clauth stores this as:** `vercel` (keypair type)
|
|
125
|
+
```bash
|
|
126
|
+
clauth write key vercel '{"token":"vcp_xxx...","team_id":"team_xxx..."}'
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
## Cloudflare R2
|
|
132
|
+
|
|
133
|
+
R2 has **two separate credentials** because it uses the S3 protocol for file operations but a separate admin API for bucket management.
|
|
134
|
+
|
|
135
|
+
### R2 Object Access Keys — `r2` in clauth (keypair)
|
|
136
|
+
Used for: uploading, downloading, deleting files in your bucket (S3-compatible)
|
|
137
|
+
```
|
|
138
|
+
Access Key ID: f3ff8996f212b638254cf5747abce445
|
|
139
|
+
Secret Access Key: 45a078775b1b62a7200024c30660e72d2997ab65bb4a6e72629fda8a87e222a9
|
|
140
|
+
```
|
|
141
|
+
**Where to find:**
|
|
142
|
+
> Cloudflare Dashboard → R2 → Manage R2 API Tokens → Create API Token → Object Read & Write
|
|
143
|
+
|
|
144
|
+
**clauth stores this as:** `r2`
|
|
145
|
+
```bash
|
|
146
|
+
clauth write key r2 '{"access_key_id":"f3ff...","secret_access_key":"45a0..."}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### R2 Bucket Config — `r2-bucket` in clauth (connstring)
|
|
150
|
+
Used for: knowing which bucket to use and where it lives
|
|
151
|
+
```
|
|
152
|
+
bucket_name: regen-media
|
|
153
|
+
endpoint: https://c879cf4758546d79164c2718c477be72.r2.cloudflarestorage.com
|
|
154
|
+
public_cdn: https://pub-ff9788cd4f1f494db0491a197025a94c.r2.dev
|
|
155
|
+
```
|
|
156
|
+
**clauth stores this as:** `r2-bucket`
|
|
157
|
+
```bash
|
|
158
|
+
clauth write key r2-bucket '{"bucket":"regen-media","endpoint":"https://c879...r2.cloudflarestorage.com","cdn":"https://pub-ff97...r2.dev"}'
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Cloudflare Admin API Token — `cloudflare` in clauth (token)
|
|
162
|
+
Used for: DNS records, zone management, creating/deleting buckets
|
|
163
|
+
```
|
|
164
|
+
1e_f4y2t58ra7UpKAAj5TzCcBUYTdEC3H2LJ9Vtc
|
|
165
|
+
```
|
|
166
|
+
**Where to find:**
|
|
167
|
+
> Cloudflare Dashboard → R2 → Manage R2 API Tokens → (the Admin token, not the RW token)
|
|
168
|
+
|
|
169
|
+
**clauth stores this as:** `cloudflare`
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Namecheap
|
|
174
|
+
|
|
175
|
+
### API Key + Username — `namecheap` in clauth (keypair)
|
|
176
|
+
Two values stored together:
|
|
177
|
+
```
|
|
178
|
+
username: ejlamyot
|
|
179
|
+
api_key: CJWM4dr&RMS$v.s (yours will look similar)
|
|
180
|
+
```
|
|
181
|
+
**Where to find:**
|
|
182
|
+
> Namecheap Dashboard → Profile (top right) → Tools → API Access → Enable API
|
|
183
|
+
|
|
184
|
+
**Important:** Namecheap API also requires your **IP address to be whitelisted**. Add your current IP in the same API Access page, or Namecheap will reject every call.
|
|
185
|
+
|
|
186
|
+
**clauth stores this as:** `namecheap`
|
|
187
|
+
```bash
|
|
188
|
+
clauth write key namecheap '{"username":"ejlamyot","api_key":"CJWM4dr..."}'
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Neo4j Aura
|
|
194
|
+
|
|
195
|
+
### Connection URI + Credentials — `neo4j` in clauth (connstring)
|
|
196
|
+
```
|
|
197
|
+
neo4j+s://xxxxxxxx.databases.neo4j.io
|
|
198
|
+
username: neo4j
|
|
199
|
+
password: (set when you created the instance)
|
|
200
|
+
```
|
|
201
|
+
**Where to find:**
|
|
202
|
+
> Neo4j Aura Console → Your database → Connect → Connection URI
|
|
203
|
+
|
|
204
|
+
**clauth stores this as:** `neo4j`
|
|
205
|
+
```bash
|
|
206
|
+
clauth write key neo4j 'neo4j+s://neo4j:yourpassword@xxxxxxxx.databases.neo4j.io'
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Anthropic
|
|
212
|
+
|
|
213
|
+
### API Key — `anthropic` in clauth (token)
|
|
214
|
+
```
|
|
215
|
+
sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
216
|
+
```
|
|
217
|
+
**Where to find:**
|
|
218
|
+
> console.anthropic.com → API Keys → Create Key
|
|
219
|
+
|
|
220
|
+
**clauth stores this as:** `anthropic`
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## RocketReach
|
|
225
|
+
|
|
226
|
+
### API Key — `rocketreach` in clauth (token)
|
|
227
|
+
```
|
|
228
|
+
12b893dk776927c079ea18cb1a7bc8d95b43398a
|
|
229
|
+
```
|
|
230
|
+
**Where to find:**
|
|
231
|
+
> rocketreach.co → Account Settings → API
|
|
232
|
+
|
|
233
|
+
**clauth stores this as:** `rocketreach`
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## The Bootstrap Token (Special — One Time Only)
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
ba6f25ec30e9316ead93152f0cfa5617
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
This is **not a service API key**. It's a one-time password that lets `clauth setup` register your machine with the vault for the first time.
|
|
244
|
+
|
|
245
|
+
- It's stored in your Supabase Vault (not hardcoded anywhere)
|
|
246
|
+
- After your machine is registered, you never need it again for daily use
|
|
247
|
+
- If you need to register a **new machine**, you need it again
|
|
248
|
+
- The vault operator (Dave) can retrieve it from: Supabase Dashboard → Vault → `CLAUTH_ADMIN_BOOTSTRAP_TOKEN`
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## Summary Table
|
|
253
|
+
|
|
254
|
+
| clauth token | What it is | Where to get it | Type |
|
|
255
|
+
|---|---|---|---|
|
|
256
|
+
| *(setup prompt)* | Supabase project URL | Supabase → Settings → API | URL |
|
|
257
|
+
| *(setup prompt)* | Supabase anon key | Supabase → Settings → API → anon public | JWT |
|
|
258
|
+
| *(setup prompt)* | Bootstrap token | Ask vault operator / Supabase Vault | One-time |
|
|
259
|
+
| `github` | GitHub Personal Access Token | github.com → Settings → Developer → PATs | token |
|
|
260
|
+
| `supabase-anon` | Supabase anon key (stored for apps) | Same as above | token |
|
|
261
|
+
| `supabase-service` | Supabase service role key | Supabase → Settings → API → service_role | token |
|
|
262
|
+
| `supabase-db` | Postgres connection string | Supabase → Settings → Database → URI | connstring |
|
|
263
|
+
| `vercel` | Vercel API token + Team ID | Vercel → Account Settings → Tokens | keypair |
|
|
264
|
+
| `namecheap` | Namecheap API key + username | Namecheap → Profile → Tools → API | keypair |
|
|
265
|
+
| `neo4j` | Neo4j Aura URI + password | Aura Console → Connect | connstring |
|
|
266
|
+
| `anthropic` | Anthropic API key | console.anthropic.com → API Keys | token |
|
|
267
|
+
| `r2` | Cloudflare R2 S3 keypair | Cloudflare → R2 → Manage API Tokens | keypair |
|
|
268
|
+
| `r2-bucket` | R2 bucket name + endpoint | Cloudflare → R2 → bucket details | connstring |
|
|
269
|
+
| `cloudflare` | Cloudflare admin API token | Cloudflare → R2 → Manage API Tokens | token |
|
|
270
|
+
| `rocketreach` | RocketReach API key | rocketreach.co → Account → API | token |
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# clauth Operator Guide
|
|
2
|
+
|
|
3
|
+
For teams deploying their own clauth instance from scratch.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## What "Operator" Means
|
|
8
|
+
|
|
9
|
+
When you clone the clauth repo and run `clauth setup`, you're connecting to an existing vault. If you want to run your **own** vault (different Supabase project, your own team), you're the operator. This guide covers that.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Step 1 — Supabase Project
|
|
14
|
+
|
|
15
|
+
You need a Supabase project. Create one at supabase.com if you don't have one.
|
|
16
|
+
|
|
17
|
+
Collect:
|
|
18
|
+
- Project URL: `https://<ref>.supabase.co`
|
|
19
|
+
- Anon key (public JWT)
|
|
20
|
+
- Service role key (admin JWT)
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Step 2 — Run Migrations
|
|
25
|
+
|
|
26
|
+
In Supabase SQL Editor (or via CLI), run both migration files in order:
|
|
27
|
+
|
|
28
|
+
1. `supabase/migrations/001_clauth_schema.sql`
|
|
29
|
+
2. `supabase/migrations/002_vault_helpers.sql`
|
|
30
|
+
|
|
31
|
+
Or via Supabase CLI:
|
|
32
|
+
```bash
|
|
33
|
+
supabase db push
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates:
|
|
37
|
+
- `clauth_services` — service registry (12 services seeded)
|
|
38
|
+
- `clauth_machines` — machine fingerprint registry
|
|
39
|
+
- `clauth_audit` — all operations logged
|
|
40
|
+
- Vault helper RPCs (upsert/decrypt/delete/list)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Step 3 — Deploy Edge Function
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
supabase functions deploy auth-vault --project-ref <your-ref>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Or deploy from the Supabase dashboard by uploading `supabase/functions/auth-vault/index.ts`.
|
|
51
|
+
|
|
52
|
+
The function automatically reads `CLAUTH_HMAC_SALT` and `CLAUTH_ADMIN_BOOTSTRAP_TOKEN` from Supabase Vault (or env vars if set).
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Step 4 — Generate and Store Secrets
|
|
57
|
+
|
|
58
|
+
Run this to generate a salt and bootstrap token:
|
|
59
|
+
```bash
|
|
60
|
+
node -e "const c=require('crypto'); console.log('SALT:', c.randomBytes(32).toString('hex')); console.log('BOOTSTRAP:', c.randomBytes(16).toString('hex'));"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Store them in Supabase Vault via SQL Editor:
|
|
64
|
+
```sql
|
|
65
|
+
select vault.create_secret('<your-salt>', 'CLAUTH_HMAC_SALT', 'clauth HMAC salt');
|
|
66
|
+
select vault.create_secret('<your-bootstrap>', 'CLAUTH_ADMIN_BOOTSTRAP_TOKEN', 'clauth bootstrap token');
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Or via Supabase Dashboard → Vault → New Secret.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Step 5 — Distribute to Team
|
|
74
|
+
|
|
75
|
+
Give team members:
|
|
76
|
+
1. Your Supabase project URL
|
|
77
|
+
2. Your Supabase anon key (public — safe to share)
|
|
78
|
+
3. The bootstrap token (treat as a shared secret — regenerate after everyone registers)
|
|
79
|
+
|
|
80
|
+
Each person runs:
|
|
81
|
+
```bash
|
|
82
|
+
git clone https://github.com/LIFEAI/clauth
|
|
83
|
+
cd clauth && .\install.ps1 # or bash install.sh
|
|
84
|
+
clauth setup
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Adding Team Members After Initial Setup
|
|
90
|
+
|
|
91
|
+
Once the bootstrap token has been used by the first person, you can either:
|
|
92
|
+
- Keep the same token for additional machines (it's reusable)
|
|
93
|
+
- Rotate it after everyone is registered:
|
|
94
|
+
|
|
95
|
+
```sql
|
|
96
|
+
-- Generate new one
|
|
97
|
+
select vault.create_secret('new-token-here', 'CLAUTH_ADMIN_BOOTSTRAP_TOKEN', 'rotated');
|
|
98
|
+
-- This overwrites the old one
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Viewing the Audit Log
|
|
104
|
+
|
|
105
|
+
```sql
|
|
106
|
+
select machine_hash, service_name, action, result, detail, created_at
|
|
107
|
+
from clauth_audit
|
|
108
|
+
order by created_at desc
|
|
109
|
+
limit 50;
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Disabling a Machine
|
|
115
|
+
|
|
116
|
+
If a machine is lost or stolen:
|
|
117
|
+
```sql
|
|
118
|
+
update clauth_machines set enabled = false where label = 'Dave-Desktop-Win11';
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
That machine's HMAC tokens will be rejected immediately.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Rotating the HMAC Salt
|
|
126
|
+
|
|
127
|
+
If the salt is compromised, rotate it:
|
|
128
|
+
```sql
|
|
129
|
+
-- Find the existing secret ID
|
|
130
|
+
select id, name from vault.secrets where name = 'CLAUTH_HMAC_SALT';
|
|
131
|
+
|
|
132
|
+
-- Update it
|
|
133
|
+
select vault.update_secret('<id>', 'new-salt-here');
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Warning:** After rotating the salt, ALL existing machines will fail HMAC validation. Every machine needs to re-run `clauth setup` with the new bootstrap token.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Project Identifiers (LIFEAI canonical)
|
|
141
|
+
|
|
142
|
+
| Item | Value |
|
|
143
|
+
|------|-------|
|
|
144
|
+
| Supabase project | `uvojezuorjgqzmhhgluu` |
|
|
145
|
+
| Supabase URL | `https://uvojezuorjgqzmhhgluu.supabase.co` |
|
|
146
|
+
| Edge Function | `auth-vault` (deployed, ACTIVE) |
|
|
147
|
+
| GitHub org | LIFEAI |
|
|
148
|
+
| Repo | https://github.com/LIFEAI/clauth |
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @lifeai/clauth
|
|
2
|
+
|
|
3
|
+
Hardware-bound credential vault for the LIFEAI stack. Your machine is the second factor. Keys live in Supabase Vault (AES-256).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @lifeai/clauth
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then provision your Supabase project:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
clauth install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
That's it. `clauth install` handles everything:
|
|
20
|
+
- Creates database tables
|
|
21
|
+
- Deploys the Edge Function
|
|
22
|
+
- Generates HMAC salt + bootstrap token
|
|
23
|
+
- Tests the connection
|
|
24
|
+
- Installs the Claude skill
|
|
25
|
+
|
|
26
|
+
At the end it prints a **bootstrap token** — save it for the next step.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## After Install — Register Your Machine
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
clauth setup
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Prompts for: machine label, password, bootstrap token (from `clauth install`).
|
|
37
|
+
|
|
38
|
+
Then verify:
|
|
39
|
+
```bash
|
|
40
|
+
clauth test # → PASS
|
|
41
|
+
clauth status # → 12 services, all NO KEY
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## What clauth install asks for
|
|
47
|
+
|
|
48
|
+
Two things from Supabase:
|
|
49
|
+
|
|
50
|
+
**1. Project ref** — the last segment of your project URL:
|
|
51
|
+
`https://supabase.com/dashboard/project/` **`your-ref-here`**
|
|
52
|
+
|
|
53
|
+
**2. Personal Access Token (PAT)**:
|
|
54
|
+
`https://supabase.com/dashboard/account/tokens` → Generate new token
|
|
55
|
+
|
|
56
|
+
> This is **not** your anon key or service_role key — it is your account-level token.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Command Reference
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
clauth install Provision Supabase + install Claude skill
|
|
64
|
+
clauth setup Register this machine with the vault
|
|
65
|
+
clauth status All services + state
|
|
66
|
+
clauth test Verify connection
|
|
67
|
+
|
|
68
|
+
clauth write key <service> Store a credential
|
|
69
|
+
clauth write pw Change password
|
|
70
|
+
clauth enable <svc|all> Activate service
|
|
71
|
+
clauth disable <svc|all> Suspend service
|
|
72
|
+
clauth get <service> Retrieve a key
|
|
73
|
+
|
|
74
|
+
clauth add service <name> Register new service
|
|
75
|
+
clauth remove service <name>Remove service
|
|
76
|
+
clauth revoke <svc|all> Delete key (destructive, confirms first)
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Built-in Services
|
|
80
|
+
|
|
81
|
+
`github` `supabase-anon` `supabase-service` `supabase-db`
|
|
82
|
+
`vercel` `namecheap` `neo4j` `anthropic`
|
|
83
|
+
`r2` `r2-bucket` `cloudflare` `rocketreach`
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## How It Works
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Machine fingerprint (BIOS UUID + OS install ID)
|
|
91
|
+
+ Your clauth password
|
|
92
|
+
→ HMAC-SHA256 token + 5-min timestamp window
|
|
93
|
+
→ Supabase Edge Function validates
|
|
94
|
+
→ Returns AES-256 encrypted key from Vault
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Nothing stored locally. Password never persisted. Machine hash is one-way only.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
> Life before Profits. — LIFEAI / PRT
|