()
| 1042 | * Returns void to prevent misuse - use refreshGcpCredentialsIfNeeded() to actually refresh. |
| 1043 | */ |
| 1044 | export function prefetchGcpCredentialsIfSafe(): void { |
| 1045 | // Check if gcpAuthRefresh is configured |
| 1046 | const gcpAuthRefresh = getConfiguredGcpAuthRefresh() |
| 1047 | |
| 1048 | if (!gcpAuthRefresh) { |
| 1049 | return |
| 1050 | } |
| 1051 | |
| 1052 | // Check if gcpAuthRefresh is from project settings |
| 1053 | if (isGcpAuthRefreshFromProjectSettings()) { |
| 1054 | // Only prefetch if trust has already been established |
| 1055 | const hasTrust = checkHasTrustDialogAccepted() |
| 1056 | if (!hasTrust && !getIsNonInteractiveSession()) { |
| 1057 | // Don't prefetch - wait for trust to be established first |
| 1058 | return |
| 1059 | } |
| 1060 | } |
| 1061 | |
| 1062 | // Safe to prefetch - either not from project settings or trust already established |
| 1063 | void refreshGcpCredentialsIfNeeded() |
| 1064 | } |
| 1065 | |
| 1066 | /** |
| 1067 | * Prefetches AWS credentials only if workspace trust has already been established. |
no test coverage detected