@basaltkit/api-keys-ui 1.4.0 → 1.4.2
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 +2 -2
- package/dist/html.js +3 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Self-contained HTML page to **manage API keys** for [`@basaltkit/auth`](https://
|
|
|
10
10
|
|
|
11
11
|
## What this module solves
|
|
12
12
|
|
|
13
|
-
`@basaltkit/auth` already exposes the `POST/GET /apikeys` and `DELETE /apikeys/:id` routes (the plaintext key only appears on creation). This module is the **UI** on top of them: a page that lists the keys, lets you create a new one (revealing the secret once, with a copy button) and revoke existing ones.
|
|
13
|
+
`@basaltkit/auth` already exposes the `POST/GET /apikeys` and `DELETE /apikeys/:id` routes (the plaintext key only appears on creation), plus `PATCH /apikeys/:id` and `POST /apikeys/:id/rotate`, which this page does not use yet. This module is the **UI** on top of them: a page that lists the keys, lets you create a new one (revealing the secret once, with a copy button) and revoke existing ones.
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ Self-contained HTML page to **manage API keys** for [`@basaltkit/auth`](https://
|
|
|
18
18
|
pnpm add @basaltkit/api-keys-ui
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Depends on `@basaltkit/core` and `@basaltkit/
|
|
21
|
+
Depends on `@basaltkit/core` and `@basaltkit/http` (3.x) — not on any single adapter. Requires your app to mount the API key routes from `@basaltkit/auth` (`apiKeysPlugin` + `apiKeyRoutes`).
|
|
22
22
|
|
|
23
23
|
## Getting started in 5 minutes
|
|
24
24
|
|
package/dist/html.js
CHANGED
|
@@ -53,7 +53,8 @@ document.getElementById('create').addEventListener('submit', async (e) => {
|
|
|
53
53
|
const expiration = String(f.get('expiresAt') || '');
|
|
54
54
|
const expiresAt = expiration ? new Date(expiration).getTime() : undefined;
|
|
55
55
|
if (expiration && !Number.isFinite(expiresAt)) { showError('Choose a valid expiration date.'); return; }
|
|
56
|
-
|
|
56
|
+
if (!scopes.length) { showError('Name at least one scope, or * for a key with every permission you have.'); return; }
|
|
57
|
+
const body = JSON.stringify({ name: f.get('name'), scopes, ...(expiresAt !== undefined ? { expiresAt } : {}) });
|
|
57
58
|
try {
|
|
58
59
|
const created = await fetch(API + '/apikeys', { ...opts, method: 'POST', body }).then(json);
|
|
59
60
|
document.getElementById('error').style.display = 'none';
|
|
@@ -128,7 +129,7 @@ export function apiKeysPageHtml(options = {}) {
|
|
|
128
129
|
<div class="card">
|
|
129
130
|
<form id="create">
|
|
130
131
|
<label>Name<input name="name" placeholder="CI pipeline" required /></label>
|
|
131
|
-
<label>Scopes (comma-separated)<input name="scopes" placeholder="read, write" /></label>
|
|
132
|
+
<label>Scopes (comma-separated; * for every permission you have)<input name="scopes" placeholder="reports:read, invoices:write" required /></label>
|
|
132
133
|
<label>Expires (optional)<input name="expiresAt" type="datetime-local" /></label>
|
|
133
134
|
<button class="primary" type="submit">Create key</button>
|
|
134
135
|
</form>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@basaltkit/api-keys-ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=22.5.0"
|
|
6
6
|
},
|
|
@@ -19,16 +19,16 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@basaltkit/core": "^1.6.0",
|
|
22
|
-
"@basaltkit/http": "^
|
|
22
|
+
"@basaltkit/http": "^3.0.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^26.6.
|
|
25
|
+
"@types/node": "^26.6.5",
|
|
26
26
|
"typescript": "^7.0.2",
|
|
27
|
-
"vitest": "^5.0.
|
|
28
|
-
"zod": "^4.6.
|
|
29
|
-
"@basaltkit/auth": "^
|
|
30
|
-
"@basaltkit/fastify": "^
|
|
31
|
-
"@basaltkit/tenancy": "^
|
|
27
|
+
"vitest": "^5.0.5",
|
|
28
|
+
"zod": "^4.6.7",
|
|
29
|
+
"@basaltkit/auth": "^5.2.0",
|
|
30
|
+
"@basaltkit/fastify": "^3.0.0",
|
|
31
|
+
"@basaltkit/tenancy": "^4.4.0",
|
|
32
32
|
"@basaltkit/tsconfig": "^0.24.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|