diff --git a/apps/web/src/routes/auth.ts b/apps/web/src/routes/auth.ts index 444b8ca..e417ff9 100644 --- a/apps/web/src/routes/auth.ts +++ b/apps/web/src/routes/auth.ts @@ -192,8 +192,8 @@ export const account = new Elysia({ prefix: "/account" }) const keyLookup = sha256(norm); const keyHash = await Bun.password.hash(norm, { algorithm: "bcrypt", cost: 10 }); - await sql`INSERT INTO api_keys (key_lookup, key_hash, account_id, label) VALUES (${keyLookup}, ${keyHash}, ${accountId}, ${body.label})`; - return { key: rawKey, label: body.label }; + const [created] = await sql`INSERT INTO api_keys (key_lookup, key_hash, account_id, label) VALUES (${keyLookup}, ${keyHash}, ${accountId}, ${body.label}) RETURNING id`; + return { key: rawKey, id: created.id, label: body.label }; }, { body: t.Object({ label: t.String({ description: "A name for this key, e.g. 'ci-pipeline' or 'mobile-app'" }), diff --git a/apps/web/src/views/settings.ejs b/apps/web/src/views/settings.ejs index 395f313..39f3cdd 100644 --- a/apps/web/src/views/settings.ejs +++ b/apps/web/src/views/settings.ejs @@ -49,10 +49,10 @@
-

API Keys

+

Sub-Keys

Create separate keys for different apps, scripts, or teammates.

- +
@@ -66,19 +66,19 @@ - + - +
<% if (it.apiKeys.length === 0) { %> -

No API keys yet.

+

No sub-keys yet.

<% } else { %> <% it.apiKeys.forEach(function(k) { %>
@@ -97,15 +97,7 @@