axvault 1.11.3 → 1.13.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.
Files changed (246) hide show
  1. package/README.md +91 -147
  2. package/dist/cli.d.ts +2 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +6 -105
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/serve.d.ts +5 -1
  7. package/dist/commands/serve.d.ts.map +1 -1
  8. package/dist/commands/serve.js +88 -79
  9. package/dist/commands/serve.js.map +1 -1
  10. package/dist/config.d.ts +60 -9
  11. package/dist/config.d.ts.map +1 -1
  12. package/dist/config.js +53 -36
  13. package/dist/config.js.map +1 -1
  14. package/dist/db/bootstrap-api-key.d.ts +14 -0
  15. package/dist/db/bootstrap-api-key.d.ts.map +1 -0
  16. package/dist/db/bootstrap-api-key.js +26 -0
  17. package/dist/db/bootstrap-api-key.js.map +1 -0
  18. package/dist/db/create-pool.d.ts +5 -0
  19. package/dist/db/create-pool.d.ts.map +1 -0
  20. package/dist/db/create-pool.js +13 -0
  21. package/dist/db/create-pool.js.map +1 -0
  22. package/dist/db/migrations/001-initial.sql +41 -0
  23. package/dist/db/repositories/api-keys.d.ts +11 -37
  24. package/dist/db/repositories/api-keys.d.ts.map +1 -1
  25. package/dist/db/repositories/api-keys.js +23 -67
  26. package/dist/db/repositories/api-keys.js.map +1 -1
  27. package/dist/db/repositories/audit-log.d.ts +9 -7
  28. package/dist/db/repositories/audit-log.d.ts.map +1 -1
  29. package/dist/db/repositories/audit-log.js +25 -24
  30. package/dist/db/repositories/audit-log.js.map +1 -1
  31. package/dist/db/repositories/create-api-key.d.ts +30 -0
  32. package/dist/db/repositories/create-api-key.d.ts.map +1 -0
  33. package/dist/db/repositories/create-api-key.js +37 -0
  34. package/dist/db/repositories/create-api-key.js.map +1 -0
  35. package/dist/db/repositories/credentials-queries.d.ts +6 -6
  36. package/dist/db/repositories/credentials-queries.d.ts.map +1 -1
  37. package/dist/db/repositories/credentials-queries.js +8 -8
  38. package/dist/db/repositories/credentials-queries.js.map +1 -1
  39. package/dist/db/repositories/credentials.d.ts +9 -25
  40. package/dist/db/repositories/credentials.d.ts.map +1 -1
  41. package/dist/db/repositories/credentials.js +38 -34
  42. package/dist/db/repositories/credentials.js.map +1 -1
  43. package/dist/db/repositories/list-credentials-paginated.d.ts +2 -2
  44. package/dist/db/repositories/list-credentials-paginated.d.ts.map +1 -1
  45. package/dist/db/repositories/list-credentials-paginated.js +26 -26
  46. package/dist/db/repositories/list-credentials-paginated.js.map +1 -1
  47. package/dist/db/repositories/update-api-key-access.d.ts +12 -0
  48. package/dist/db/repositories/update-api-key-access.d.ts.map +1 -0
  49. package/dist/db/repositories/update-api-key-access.js +29 -0
  50. package/dist/db/repositories/update-api-key-access.js.map +1 -0
  51. package/dist/db/repositories/update-credential-if-unchanged.d.ts +20 -0
  52. package/dist/db/repositories/update-credential-if-unchanged.d.ts.map +1 -0
  53. package/dist/db/repositories/update-credential-if-unchanged.js +22 -0
  54. package/dist/db/repositories/update-credential-if-unchanged.js.map +1 -0
  55. package/dist/db/run-migrations.d.ts +16 -0
  56. package/dist/db/run-migrations.d.ts.map +1 -0
  57. package/dist/db/run-migrations.js +26 -0
  58. package/dist/db/run-migrations.js.map +1 -0
  59. package/dist/db/types.d.ts +6 -2
  60. package/dist/db/types.d.ts.map +1 -1
  61. package/dist/db/types.js +1 -1
  62. package/dist/format-error-message.d.ts +7 -0
  63. package/dist/format-error-message.d.ts.map +1 -0
  64. package/dist/format-error-message.js +19 -0
  65. package/dist/format-error-message.js.map +1 -0
  66. package/dist/handlers/refresh-credential-on-read.d.ts +2 -2
  67. package/dist/handlers/refresh-credential-on-read.d.ts.map +1 -1
  68. package/dist/handlers/refresh-credential-on-read.js +8 -8
  69. package/dist/handlers/refresh-credential-on-read.js.map +1 -1
  70. package/dist/index.d.ts +14 -7
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +15 -7
  73. package/dist/index.js.map +1 -1
  74. package/dist/lib/access-list.d.ts +13 -0
  75. package/dist/lib/access-list.d.ts.map +1 -0
  76. package/dist/lib/access-list.js +22 -0
  77. package/dist/lib/access-list.js.map +1 -0
  78. package/dist/lib/credential-name.d.ts +1 -6
  79. package/dist/lib/credential-name.d.ts.map +1 -1
  80. package/dist/lib/credential-name.js +1 -4
  81. package/dist/lib/credential-name.js.map +1 -1
  82. package/dist/schemas/request.d.ts +35 -0
  83. package/dist/schemas/request.d.ts.map +1 -0
  84. package/dist/schemas/request.js +76 -0
  85. package/dist/schemas/request.js.map +1 -0
  86. package/dist/schemas/{api.d.ts → response.d.ts} +6 -32
  87. package/dist/schemas/response.d.ts.map +1 -0
  88. package/dist/schemas/response.js +59 -0
  89. package/dist/schemas/response.js.map +1 -0
  90. package/dist/server/plugins/auth.d.ts +19 -0
  91. package/dist/server/plugins/auth.d.ts.map +1 -0
  92. package/dist/server/plugins/auth.js +51 -0
  93. package/dist/server/plugins/auth.js.map +1 -0
  94. package/dist/server/plugins/config.d.ts +14 -0
  95. package/dist/server/plugins/config.d.ts.map +1 -0
  96. package/dist/server/plugins/config.js +19 -0
  97. package/dist/server/plugins/config.js.map +1 -0
  98. package/dist/server/plugins/database.d.ts +12 -0
  99. package/dist/server/plugins/database.d.ts.map +1 -0
  100. package/dist/server/plugins/database.js +20 -0
  101. package/dist/server/plugins/database.js.map +1 -0
  102. package/dist/server/routes/credentials.d.ts +8 -0
  103. package/dist/server/routes/credentials.d.ts.map +1 -0
  104. package/dist/server/routes/credentials.js +82 -0
  105. package/dist/server/routes/credentials.js.map +1 -0
  106. package/dist/server/routes/handle-create-key.d.ts +10 -0
  107. package/dist/server/routes/handle-create-key.d.ts.map +1 -0
  108. package/dist/server/routes/handle-create-key.js +44 -0
  109. package/dist/server/routes/handle-create-key.js.map +1 -0
  110. package/dist/server/routes/handle-delete-credential.d.ts +10 -0
  111. package/dist/server/routes/handle-delete-credential.d.ts.map +1 -0
  112. package/dist/server/routes/handle-delete-credential.js +47 -0
  113. package/dist/server/routes/handle-delete-credential.js.map +1 -0
  114. package/dist/server/routes/handle-delete-key.d.ts +11 -0
  115. package/dist/server/routes/handle-delete-key.d.ts.map +1 -0
  116. package/dist/server/routes/handle-delete-key.js +40 -0
  117. package/dist/server/routes/handle-delete-key.js.map +1 -0
  118. package/dist/server/routes/handle-get-credential.d.ts +18 -0
  119. package/dist/server/routes/handle-get-credential.d.ts.map +1 -0
  120. package/dist/{handlers/get-credential.js → server/routes/handle-get-credential.js} +23 -40
  121. package/dist/server/routes/handle-get-credential.js.map +1 -0
  122. package/dist/server/routes/handle-list-credentials.d.ts +13 -0
  123. package/dist/server/routes/handle-list-credentials.d.ts.map +1 -0
  124. package/dist/{handlers/list-credentials.js → server/routes/handle-list-credentials.js} +13 -32
  125. package/dist/server/routes/handle-list-credentials.js.map +1 -0
  126. package/dist/server/routes/handle-put-credential.d.ts +14 -0
  127. package/dist/server/routes/handle-put-credential.d.ts.map +1 -0
  128. package/dist/{handlers/put-credential.js → server/routes/handle-put-credential.js} +30 -38
  129. package/dist/server/routes/handle-put-credential.js.map +1 -0
  130. package/dist/server/routes/handle-update-key.d.ts +13 -0
  131. package/dist/server/routes/handle-update-key.d.ts.map +1 -0
  132. package/dist/server/routes/handle-update-key.js +74 -0
  133. package/dist/server/routes/handle-update-key.js.map +1 -0
  134. package/dist/server/routes/health.d.ts +7 -0
  135. package/dist/server/routes/health.d.ts.map +1 -0
  136. package/dist/server/routes/health.js +25 -0
  137. package/dist/server/routes/health.js.map +1 -0
  138. package/dist/server/routes/keys.d.ts +12 -0
  139. package/dist/server/routes/keys.d.ts.map +1 -0
  140. package/dist/server/routes/keys.js +119 -0
  141. package/dist/server/routes/keys.js.map +1 -0
  142. package/dist/server/routes/log-grant-event.d.ts +7 -0
  143. package/dist/server/routes/log-grant-event.d.ts.map +1 -0
  144. package/dist/server/routes/log-grant-event.js +15 -0
  145. package/dist/server/routes/log-grant-event.js.map +1 -0
  146. package/dist/server/send-sensible-error.d.ts +7 -0
  147. package/dist/server/send-sensible-error.d.ts.map +1 -0
  148. package/dist/server/send-sensible-error.js +40 -0
  149. package/dist/server/send-sensible-error.js.map +1 -0
  150. package/dist/server/server.d.ts +6 -17
  151. package/dist/server/server.d.ts.map +1 -1
  152. package/dist/server/server.js +72 -56
  153. package/dist/server/server.js.map +1 -1
  154. package/package.json +11 -4
  155. package/dist/commands/credential.d.ts +0 -17
  156. package/dist/commands/credential.d.ts.map +0 -1
  157. package/dist/commands/credential.js +0 -126
  158. package/dist/commands/credential.js.map +0 -1
  159. package/dist/commands/init.d.ts +0 -10
  160. package/dist/commands/init.d.ts.map +0 -1
  161. package/dist/commands/init.js +0 -56
  162. package/dist/commands/init.js.map +0 -1
  163. package/dist/commands/key-create.d.ts +0 -14
  164. package/dist/commands/key-create.d.ts.map +0 -1
  165. package/dist/commands/key-create.js +0 -100
  166. package/dist/commands/key-create.js.map +0 -1
  167. package/dist/commands/key-list.d.ts +0 -10
  168. package/dist/commands/key-list.d.ts.map +0 -1
  169. package/dist/commands/key-list.js +0 -46
  170. package/dist/commands/key-list.js.map +0 -1
  171. package/dist/commands/key-revoke.d.ts +0 -12
  172. package/dist/commands/key-revoke.d.ts.map +0 -1
  173. package/dist/commands/key-revoke.js +0 -56
  174. package/dist/commands/key-revoke.js.map +0 -1
  175. package/dist/commands/key-update.d.ts +0 -17
  176. package/dist/commands/key-update.d.ts.map +0 -1
  177. package/dist/commands/key-update.js +0 -110
  178. package/dist/commands/key-update.js.map +0 -1
  179. package/dist/commands/key.d.ts +0 -10
  180. package/dist/commands/key.d.ts.map +0 -1
  181. package/dist/commands/key.js +0 -10
  182. package/dist/commands/key.js.map +0 -1
  183. package/dist/db/client.d.ts +0 -14
  184. package/dist/db/client.d.ts.map +0 -1
  185. package/dist/db/client.js +0 -39
  186. package/dist/db/client.js.map +0 -1
  187. package/dist/db/migrations.d.ts +0 -14
  188. package/dist/db/migrations.d.ts.map +0 -1
  189. package/dist/db/migrations.js +0 -141
  190. package/dist/db/migrations.js.map +0 -1
  191. package/dist/handlers/create-key.d.ts +0 -14
  192. package/dist/handlers/create-key.d.ts.map +0 -1
  193. package/dist/handlers/create-key.js +0 -25
  194. package/dist/handlers/create-key.js.map +0 -1
  195. package/dist/handlers/delete-credential.d.ts +0 -15
  196. package/dist/handlers/delete-credential.d.ts.map +0 -1
  197. package/dist/handlers/delete-credential.js +0 -47
  198. package/dist/handlers/delete-credential.js.map +0 -1
  199. package/dist/handlers/delete-key.d.ts +0 -15
  200. package/dist/handlers/delete-key.d.ts.map +0 -1
  201. package/dist/handlers/delete-key.js +0 -26
  202. package/dist/handlers/delete-key.js.map +0 -1
  203. package/dist/handlers/get-credential.d.ts +0 -27
  204. package/dist/handlers/get-credential.d.ts.map +0 -1
  205. package/dist/handlers/get-credential.js.map +0 -1
  206. package/dist/handlers/get-key.d.ts +0 -15
  207. package/dist/handlers/get-key.d.ts.map +0 -1
  208. package/dist/handlers/get-key.js +0 -21
  209. package/dist/handlers/get-key.js.map +0 -1
  210. package/dist/handlers/list-credentials.d.ts +0 -27
  211. package/dist/handlers/list-credentials.d.ts.map +0 -1
  212. package/dist/handlers/list-credentials.js.map +0 -1
  213. package/dist/handlers/list-keys.d.ts +0 -11
  214. package/dist/handlers/list-keys.d.ts.map +0 -1
  215. package/dist/handlers/list-keys.js +0 -16
  216. package/dist/handlers/list-keys.js.map +0 -1
  217. package/dist/handlers/put-credential.d.ts +0 -24
  218. package/dist/handlers/put-credential.d.ts.map +0 -1
  219. package/dist/handlers/put-credential.js.map +0 -1
  220. package/dist/handlers/update-key.d.ts +0 -17
  221. package/dist/handlers/update-key.d.ts.map +0 -1
  222. package/dist/handlers/update-key.js +0 -51
  223. package/dist/handlers/update-key.js.map +0 -1
  224. package/dist/lib/format.d.ts +0 -89
  225. package/dist/lib/format.d.ts.map +0 -1
  226. package/dist/lib/format.js +0 -180
  227. package/dist/lib/format.js.map +0 -1
  228. package/dist/lib/parse-access-options.d.ts +0 -38
  229. package/dist/lib/parse-access-options.d.ts.map +0 -1
  230. package/dist/lib/parse-access-options.js +0 -85
  231. package/dist/lib/parse-access-options.js.map +0 -1
  232. package/dist/middleware/auth.d.ts +0 -22
  233. package/dist/middleware/auth.d.ts.map +0 -1
  234. package/dist/middleware/auth.js +0 -48
  235. package/dist/middleware/auth.js.map +0 -1
  236. package/dist/middleware/require-grant-access.d.ts +0 -10
  237. package/dist/middleware/require-grant-access.d.ts.map +0 -1
  238. package/dist/middleware/require-grant-access.js +0 -14
  239. package/dist/middleware/require-grant-access.js.map +0 -1
  240. package/dist/schemas/api.d.ts.map +0 -1
  241. package/dist/schemas/api.js +0 -119
  242. package/dist/schemas/api.js.map +0 -1
  243. package/dist/server/routes.d.ts +0 -14
  244. package/dist/server/routes.d.ts.map +0 -1
  245. package/dist/server/routes.js +0 -200
  246. package/dist/server/routes.js.map +0 -1
