MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / handleAuthLoad

Function handleAuthLoad

crates/opencode-plugin/host/plugin-host.ts:535–556  ·  view source on GitHub ↗
(id: number)

Source from the content-addressed store, hash-verified

533}
534
535async function handleAuthLoad(id: number): Promise<void> {
536 if (!authHook?.loader) {
537 sendError(id, -32601, "No auth.loader handler");
538 return;
539 }
540
541 try {
542 const loaded = await authHook.loader();
543 const hasCustomFetch = typeof loaded.fetch === "function";
544 if (hasCustomFetch) {
545 customFetch = loaded.fetch!;
546 }
547
548 sendResult(id, {
549 apiKey: loaded.apiKey,
550 hasCustomFetch,
551 });
552 } catch (err: unknown) {
553 const msg = err instanceof Error ? err.message : String(err);
554 sendError(id, -32603, `auth.load failed: ${msg}`);
555 }
556}
557
558async function handleAuthFetch(
559 id: number,

Callers 1

mainFunction · 0.85

Calls 2

sendErrorFunction · 0.85
sendResultFunction · 0.85

Tested by

no test coverage detected