- Add ApiKey Prisma model (SHA-256 hash, prefix, lastUsedAt) with migration - Implement ApiKeyService (create, list, delete, verify) - Extend requireAuth middleware to accept sk_-prefixed API keys alongside JWTs - Add GET/POST /api-keys routes for creating and revoking keys - Add stateless Streamable HTTP MCP server at POST/GET /mcp exposing all 20 time-tracking tools (clients, projects, time entries, timer, statistics, client targets and corrections) - Frontend: ApiKey types, apiKeys API module, useApiKeys hook - Frontend: ApiKeysPage with key table, one-time raw-key reveal modal, and inline revoke confirmation - Wire /api-keys route and add API Keys link to Management dropdown in Navbar
19 lines
544 B
TypeScript
19 lines
544 B
TypeScript
import apiClient from './client';
|
|
import type { ApiKey, CreatedApiKey, CreateApiKeyInput } from '@/types';
|
|
|
|
export const apiKeysApi = {
|
|
getAll: async (): Promise<ApiKey[]> => {
|
|
const { data } = await apiClient.get<ApiKey[]>('/api-keys');
|
|
return data;
|
|
},
|
|
|
|
create: async (input: CreateApiKeyInput): Promise<CreatedApiKey> => {
|
|
const { data } = await apiClient.post<CreatedApiKey>('/api-keys', input);
|
|
return data;
|
|
},
|
|
|
|
delete: async (id: string): Promise<void> => {
|
|
await apiClient.delete(`/api-keys/${id}`);
|
|
},
|
|
};
|