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

Function buildProviderPlan

src/auth/runtime/AuthRuntime.ts:270–327  ·  view source on GitHub ↗
(params: {
  using3P: boolean
  principalSource: PrincipalSource
  rawApiKeySource: string | null
})

Source from the content-addressed store, hash-verified

268}
269
270function buildProviderPlan(params: {
271 using3P: boolean
272 principalSource: PrincipalSource
273 rawApiKeySource: string | null
274}): ProviderPlan {
275 const { using3P, principalSource, rawApiKeySource } = params
276
277 if (using3P) {
278 return {
279 mode: 'third_party_provider',
280 source: 'third_party_provider',
281 staticKeyEnvVarName: null,
282 }
283 }
284
285 if (principalSource === 'direct_api_key_env') {
286 return {
287 mode: getDirectApiKeyProviderMode() ?? 'noumena_managed',
288 source: 'direct_api_key_env',
289 staticKeyEnvVarName: rawApiKeySource,
290 }
291 }
292
293 if (principalSource === 'console_api_key') {
294 return {
295 mode: 'noumena_managed',
296 source: 'console_api_key',
297 staticKeyEnvVarName: null,
298 }
299 }
300
301 if (principalSource === 'api_key_helper') {
302 return {
303 mode: 'noumena_managed',
304 source: 'api_key_helper',
305 staticKeyEnvVarName: null,
306 }
307 }
308
309 if (principalSource === 'none') {
310 return {
311 mode: 'none',
312 source: 'none',
313 staticKeyEnvVarName: null,
314 }
315 }
316
317 return {
318 mode: 'noumena_managed',
319 source:
320 principalSource === 'third_party_provider'
321 ? 'third_party_provider'
322 : principalSource === 'managed_oauth'
323 ? 'managed_principal'
324 : 'service_credential',
325 staticKeyEnvVarName: null,
326 }
327}

Callers 1

resolveSessionSnapshotFunction · 0.85

Calls 1

Tested by

no test coverage detected