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

Function resolveKimiTokenStorageName

packages/oauth/src/toolkit.ts:438–452  ·  view source on GitHub ↗
(input: {
  readonly providerName?: string | undefined;
  readonly oauthKey?: string | undefined;
})

Source from the content-addressed store, hash-verified

436}
437
438export function resolveKimiTokenStorageName(input: {
439 readonly providerName?: string | undefined;
440 readonly oauthKey?: string | undefined;
441}): string {
442 const key = input.oauthKey ?? KIMI_CODE_OAUTH_KEY;
443 if (key === 'kimi-code' || key === KIMI_CODE_OAUTH_KEY) return 'kimi-code';
444
445 const prefix = 'oauth/';
446 if (key.startsWith(prefix) && key.slice(prefix.length).length > 0) {
447 return key.slice(prefix.length);
448 }
449
450 if (!key.includes('/') && !key.startsWith('.')) return key;
451 throw new Error(`Invalid Kimi OAuth token key: "${key}".`);
452}
453
454function defaultKimiHome(): string {
455 const override = process.env['KIMI_CODE_HOME'];

Callers 3

toolkit.test.tsFile · 0.90
managerForMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected