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

Function requestNextKey

packages/kaos/test/ssh-create.test.ts:199–226  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

197 }
198
199 const requestNextKey = (): void => {
200 authHandler([], false, (auth: string | AnyAuthMethod | false) => {
201 expect(auth).not.toBe(false);
202 expect(typeof auth).toBe('object');
203 if (auth === false || typeof auth !== 'object') {
204 client.emit('error', new Error('authHandler returned no auth method'));
205 return;
206 }
207 if (auth.type !== 'publickey') {
208 client.emit('error', new Error(`unexpected auth type: ${auth.type}`));
209 return;
210 }
211 const key =
212 typeof auth.key === 'string'
213 ? auth.key
214 : Buffer.isBuffer(auth.key)
215 ? auth.key.toString('utf-8')
216 : JSON.stringify(auth.key);
217 harnessState.attemptedKeys.push(key);
218 if (key === 'first-key') {
219 requestNextKey();
220 return;
221 }
222 queueMicrotask(() => {
223 client.emit('ready');
224 });
225 });
226 };
227
228 requestNextKey();
229 },

Callers 1

onConnectFunction · 0.85

Calls 3

toStringMethod · 0.65
emitMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected