JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4634
  • Score
    100M100P100Q116375F

Upgrade a regular `net.Stream` connection to a secure `tls` connection.

Package Exports

  • starttls

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (starttls) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Start TLS

Upgrade a regular net.Stream connection to a secure tls connection. See socks5-https-client for use-case.

Based on a version by Andris Reinman, itself based on an older version by Nathan Rajlich.

Usage

The only method, startTls, returns a SecurePair and takes a Socket and an optional callback called on the secure event of the pair.

var net = require('net');
var startTls = require('starttls').startTls;
var port = 21;
var socket = net.createConnection(port);

socket.on('connect', function() {
    var securePair = startTls(socket, function() {
        securePair.cleartext.write('garbage');
    });
});

License

Portions of this code copyright (c) 2012, Andris Reinman and copyright (c) 2011, Nathan Rajlich.

Modified and redistributed under an MIT license.