MCPcopy
hub / github.com/codeaashu/claude-code / prefetchGcpCredentialsIfSafe

Function prefetchGcpCredentialsIfSafe

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

Source from the content-addressed store, hash-verified

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

Callers 1

startDeferredPrefetchesFunction · 0.85

Tested by

no test coverage detected