package/README.md CHANGED
@@ -5,68 +5,53 @@ Remote credential storage server for a╳kit.
5
5
  ## Prerequisites
6
6
 
7
7
  - Node.js 22.19+
8
+ - PostgreSQL 14+ (local install or via Docker: `docker run -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:17-alpine`)
8
9
  - `pnpm` (for `pnpm dlx axvault`) or `npx` (for `npx -y axvault`)
9
- - `jq` for scripting against `--json` output
10
+ - `jq` for scripting against JSON API responses
10
11
 
11
12
  If `axvault` is not installed globally, prefix commands with `npx -y axvault` (or `pnpm dlx axvault`).
12
13
 
13
14
  ## Quick start
14
15
 
15
16
  ```bash
17
+ # Start PostgreSQL (if not already running)
18
+ docker run -d --name axvault-db -p 5432:5432 \
19
+ -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=axvault \
20
+ postgres:17-alpine
21
+
22
+ # Generate encryption key
16
23
  umask 077
17
24
  printf 'AXVAULT_ENCRYPTION_KEY=' > .env
18
25
  openssl rand -base64 32 >> .env
26
+ printf '\nAXVAULT_DATABASE_URL=postgresql://postgres:postgres@localhost:5432/axvault\n' >> .env
19
27
  chmod 600 .env
20
28
  set -a
21
29
  . ./.env
22
30
  set +a
23
- mkdir -p ./data
24
- npx -y axvault init
25
- npx -y axvault serve
26
- ```
27
-
28
- Keep the `.env` file and reuse the same key between restarts to avoid losing access to existing credentials.
29
-
30
- In a new shell, you must re-export the variables from `.env` before running `axvault` commands (the server does not load `.env` automatically).
31
-
32
- In another shell, create an API key:
33
-
34
- ```bash
35
- npx -y axvault key create --name "Admin" --read "*" --write "*" --grant "*"
36
- ```
37
-
38
- Add `--verbose` to commands like `init`, `serve`, `key revoke`, `key update`, and
39
- `credential delete` to see status output.
40
-
41
- ## Output formats
42
31
 
