(a2a, deps)
| 976 | } |
| 977 | |
| 978 | function buildNodeScopedHubHeadersSafe(a2a, deps) { |
| 979 | if (!deps || deps.nodeSecret === undefined) { |
| 980 | try { |
| 981 | if (typeof a2a.buildNodeScopedHubHeaders === 'function') { |
| 982 | const headers = a2a.buildNodeScopedHubHeaders() || {}; |
| 983 | if (hasAuthorizationHeader(headers)) return headers; |
| 984 | } |
| 985 | } catch (_) {} |
| 986 | } |
| 987 | const nodeSecret = getHubNodeSecret(deps || {}); |
| 988 | if (!nodeSecret) return {}; |
| 989 | const headers = { |
| 990 | 'Content-Type': 'application/json', |
| 991 | Authorization: 'Bearer ' + nodeSecret, |
| 992 | }; |
| 993 | const secretVersion = getHubNodeSecretVersionSafe(a2a); |
| 994 | if (secretVersion) headers['X-EvoMap-Node-Secret-Version'] = String(secretVersion); |
| 995 | return headers; |
| 996 | } |
| 997 | |
| 998 | function getHubNodeSecretVersionSafe(a2a) { |
| 999 | try { |
no test coverage detected