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

Function resolveKimiCodeOAuthKey

packages/oauth/src/managed-kimi-code.ts:309–326  ·  view source on GitHub ↗
(options: {
  readonly oauthHost?: string | undefined;
  readonly baseUrl?: string | undefined;
})

Source from the content-addressed store, hash-verified

307];
308
309export function resolveKimiCodeOAuthKey(options: {
310 readonly oauthHost?: string | undefined;
311 readonly baseUrl?: string | undefined;
312}): string {
313 const oauthHost = normalizeEndpoint(options.oauthHost ?? DEFAULT_KIMI_CODE_OAUTH_HOST);
314 const baseUrl = defaultBaseUrl(options.baseUrl);
315 const defaultOauthHost = normalizeEndpoint(DEFAULT_KIMI_CODE_OAUTH_HOST);
316
317 if (oauthHost === defaultOauthHost && SHARED_DEFAULT_BASE_URLS.includes(baseUrl)) {
318 return KIMI_CODE_OAUTH_KEY;
319 }
320
321 const digest = createHash('sha256')
322 .update(JSON.stringify({ oauthHost, baseUrl }))
323 .digest('hex')
324 .slice(0, 16);
325 return `${KIMI_CODE_SCOPED_OAUTH_KEY_PREFIX}${digest}`;
326}
327
328/**
329 * Resolve the full managed-Kimi-Code OAuth ref (credential storage key +

Callers 8

toolkit.test.tsFile · 0.90
defaultOAuthKeyMethod · 0.90
resolveKimiCodeOAuthRefFunction · 0.85
resolveKimiCodeLoginAuthFunction · 0.85

Calls 3

defaultBaseUrlFunction · 0.85
normalizeEndpointFunction · 0.70
updateMethod · 0.65

Tested by 1