43
- List commands output TSV by default. Use `--json` on `key create`, `key list`,
44
- `key update`, and `credential list` for structured output (note: `key create
45
- --json` includes the secret key).
46
-
47
- ```bash
48
- npx -y axvault key list --json | jq -r '.[].id'
32
+ # Start server (runs migrations and creates bootstrap admin key on first startup)
33
+ npx -y axvault serve
49
34
  ```
50
35
 
51
- ## Pipeline examples
36
+ On first startup, axvault runs database migrations and creates a bootstrap admin API key with full access. The secret is printed to stderr — **save it immediately**, it cannot be retrieved later.
52
37
 
53
- ### Extract key IDs
38
+ Keep the `.env` file and reuse the same encryption key between restarts to avoid losing access to existing credentials.
54
39
 
55
- ```bash
56
- npx -y axvault key list | tail -n +2 | cut -f1
57
- ```
40
+ ## Architecture
58
41
 
59
- ### Count credentials by creation date
42
+ axvault is a server-only tool. The CLI has a single command (`serve`) that starts the HTTP server. All key and credential management is done through the HTTP API.
60
43
 
61
- ```bash
62
- npx -y axvault credential list --json | jq -r '.[].createdAt | split("T")[0]' | sort | uniq -c | sort -rn
63
- ```
44
+ On startup, the server:
64
45
 
65
- ### List credential names in the `claude` namespace
46
+ 1. Runs database migrations (idempotent, so they are safe to re-run on every startup)
47
+ 2. Creates a bootstrap admin API key if no keys exist (serialized with an advisory lock, prints secret to stderr)
48
+ 3. Starts listening for HTTP requests
66
49
 
67
- ```bash
68
- npx -y axvault credential list | tail -n +2 | awk -F'\t' '$1 ~ /^claude\./ {print $1}'
69
- ```
50
+ Migration files must remain replay-safe because axvault re-runs them on every
51
+ startup instead of tracking applied versions. Use guarded SQL such as
52
+ `CREATE ... IF NOT EXISTS` or `ALTER ... ADD COLUMN IF NOT EXISTS`. If a future
53
+ schema change cannot be written safely that way, switch back to tracked
54
+ migrations rather than adding a one-shot file to this runner.
70
55
 
71
56
  ## Agent Rule
72
57
 
@@ -77,24 +62,24 @@ Add to your `CLAUDE.md` or `AGENTS.md`:
77
62
 
78
63
  Run `npx -y axvault --help` to learn available options.
79
64
 
80
- Use `axvault` when you need to initialize the vault database, manage API keys,
81
- or list/delete stored credentials. List commands output TSV by default; add
82
- `--json` for structured output you can pipe into `jq`.
65
+ Use `axvault serve` to start the credential vault server. All key and credential
66
+ management is done via the HTTP API. On first startup, a bootstrap admin API key
67
+ is created and printed to stderr.
83
68
  ```
84
69
 
85
70
  ## Configuration
86
71
 
87
72
  ### Environment Variables
88
73
 
89
- | Variable | Description | Default |
90
- | ---------------------------- | -------------------------------------------------------------------- | ------------------- |
91
- | `AXVAULT_PORT` | Port to listen on | `3847` |
92
- | `AXVAULT_HOST` | Host to bind to | `127.0.0.1` |
93
- | `AXVAULT_DB_PATH` | Database file path | `./data/axvault.db` |
94
- | `AXVAULT_ENCRYPTION_KEY` | Encryption key (min 32 chars, required) | — |
95
- | `AXVAULT_REFRESH_THRESHOLD` | Refresh credentials expiring within this many seconds (0 to disable) | `3600` |
96
- | `AXVAULT_REFRESH_TIMEOUT_MS` | Timeout for refresh operations in milliseconds | `30000` |
97
- | `AXVAULT_LOG_LEVEL` | Log level (trace, debug, info, warn, error, fatal, silent) | `info` |
74
+ | Variable | Description | Default |
75
+ | ---------------------------- | -------------------------------------------------------------------- | ------------------------------------- |
76
+ | `AXVAULT_PORT` | Port to listen on | `3847` |
77
+ | `AXVAULT_HOST` | Host to bind to | `127.0.0.1` |
78
+ | `AXVAULT_DATABASE_URL` | PostgreSQL connection URL | `postgresql://localhost:5432/axvault` |
79
+ | `AXVAULT_ENCRYPTION_KEY` | Encryption key (min 32 chars, required) | — |
80
+ | `AXVAULT_REFRESH_THRESHOLD` | Refresh credentials expiring within this many seconds (0 to disable) | `3600` |
81
+ | `AXVAULT_REFRESH_TIMEOUT_MS` | Timeout for refresh operations in milliseconds | `30000` |
82
+ | `AXVAULT_LOG_LEVEL` | Log level (trace, debug, info, warn, error, fatal, silent) | `info` |
98
83
 
