MCPcopy Create free account
hub / github.com/claude-code-best/claude-code / prefetchGcpCredentialsIfSafe

Function prefetchGcpCredentialsIfSafe

src/utils/auth.ts:990–1010  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

988 * Returns void to prevent misuse - use refreshGcpCredentialsIfNeeded() to actually refresh.
989 */
990export function prefetchGcpCredentialsIfSafe(): void {
991 // Check if gcpAuthRefresh is configured
992 const gcpAuthRefresh = getConfiguredGcpAuthRefresh()
993
994 if (!gcpAuthRefresh) {
995 return
996 }
997
998 // Check if gcpAuthRefresh is from project settings
999 if (isGcpAuthRefreshFromProjectSettings()) {
1000 // Only prefetch if trust has already been established
1001 const hasTrust = checkHasTrustDialogAccepted()
1002 if (!hasTrust && !getIsNonInteractiveSession()) {
1003 // Don't prefetch - wait for trust to be established first
1004 return
1005 }
1006 }
1007
1008 // Safe to prefetch - either not from project settings or trust already established
1009 void refreshGcpCredentialsIfNeeded()
1010}
1011
1012/**
1013 * Prefetches AWS credentials only if workspace trust has already been established.

Callers 1

startDeferredPrefetchesFunction · 0.85

Tested by

no test coverage detected