createSftpProviderFactory
function createSftpProviderFactory(options?: SftpProviderOptions): ProviderFactory;Defined in: src/providers/native/sftp/NativeSftpProvider.ts:243
Creates a ProviderFactory backed by the native SSH/SFTP protocol
stack - no ssh2 dependency required.
Supported algorithms
- Key exchange:
curve25519-sha256,curve25519-sha256@libssh.org - Host keys:
ssh-ed25519,ecdsa-sha2-nistp256/384/521,rsa-sha2-256,rsa-sha2-512(legacy SHA-1ssh-rsais rejected) - Ciphers:
aes128-ctr,aes256-ctr - MACs:
hmac-sha2-256,hmac-sha2-512
Authentication
passwordkeyboard-interactive(RFC 4256)publickeyfor Ed25519 and RSA private keys (rsa-sha2-512preferred,rsa-sha2-256fallback). Encrypted keys are unlocked viaprofile.ssh.passphrase.
Host-key verification
- The server’s signature over the exchange hash is always verified.
- Optional pinning via
profile.ssh.pinnedHostKeySha256(SHA256:..., raw base64, or hex). - Optional
profile.ssh.knownHosts(OpenSSH format, hashed and plain patterns,[host]:port, negation, and@revokedmarkers).
Resilience
readyTimeoutMsbounds TCP connect + SSH handshake.keepaliveIntervalMskeeps idle sessions alive through stateful firewalls / NAT.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options | SftpProviderOptions |
Returns
Section titled “Returns”Example
Section titled “Example”const client = createTransferClient({ providers: [createSftpProviderFactory({ readyTimeoutMs: 10_000, keepaliveIntervalMs: 30_000, })],});const session = await client.connect({ provider: "sftp", host: "sftp.example.com", username: "deploy", ssh: { privateKey: { kind: "literal", value: process.env.DEPLOY_KEY! }, pinnedHostKeySha256: "SHA256:abc...", },});