99
84
  ### CLI Flags
100
85
 
@@ -104,7 +89,7 @@ The `serve` command accepts flags that override environment variables:
104
89
  npx -y axvault serve \
105
90
  --port 8080 \
106
91
  --host 0.0.0.0 \
107
- --db-path /data/vault.db \
92
+ --database-url postgresql://localhost:5432/axvault \
108
93
  --refresh-threshold 7200 \
109
94
  --refresh-timeout 60000 \
110
95
  --log-level debug
@@ -112,86 +97,60 @@ npx -y axvault serve \
112
97
 
113
98
  Setting `--refresh-threshold 0` disables automatic credential refresh.
114
99
 
115
- ## Confirmation flags
116
-
117
- Destructive commands require confirmation: `axvault key revoke` and `axvault
118
- credential delete` require `--force` (alias `--yes`).
119
-
120
100
  ## API Keys
121
101
 
122
102
  API keys control access to the credential API. Each key has configurable permissions:
123
103
 
124
104
  - **Read**: retrieve credentials
125
105
  - **Write**: store and delete credentials
126
- - **Grant**: delegate access to other keys (enforcement coming in future release)
127
-
128
- ### Create an API Key
106
+ - **Grant**: manage other API keys
129
107
 
130
- ```bash
131
- # Full access (read, write, and grant)
132
- npx -y axvault key create --name "Admin" --read "*" --write "*" --grant "*"
108
+ ### Bootstrap Key
133
109
 
134
- # Read/write access only
135
- npx -y axvault key create --name "CI Pipeline" --read "*" --write "*"
110
+ On first startup (when no keys exist), axvault creates a "Bootstrap Admin" key with full access (`*` for read, write, and grant). The secret is printed to stderr.
136
111
 
137
- # Restricted access
138
- npx -y axvault key create --name "Claude Reader" --read "claude.work,claude.ci"
139
- npx -y axvault key create --name "Deploy Script" --write "claude.prod,codex.prod"
112
+ ### Managing Keys via API
140
113
 
141
- # Grant-only key (for delegation, does not allow direct read/write)
142
- npx -y axvault key create --name "Issuer" --grant "claude.work,claude.ci"
143
- ```
144
-
145
- The command outputs metadata to stderr and the secret key to stdout for easy piping:
146
-
147
- ```
148
- # stderr (visible in terminal):
149
- Created API key: CI Pipeline
150
- ID: k_a1b2c3d4e5f6
151
- Read access: *
152
- Write access: *
153
- Grant access: (none)
114
+ All key management is done through the HTTP API:
154
115
 
155
- Save this key securely - it cannot be retrieved later.
156
-
157
- # stdout (can be piped):
158
- axv_sk_0123456789abcdef0123456789abcdef
159
- ```
160
-
161
- To copy directly to clipboard: `npx -y axvault key create --name "My Key" --read "*" | pbcopy`
162
-
163
- ### List Keys
164
-
165
- ```bash
166
- npx -y axvault key list
167
- ```
168
-
169
- ### Update a Key
170
-
171
- Modify an existing key's permissions:
116
+ - `POST /api/v1/keys` accepts either a bootstrap/admin key or a scoped grant
117
+ key, as long as every requested read/write/grant entry stays within the
118
+ caller's `grantAccess` list.
119
+ - `PATCH /api/v1/keys/:id` only works when the target key's current and resulting
120
+ permissions both stay within the caller's `grantAccess` list. In practice,
121
+ scoped grant keys can only update keys that are already fully inside their
122
+ scope.
123
+ - `GET /api/v1/keys`, `GET /api/v1/keys/:id`, and `DELETE /api/v1/keys/:id`
124
+ require full grant access (`grantAccess: ["*"]`).
172
125
 
