Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/server/src/provider/cursorCredentialStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import * as NodeModule from "node:module";

const CACHE_MS = 5 * 60_000;

const requireForKeyring = NodeModule.createRequire(import.meta.url);

/** Share one Keychain request across usage history and limits in this server process. */
export function makeCachedCursorAccessTokenReader(
read: () => Promise<string | null>,
Expand All @@ -24,6 +28,6 @@ export function makeCachedCursorAccessTokenReader(

/** Read the Cursor CLI's default macOS credential without invoking the shared security binary. */
export const readMacCursorAccessToken = makeCachedCursorAccessTokenReader(async () => {
const { AsyncEntry } = await import("@napi-rs/keyring");
const { AsyncEntry } = requireForKeyring("@napi-rs/keyring") as typeof import("@napi-rs/keyring");
return (await new AsyncEntry("cursor-access-token", "cursor-user").getPassword()) ?? null;
});
Loading