feat: limit api keys to actions when they are made

This commit is contained in:
LukeGus committed 2026-11-04 06:29:49 -06:00
1 parent 03029cd372
commit 2e79bf9d0d
8 files changed
+47 -5

No files matched your search

+4
View File
@@ -87,6 +87,8 @@ export interface ApiKey {
expiresAt: string | null;
lastUsedAt: string | null;
isActive: boolean;
/** Null for full access. */
scopes?: string[] | null;
}
export interface CreatedApiKey extends ApiKey {
@@ -97,12 +99,14 @@ export async function createApiKey(
name: string,
userId: string,
expiresAt?: string,
scopes?: string[] | null,
): Promise<CreatedApiKey> {
try {
const response = await authApi.post("/users/api-keys", {
name,
userId,
expiresAt: expiresAt ?? null,
scopes: scopes?.length ? scopes : null,
});
return response.data;
} catch (error) {