import { Observable } from 'rxjs'; import { Destructible } from './helpers'; import { SFTP } from './sftp'; import { Channel, NewChannel } from './channel'; import { ClientEventInterface } from './events'; import { SshKeyPair, KeyboardInteractiveAuthenticationPrompt, SshClient, SshPublicKey, SshTransport } from './native'; import { AgentConnectionSpec } from './agent'; export declare class KeyPair { protected inner: SshKeyPair; private constructor(); get algorithm(): string; static parse(data: string, passphrase?: string): Promise; } export interface X11ChannelOpenEvent { readonly channel: NewChannel; readonly clientAddress: string; readonly clientPort: number; } export interface TCPChannelOpenEvent { readonly channel: NewChannel; readonly targetAddress: string; readonly targetPort: number; readonly clientAddress: string; readonly clientPort: number; } export type KeyboardInteractiveAuthenticationState = { state: 'failure'; remainingMethods: string[]; } | { state: 'infoRequest'; name: string; instructions: string; prompts: () => KeyboardInteractiveAuthenticationPrompt[]; }; export interface AuthFailure { remainingMethods: string[]; } export interface Config { preferred?: { ciphers?: string[]; kex?: string[]; key?: string[]; mac?: string[]; compression?: string[]; }; connectionTimeoutSeconds?: number; keepaliveIntervalSeconds?: number; keepaliveCountMax?: number; } export declare class SSHClient extends Destructible { private client; private events; readonly disconnect$: Observable; readonly banner$: Observable; private constructor(); static connect(transport: SshTransport, serverKeyCallback: (key: SshPublicKey) => Promise, config?: Config): Promise; protected destruct(): void; authenticateNone(username: string): Promise; authenticateWithPassword(username: string, password: string): Promise; private _hashAlg; authenticateWithKeyPair(username: string, keyPair: KeyPair, hashAlgorithm: 'sha1' | 'sha256' | 'sha512' | null): Promise; startKeyboardInteractiveAuthentication(username: string): Promise; continueKeyboardInteractiveAuthentication(responses: string[]): Promise; authenticateWithAgent(username: string, connection: AgentConnectionSpec): Promise; /** * Authenticate using SSH agent with a specific public key identity. * This is useful when you have multiple keys in the agent and want to use a specific one, * avoiding the server's authentication attempt limit. * @param username SSH username * @param connection Agent connection specification * @param publicKey The specific public key to use for authentication */ authenticateWithAgentIdentity(username: string, connection: AgentConnectionSpec, publicKey: SshPublicKey): Promise; disconnect(): Promise; private intoAuthenticated; } export declare class AuthenticatedSSHClient extends Destructible { private client; private events; readonly disconnect$: Observable; readonly x11ChannelOpen$: Observable; readonly tcpChannelOpen$: Observable; readonly agentChannelOpen$: Observable; constructor(client: SshClient, events: ClientEventInterface); openSessionChannel(): Promise; openTCPForwardChannel(options: { addressToConnectTo: string; portToConnectTo: number; originatorAddress: string; originatorPort: number; }): Promise; forwardTCPPort(addressToBind: string, portToBind: number): Promise; stopForwardingTCPPort(addressToBind: string, portToBind: number): Promise; disconnect(): Promise; activateChannel(ch: NewChannel): Promise; activateSFTP(ch: NewChannel): Promise; private wrapChannel; } export { KeyboardInteractiveAuthenticationPrompt, SshPublicKey, SshTransport, SshChannel, NewSshChannel, SftpFileType as SFTPFileType, supportedCiphers as getSupportedCiphers, supportedKexAlgorithms as getSupportedKexAlgorithms, supportedMacs as getSupportedMACs, supportedCompressionAlgorithms as getSupportedCompressionAlgorithms, supportedKeyTypes as getSupportedKeyTypes, OPEN_APPEND, OPEN_CREATE, OPEN_READ, OPEN_TRUNCATE, OPEN_WRITE, SftpFile as SFTPFile, isPageantRunning, HashAlgorithm, parsePublicKey, } from './native'; export { SFTP, SFTPDirectoryEntry, SFTPMetadata, } from './sftp'; export { AgentConnectionSpec, SSHAgentStream } from './agent'; export { Channel, NewChannel };