fix: rename API Keys -> Sub-Keys, show key inline on creation, no reload

This commit is contained in:
M1
2026-03-17 06:37:29 +04:00
parent ab4f60e159
commit c684d96d90
2 changed files with 21 additions and 20 deletions
+2 -2
View File
@@ -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'" }),