173
126
  ```bash
174
- # Add read access for new credentials
175
- npx -y axvault key update k_a1b2c3d4e5f6 --add-read "gemini.prod"
127
+ API_KEY="axv_sk_..." # Bootstrap/admin key with grantAccess ["*"]
176
128
 
177
- # Remove write access
178
- npx -y axvault key update k_a1b2c3d4e5f6 --remove-write "claude.test"
129
+ # Create a new key
130
+ curl -X POST https://vault.example.com/api/v1/keys \
131
+ -H "Authorization: Bearer $API_KEY" \
132
+ -H "Content-Type: application/json" \
133
+ -d '{"name": "CI Pipeline", "readAccess": ["*"], "writeAccess": ["*"], "grantAccess": []}'
179
134
 
180
- # Add grant permissions
181
- npx -y axvault key update k_a1b2c3d4e5f6 --add-grant "claude.work"
135
+ # List all keys
136
+ curl https://vault.example.com/api/v1/keys \
137
+ -H "Authorization: Bearer $API_KEY"
182
138
 
183
- # Multiple changes at once
184
- npx -y axvault key update k_a1b2c3d4e5f6 --add-read "codex.ci" --remove-write "claude.dev"
185
- ```
139
+ # Get a single key
140
+ curl https://vault.example.com/api/v1/keys/k_a1b2c3d4e5f6 \
141
+ -H "Authorization: Bearer $API_KEY"
186
142
 
187
- ### Revoke a Key
143
+ # Update key permissions
144
+ curl -X PATCH https://vault.example.com/api/v1/keys/k_a1b2c3d4e5f6 \
145
+ -H "Authorization: Bearer $API_KEY" \
146
+ -H "Content-Type: application/json" \
147
+ -d '{"readAccess": ["claude.work", "codex.ci"]}'
188
148
 
189
- ```bash
190
- npx -y axvault key revoke k_a1b2c3d4e5f6 --force
149
+ # Revoke a key
150
+ curl -X DELETE https://vault.example.com/api/v1/keys/k_a1b2c3d4e5f6 \
151
+ -H "Authorization: Bearer $API_KEY"
191
152
  ```
192
153
 
193
- This command requires `--force` or `--yes` to confirm.
194
-
195
154
  ### Container Deployments
196
155
 
197
156
  Container images are published automatically to `registry.j4k.dev/axvault` on every release (multi-arch: amd64 + arm64). To rebuild manually, run `workflow_dispatch` on `publish-image` and provide the required `version` input (for example `1.7.0`).
@@ -203,13 +162,13 @@ The image uses an external UID pattern—no user is baked into the image. **Alwa
203
162
  > **Security note:** Without `-u`/`--user`, the container runs as root. For Kubernetes, set `runAsUser: 1000` and `runAsNonRoot: true` in your SecurityContext.
204
163
 
205
164
  ```bash
206
- # Docker
165
+ # Docker (requires a PostgreSQL instance accessible from the container)
207
166
  docker run -d \
208
167
  --name axvault \
209
168
  -p 3847:3847 \
210
169
  -u 1000:1000 \
211
170
  -e AXVAULT_ENCRYPTION_KEY="your-secret-key-minimum-32-chars!" \
212
- -v /srv/axvault/data:/data \
171
+ -e AXVAULT_DATABASE_URL="postgresql://user:pass@db-host:5432/axvault" \
213
172
  registry.j4k.dev/axvault:latest
214
173
 
215
174
  # Podman
@@ -218,29 +177,25 @@ podman run -d \
218
177
  -p 3847:3847 \
219
178
  --user 1000:1000 \
220
179
  -e AXVAULT_ENCRYPTION_KEY="your-secret-key-minimum-32-chars!" \
221
- -v /srv/axvault/data:/data:Z \
180
+ -e AXVAULT_DATABASE_URL="postgresql://user:pass@db-host:5432/axvault" \
222
181
  registry.j4k.dev/axvault:latest
223
182
  ```
224
183
 
225
- #### Volume Ownership
184
+ **Note:** `AXVAULT_DATABASE_URL` must point to an accessible PostgreSQL instance. The Containerfile default (`postgresql://localhost:5432/axvault`) refers to the container itself, so standalone `docker run` users must provide this variable. For a batteries-included setup, use `docker-compose.yml` which includes a PostgreSQL service.
226
185
 
227
- The data volume must be owned by the UID/GID the container runs as:
228
-
229
- ```bash
230
- # Create directory and set ownership before first run
231
- sudo mkdir -p /srv/axvault/data
232
- sudo chown 1000:1000 /srv/axvault/data
233
- ```
234
-
235
- For rootless Podman, use your user's UID or let Podman handle mapping automatically.
186
+ The bootstrap admin key is created on first startup and printed to the container logs. Retrieve it with `docker logs axvault` or `podman logs axvault`.
236
187
 
237
188
  #### Quadlet (systemd)
238
189
 
190
+ This example references `axvault-db.service`, which is a PostgreSQL container you must provide separately as a companion Quadlet (`axvault-db.container`). Alternatively, point `AXVAULT_DATABASE_URL` at an existing PostgreSQL instance and remove the `Requires`/`After` lines.
191
+
239
192
  Create `/etc/containers/systemd/axvault.container`:
240
193
 
241
194
  ```ini
242
195
  [Unit]
243
196
  Description=axvault credential server
197
+ Requires=axvault-db.service
198
+ After=axvault-db.service
244
199
 
245
200
  [Container]
246
201
  Image=registry.j4k.dev/axvault:latest
@@ -248,7 +203,7 @@ PublishPort=3847:3847
248
203
  User=1000
249
204
  Group=1000
250
205
  Environment=AXVAULT_ENCRYPTION_KEY=your-secret-key-minimum-32-chars!
251
- Volume=/srv/axvault/data:/data:Z
206
+ Environment=AXVAULT_DATABASE_URL=postgresql://axvault:axvault@axvault-db:5432/axvault
252
207
 
253
208
  [Service]
254
209
  Restart=always
@@ -264,18 +219,6 @@ sudo systemctl daemon-reload
264
219
  sudo systemctl start axvault
265
220
  ```
266
221
 
267
- #### Managing Keys in Containers
268
-
269
- Exec into the container to manage API keys:
270
-
271
- ```bash
272
- # Podman
273
- sudo podman exec axvault node /app/node_modules/axvault/bin/axvault key create --name "My Key" --read "*" --write "*"
274
-
275
- # Docker
276
- docker exec axvault node /app/node_modules/axvault/bin/axvault key create --name "My Key" --read "*" --write "*"
277
- ```
278
-
279
222
  ## Credentials API
280
223
 
281
224
  ### Store a Credential
@@ -454,13 +397,13 @@ Alternatively, use separate environment variables:
454
397
 
455
398
  ### Common Errors
456
399
 
457
- | Error | Cause | Solution |
458
- | ---------------- | ------------------------------------------ | --------------------------------------------------------------------------------------- |
459
- | `not-configured` | Missing `AXVAULT_URL` or `AXVAULT_API_KEY` | Set both environment variables or use `AXVAULT` JSON |
460
- | `unauthorized` | Invalid API key | Verify key with `npx -y axvault key list`, create new if needed |
461
- | `forbidden` | No access to credential | Add credential to key's read access: `npx -y axvault key update <id> --add-read <path>` |
462
- | `not-found` | Credential doesn't exist | Store credential first: `axauth vault push --agent <agent> --name <name>` |
463
- | `unreachable` | Network issue or server down | Check vault URL, verify server is running |
400
+ | Error | Cause | Solution |
401
+ | ---------------- | ------------------------------------------ | ------------------------------------------------------------------------- |
402
+ | `not-configured` | Missing `AXVAULT_URL` or `AXVAULT_API_KEY` | Set both environment variables or use `AXVAULT` JSON |
403
+ | `unauthorized` | Invalid API key | Check the key via the keys API, create a new one if needed |
404
+ | `forbidden` | No access to credential | Update key permissions via `PATCH /api/v1/keys/:id` |
405
+ | `not-found` | Credential doesn't exist | Store credential first: `axauth vault push --agent <agent> --name <name>` |
406
+ | `unreachable` | Network issue or server down | Check vault URL, verify server is running |
464
407
 
465
408
  ### Debugging
466
409
 
@@ -470,10 +413,11 @@ Alternatively, use separate environment variables:
470
413
  curl -I $AXVAULT_URL/api/v1/health
471
414
  ```
472
415
 
473
- 2. Verify API key permissions:
416
+ 2. List API keys (requires grant access):
474
417
 
475
418
  ```bash
476
- npx -y axvault key list # on server
419
+ curl -H "Authorization: Bearer $AXVAULT_API_KEY" \
420
+ $AXVAULT_URL/api/v1/keys
477
421
  ```
478
422
 
479
423
  3. Check credential exists:
package/dist/cli.d.ts CHANGED
@@ -2,7 +2,8 @@
2
2
  /**
3
3
  * axvault - Remote credential storage server for axkit.
4
4
  *
5
- * Stores agent credentials and serves them via API.
5
+ * Starts the vault server. All key and credential management is done
6
+ * via the HTTP API once the server is running.
6
7
  */
7
8
  export {};
8
9
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
package/dist/cli.js CHANGED
@@ -2,13 +2,11 @@
2
2
  /**
3
3
  * axvault - Remote credential storage server for axkit.
4
4
  *
5
- * Stores agent credentials and serves them via API.
5
+ * Starts the vault server. All key and credential management is done
6
+ * via the HTTP API once the server is running.
6
7
  */
7
8
  import { Command } from "@commander-js/extra-typings";
8
9
  import packageJson from "../package.json" with { type: "json" };
9
- import { handleCredentialDelete, handleCredentialList, } from "./commands/credential.js";
10
- import { handleInit } from "./commands/init.js";
11
- import { handleKeyCreate, handleKeyList, handleKeyRevoke, handleKeyUpdate, } from "./commands/key.js";
12
10
  import { handleServe } from "./commands/serve.js";
13
11
  const program = new Command()
14
12
  .name(packageJson.name)
@@ -19,121 +17,24 @@ const program = new Command()
19
17
  .helpCommand(false)
20
18
  .addHelpText("after", String.raw `
21
19
  Examples:
22
- # Initialize database
23
- axvault init
24
-
25
- # Start server
20
+ # Start server (runs migrations and creates bootstrap key on first run)
26
21
  axvault serve
27
22
 
28
23
  # Start server on custom port
29
24
  axvault serve --port 8080
30
25
 
