"use client";
import { useStigmer } from "../hooks";
import { useFetch } from "../internal/useFetch";
/**
 * Data hook that fetches all {@link ApiKey} entries for the
 * authenticated identity.
 *
 * API keys are identity-scoped — the server returns every key owned
 * by the identity in the auth header, regardless of organization.
 * Call `refetch()` to re-query after mutations (create / delete).
 *
 * The raw key value is never returned by `findAll` — only the
 * `fingerprint` (last 6 characters) is available for display.
 *
 * @example
 * ```tsx
 * const { apiKeys, isLoading, error, refetch } = useApiKeyList();
 *
 * if (isLoading) return <Spinner />;
 * apiKeys.map((k) => k.metadata?.name);
 * ```
 */
export function useApiKeyList() {
    const stigmer = useStigmer();
    const { data: apiKeys, isLoading, isRefetching, error, refetch } = useFetch(() => stigmer.apiKey.findAll().then((r) => [...r.entries]), [stigmer], []);
    return { apiKeys, isLoading, isRefetching, error, refetch };
}
//# sourceMappingURL=useApiKeyList.js.map