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

Method authKeyboard

lib/protocol/Protocol.js:836–867  ·  view source on GitHub ↗
(username)

Source from the content-addressed store, hash-verified

834 });
835 }
836 authKeyboard(username) {
837 if (this._server)
838 throw new Error('Client-only method called in server mode');
839
840 const userLen = Buffer.byteLength(username);
841 let p = this._packetRW.write.allocStart;
842 const packet = this._packetRW.write.alloc(
843 1 + 4 + userLen + 4 + 14 + 4 + 20 + 4 + 4
844 );
845
846 packet[p] = MESSAGE.USERAUTH_REQUEST;
847
848 writeUInt32BE(packet, userLen, ++p);
849 packet.utf8Write(username, p += 4, userLen);
850
851 writeUInt32BE(packet, 14, p += userLen);
852 packet.utf8Write('ssh-connection', p += 4, 14);
853
854 writeUInt32BE(packet, 20, p += 14);
855 packet.utf8Write('keyboard-interactive', p += 4, 20);
856
857 writeUInt32BE(packet, 0, p += 20);
858
859 writeUInt32BE(packet, 0, p += 4);
860
861 this._authsQueue.push('keyboard-interactive');
862
863 this._debug && this._debug(
864 'Outbound: Sending USERAUTH_REQUEST (keyboard-interactive)'
865 );
866 sendPacket(this, this._packetRW.write.finalize(packet));
867 }
868 authNone(username) {
869 if (this._server)
870 throw new Error('Client-only method called in server mode');

Callers 1

doNextAuthMethod · 0.80

Calls 4

writeUInt32BEFunction · 0.85
pushMethod · 0.80
allocMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected