MCPcopy Create free account
hub / github.com/mscdex/ssh2 / tryNextAgentKey

Method tryNextAgentKey

lib/client.js:1083–1109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1081 }
1082
1083 const tryNextAgentKey = () => {
1084 if (curAuth.type === 'agent') {
1085 const key = curAuth.agentCtx.nextKey();
1086 if (key === false) {
1087 debug && debug('Agent: No more keys left to try');
1088 debug && debug('Client: agent auth failed');
1089 tryNextAuth();
1090 } else {
1091 const pos = curAuth.agentCtx.pos();
1092 let keyAlgo;
1093 curAuth.keyAlgos = getKeyAlgos(this, key, serverSigAlgs);
1094 if (curAuth.keyAlgos) {
1095 if (curAuth.keyAlgos.length) {
1096 keyAlgo = curAuth.keyAlgos[0][0];
1097 } else {
1098 debug && debug(
1099 `Agent: Skipping key #${pos + 1} (no mutual hash algorithm)`
1100 );
1101 tryNextAgentKey();
1102 return;
1103 }
1104 }
1105 debug && debug(`Agent: Trying key #${pos + 1}`);
1106 proto.authPK(curAuth.username, key, keyAlgo);
1107 }
1108 }
1109 };
1110
1111 const startTimeout = () => {
1112 if (this.config.readyTimeout > 0) {

Callers

nothing calls this directly

Calls 4

getKeyAlgosFunction · 0.85
nextKeyMethod · 0.80
posMethod · 0.80
authPKMethod · 0.80

Tested by

no test coverage detected