31
- # Create an API key with read access (at least one of --read/--write required)
32
- axvault key create --name "CI Pipeline" --read "claude.work,codex.ci"
33
-
34
- # Create a write-only API key
35
- axvault key create --name "Uploader" --write "claude.backups"
36
-
37
- # Create an admin API key with full access
38
- axvault key create --name "Admin" --read "*" --write "*" --grant "*"
39
-
40
- # List all API keys
41
- axvault key list
42
-
43
- # Extract key IDs for scripting (pipeline example)
44
- axvault key list | tail -n +2 | cut -f1
45
-
46
- # Update an API key's permissions
47
- axvault key update k_abc123def456 --add-read "claude.new"
48
-
49
- # Revoke an API key
50
- axvault key revoke k_abc123def456 --force
51
-
52
- # List all stored credentials
53
- axvault credential list
54
-
55
- # Delete a credential
56
- axvault credential delete claude.work --force`);
57
- program
58
- .command("init")
59
- .description("Initialize database and configuration")
60
- .option("--db-path <path>", "Database file path")
61
- .option("-v, --verbose", "Enable verbose output")
62
- .action(handleInit);
26
+ # Start with debug logging
27
+ axvault serve --log-level debug`);
63
28
  program
64
29
  .command("serve")
65
30
  .description("Start the vault server")
66
31
  .option("-p, --port <port>", "Port to listen on")
67
32
  .option("-H, --host <host>", "Host to bind to")
68
- .option("--db-path <path>", "Database file path")
33
+ .option("--database-url <url>", "PostgreSQL connection URL")
69
34
  .option("--refresh-threshold <seconds>", "Refresh credentials expiring within this many seconds (0 to disable)")
70
35
  .option("--refresh-timeout <ms>", "Timeout for refresh operations in milliseconds")
71
36
  .option("--log-level <level>", "Log level (trace, debug, info, warn, error, fatal, silent)")
72
37
  .option("-v, --verbose", "Enable verbose output")
73
38
  .action(handleServe);
74
- // API key management commands
75
- const keyCommand = program
76
- .command("key")
77
- .description("Manage API keys")
78
- .helpCommand(false);
79
- keyCommand
80
- .command("create")
81
- .description("Create a new API key")
82
- .requiredOption("-n, --name <name>", "Name for the API key")
83
- .option("-r, --read <access>", "Comma-separated read access list (e.g., 'claude.work,codex.ci' or '*')")
84
- .option("-w, --write <access>", "Comma-separated write access list (e.g., 'claude.ci' or '*')")
85
- .option("-g, --grant <access>", "Comma-separated grant access list (can delegate these to other keys)")
86
- .option("--json", "Output as JSON")
87
- .option("--db-path <path>", "Database file path")
88
- .action(handleKeyCreate);
89
- keyCommand
90
- .command("list")
91
- .description("List all API keys")
92
- .option("--json", "Output as JSON")
93
- .option("--db-path <path>", "Database file path")
94
- .action(handleKeyList);
95
- keyCommand
96
- .command("revoke")
97
- .description("Revoke an API key")
98
- .argument("<id>", "API key ID (e.g., k_abc123def456)")
99
- .option("-f, --force", "Confirm destructive action")
100
- .option("-y, --yes", "Alias for --force")
101
- .option("-v, --verbose", "Enable verbose output")
102
- .option("--db-path <path>", "Database file path")
103
- .action(handleKeyRevoke);
104
- keyCommand
105
- .command("update")
106
- .description("Update an API key's permissions")
107
- .argument("<id>", "API key ID (e.g., k_abc123def456)")
108
- .option("--add-read <access>", "Add read access entries")
109
- .option("--add-write <access>", "Add write access entries")
110
- .option("--add-grant <access>", "Add grant access entries")
111
- .option("--remove-read <access>", "Remove read access entries")
112
- .option("--remove-write <access>", "Remove write access entries")
113
- .option("--remove-grant <access>", "Remove grant access entries")
114
- .option("--json", "Output as JSON")
115
- .option("-v, --verbose", "Enable verbose output")
116
- .option("--db-path <path>", "Database file path")
117
- .action(handleKeyUpdate);
118
- // Credential management commands
119
- const credentialCommand = program
120
- .command("credential")
121
- .description("Manage stored credentials")
122
- .helpCommand(false);
123
- credentialCommand
124
- .command("list")
125
- .description("List all stored credentials")
126
- .option("--json", "Output as JSON")
127
- .option("--db-path <path>", "Database file path")
128
- .action(handleCredentialList);
129
- credentialCommand
130
- .command("delete")
131
- .description("Delete a credential")
132
- .argument("<name>", "Credential name (e.g., claude.work)")
133
- .option("-f, --force", "Confirm destructive action")
134
- .option("-y, --yes", "Alias for --force")
135
- .option("-v, --verbose", "Enable verbose output")
136
- .option("--db-path <path>", "Database file path")
137
- .action(handleCredentialDelete);
138
39
  await program.parseAsync(process.argv);
139
40
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.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EvB,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * Start server command handler.
3
+ *
4
+ * Builds the Fastify app, registers plugins in dependency order
5
+ * (database → auth → routes), runs migrations, creates a bootstrap
6
+ * API key on first startup, and starts listening.
3
7
  */
4
8
  interface ServeOptions {
5
9
  port?: string;
6
10
  host?: string;
7
- dbPath?: string;
11
+ databaseUrl?: string;
8
12
  refreshThreshold?: string;
9
13
  refreshTimeout?: string;
10
14
  logLevel?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAAA;;GAEG;AAiBH,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA+GtE"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../src/commands/serve.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAkBH,UAAU,YAAY;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA2GtE"}