()
| 992 | * Returns void to prevent misuse - use refreshGcpCredentialsIfNeeded() to actually refresh. |
| 993 | */ |
| 994 | export 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. |
no test coverage detected