capacitor-ssh-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.5.4 • Public • Published

capacitor-ssh-plugin

Supporting libssh2 sessions and channels. Supports both iOS and Android.

Install

npm install capacitor-ssh-plugin
npx cap sync

API

startSessionByPasswd(...)

startSessionByPasswd(options: StartByPasswd) => Promise<SSHSessionID>

connect to a host using a username & password

Param Type
options StartByPasswd

Returns: Promise<string>


startSessionByKey(...)

startSessionByKey(options: StartByKey) => Promise<{ session: string; }>

connect to a host using an identity key. The pa

Param Type
options StartByKey

Returns: Promise<{ session: string; }>


newChannel(...)

newChannel(options: { session: SSHSessionID; pty?: TerminalType; }) => Promise<{ id: number; }>

given a connected session and an optional terminal type, start a new channel

Param Type
options { session: string; pty?: TerminalType; }

Returns: Promise<{ id: number; }>


startShell(...)

startShell(options: { channel: SSHChannelID; command?: string; }, callback: STDOutCallback) => Promise<string>

given a channel, start a login shell.

The function also recieves a callback which is called when messages arrive on the channel.

Param Type
options { channel: number; command?: string; }
callback STDOutCallback

Returns: Promise<string>


writeToChannel(...)

writeToChannel(options: { channel: number; s: string; }) => Promise<void>

writes a message to an open channel

Param Type
options { channel: number; s: string; }

closeChannel(...)

closeChannel(options: { channel: number; }) => Promise<void>
Param Type
options { channel: number; }

setPtySize(...)

setPtySize(options: { channel: number; width: number; height: number; }) => Promise<void>
Param Type
options { channel: number; width: number; height: number; }

Interfaces

StartByPasswd

parameters used when opening a session by password

Prop Type
address string
port number
username string
password string

StartByKey

parameters used when opening a session by indetity key

Prop Type
address string
port number
username string
tag string

Type Aliases

SSHSessionID

Session ID

string

SSHChannelID

Channel ID

number

STDOutCallback

(message: string | null, err?: any): void

Enums

TerminalType

Members Value
PtyNone 0
PtyTerminalVanilla
PtyTerminalVT100
PtyTerminalVT102
PtyTerminalVT220
PtyTerminalAnsi
PtyTerminalXterm

Readme

Keywords

Package Sidebar

Install

npm i capacitor-ssh-plugin

Weekly Downloads

9

Version

0.5.4

License

MIT

Unpacked Size

68.7 kB

Total Files

28

Last publish

Collaborators

  • daonb