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

Function prefetchGcpCredentialsIfSafe

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

Source from the content-addressed store, hash-verified

1066 * Returns void to prevent misuse - use refreshGcpCredentialsIfNeeded() to actually refresh.
1067 */
1068export function prefetchGcpCredentialsIfSafe(): void {
1069 // Check if gcpAuthRefresh is configured
1070 const gcpAuthRefresh = getConfiguredGcpAuthRefresh()
1071
1072 if (!gcpAuthRefresh) {
1073 return
1074 }
1075
1076 // Check if gcpAuthRefresh is from project settings
1077 if (isGcpAuthRefreshFromProjectSettings()) {
1078 // Only prefetch if trust has already been established
1079 const hasTrust = checkHasTrustDialogAccepted()
1080 if (!hasTrust && !getIsNonInteractiveSession()) {
1081 // Don't prefetch - wait for trust to be established first
1082 return
1083 }
1084 }
1085
1086 // Safe to prefetch - either not from project settings or trust already established
1087 void refreshGcpCredentialsIfNeeded()
1088}
1089
1090/**
1091 * Prefetches AWS credentials only if workspace trust has already been established.

Callers 1

Tested by

no test coverage detected