MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / managerFor

Method managerFor

packages/oauth/src/toolkit.ts:370–402  ·  view source on GitHub ↗
(
    providerName: string,
    oauthKey = KIMI_CODE_OAUTH_KEY,
    oauthHost?: string | undefined,
  )

Source from the content-addressed store, hash-verified

368 }
369
370 managerFor(
371 providerName: string,
372 oauthKey = KIMI_CODE_OAUTH_KEY,
373 oauthHost?: string | undefined,
374 ): OAuthManager {
375 const storageName = resolveKimiTokenStorageName({ providerName, oauthKey });
376 const effectiveOAuthHost = oauthHost ?? this.flowConfig.oauthHost;
377 const managerKey = `${storageName}\0${normalizeOAuthHost(effectiveOAuthHost)}`;
378 let manager = this.managers.get(managerKey);
379 if (manager !== undefined) return manager;
380
381 const identity = this.identity;
382 manager = new OAuthManager({
383 config: {
384 ...this.flowConfig,
385 oauthHost: effectiveOAuthHost,
386 name: storageName,
387 },
388 storage: this.storage,
389 configDir: this.homeDir,
390 deviceHeaders:
391 identity === undefined
392 ? undefined
393 : () =>
394 createKimiDeviceHeaders({
395 homeDir: this.homeDir,
396 version: identity.version,
397 }),
398 ...this.managerOptions,
399 });
400 this.managers.set(managerKey, manager);
401 return manager;
402 }
403
404 private defaultOAuthKey(
405 baseUrl?: string | undefined,

Callers 6

statusMethod · 0.95
loginMethod · 0.95
logoutMethod · 0.95
ensureFreshMethod · 0.95
getCachedAccessTokenMethod · 0.95
tokenProviderMethod · 0.95

Calls 5

createKimiDeviceHeadersFunction · 0.90
normalizeOAuthHostFunction · 0.85
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected