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

Function prefetchGcpCredentialsIfSafe

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

Source from the content-addressed store, hash-verified

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

Callers 1

startDeferredPrefetchesFunction · 0.85

Tested by

no test coverage detected