WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

constructor

  • Construct a new tls.TLSSocket object from an existing TCP socket.

    Parameters

    • socket: Socket
    • Optional options: object
      • Optional ALPNProtocols?: string[] | Buffer

        An array of strings or a Buffer naming possible ALPN protocols. (Protocols should be ordered by their priority.) When the server receives both NPN and ALPN extensions from the client, ALPN takes precedence over NPN and the server does not send an NPN extension to the client.

      • Optional NPNProtocols?: string[] | Buffer

        An array of strings or a Buffer naming possible NPN protocols. (Protocols should be ordered by their priority.)

      • Optional SNICallback?: Function

        SNICallback(servername, cb) A function that will be called if the client supports SNI TLS extension. Two arguments will be passed when called: servername and cb. SNICallback should invoke cb(null, ctx), where ctx is a SecureContext instance. (tls.createSecureContext(...) can be used to get a proper SecureContext.) If SNICallback wasn't provided the default callback with high-level API will be used (see below).

      • Optional isServer?: boolean

        If true the TLS socket will be instantiated in server-mode. Defaults to false.

      • Optional rejectUnauthorized?: boolean

        If true the server will reject any connection which is not authorized with the list of supplied CAs. This option only has an effect if requestCert is true. Defaults to false.

      • Optional requestCert?: boolean

        If true the server will request a certificate from clients that connect and attempt to verify that certificate. Defaults to false.

      • Optional requestOCSP?: boolean

        If true, specifies that the OCSP status request extension will be added to the client hello and an 'OCSPResponse' event will be emitted on the socket before establishing a secure communication

      • Optional secureContext?: SecureContext

        An optional TLS context object from tls.createSecureContext()

      • Optional server?: Server

        An optional net.Server instance.

      • Optional session?: Buffer

        An optional Buffer instance containing a TLS session.

    Returns TLSSocket

Properties

authorizationError

authorizationError: Error

The reason why the peer's certificate has not been verified. This property becomes available only when tlsSocket.authorized === false.

authorized

authorized: boolean

A boolean that is true if the peer certificate was signed by one of the specified CAs, otherwise false.

encrypted

encrypted: boolean

Static boolean value, always true. May be used to distinguish TLS sockets from regular ones.

localAddress

localAddress: string

The string representation of the local IP address.

localPort

localPort: string

The numeric representation of the local port.

readable

readable: boolean

remoteAddress

remoteAddress: string

The string representation of the remote IP address. For example, '74.125.127.100' or '2001:4860:a005::68'.

remoteFamily

remoteFamily: string

The string representation of the remote IP family. 'IPv4' or 'IPv6'.

remotePort

remotePort: number

The numeric representation of the remote port. For example, 443.

writable

writable: boolean

defaultMaxListeners

defaultMaxListeners: number

Methods

_read

  • _read(size: number): void
  • Parameters

    • size: number

    Returns void

_write

  • _write(chunk: any, encoding: string, callback: Function): void
  • Parameters

    • chunk: any
    • encoding: string
    • callback: Function

    Returns void

addListener

  • addListener(event: string, listener: Function)
  • addListener(event: "OCSPResponse", listener: function)
  • addListener(event: "secureConnect", listener: function)
  • events.EventEmitter

    1. OCSPResponse
    2. secureConnect

    Parameters

    • event: string
    • listener: Function
  • Parameters

    • event: "OCSPResponse"
    • listener: function
        • Parameters

          Returns void

  • Parameters

    • event: "secureConnect"
    • listener: function
        • (): void
        • Returns void

address

  • address(): object
  • Returns the bound address, the address family name and port of the underlying socket as reported by the operating system.

    Returns object

    • An object with three properties, e.g. { port: 12346, family: 'IPv4', address: '127.0.0.1' }.
    • address: string
    • family: string
    • port: number

emit

  • emit(event: string, ...args: any[]): boolean
  • emit(event: "OCSPResponse", response: Buffer): boolean
  • emit(event: "secureConnect"): boolean
  • Parameters

    • event: string
    • Rest ...args: any[]

    Returns boolean

  • Parameters

    • event: "OCSPResponse"
    • response: Buffer

    Returns boolean

  • Parameters

    • event: "secureConnect"

    Returns boolean

end

  • end(): void
  • end(chunk: any, cb?: Function): void
  • end(chunk: any, encoding?: string, cb?: Function): void
  • Returns void

  • Parameters

    • chunk: any
    • Optional cb: Function

    Returns void

  • Parameters

    • chunk: any
    • Optional encoding: string
    • Optional cb: Function

    Returns void

eventNames

  • eventNames(): string | symbol

getCipher

  • Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.

    Returns CipherNameAndProtocol

    • Returns an object representing the cipher name and the SSL/TLS protocol version of the current connection.

getMaxListeners

  • getMaxListeners(): number

getPeerCertificate

  • getPeerCertificate(detailed?: boolean): object
  • Returns an object representing the peer's certificate. The returned object has some properties corresponding to the field of the certificate. If detailed argument is true the full chain with issuer property will be returned, if false only the top certificate without issuer property. If the peer does not provide a certificate, it returns null or an empty object.

    Parameters

    • Optional detailed: boolean

      If true; the full chain with issuer property will be returned.

    Returns object

    • An object representing the peer's certificate.

getSession

  • getSession(): any
  • Could be used to speed up handshake establishment when reconnecting to the server.

    Returns any

    • ASN.1 encoded TLS session or undefined if none was negotiated.

getTLSTicket

  • getTLSTicket(): any
  • NOTE: Works only with client TLS sockets. Useful only for debugging, for session reuse provide session option to tls.connect().

    Returns any

    • TLS session ticket or undefined if none was negotiated.

isPaused

  • isPaused(): boolean

listenerCount

  • listenerCount(type: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

on

  • on(event: string, listener: Function)
  • on(event: "OCSPResponse", listener: function)
  • on(event: "secureConnect", listener: function)
  • Parameters

    • event: string
    • listener: Function
  • Parameters

    • event: "OCSPResponse"
    • listener: function
        • Parameters

          Returns void

  • Parameters

    • event: "secureConnect"
    • listener: function
        • (): void
        • Returns void

once

  • once(event: string, listener: Function)
  • once(event: "OCSPResponse", listener: function)
  • once(event: "secureConnect", listener: function)
  • Parameters

    • event: string
    • listener: Function
  • Parameters

    • event: "OCSPResponse"
    • listener: function
        • Parameters

          Returns void

  • Parameters

    • event: "secureConnect"
    • listener: function
        • (): void
        • Returns void

pause

  • pause()

pipe

  • pipe<T>(destination: T, options?: object): T
  • Type parameters

    Parameters

    • destination: T
    • Optional options: object
      • Optional end?: boolean

    Returns T

prependListener

  • prependListener(event: string, listener: Function)
  • prependListener(event: "OCSPResponse", listener: function)
  • prependListener(event: "secureConnect", listener: function)
  • Parameters

    • event: string
    • listener: Function
  • Parameters

    • event: "OCSPResponse"
    • listener: function
        • Parameters

          Returns void

  • Parameters

    • event: "secureConnect"
    • listener: function
        • (): void
        • Returns void

prependOnceListener

  • prependOnceListener(event: string, listener: Function)
  • prependOnceListener(event: "OCSPResponse", listener: function)
  • prependOnceListener(event: "secureConnect", listener: function)
  • Parameters

    • event: string
    • listener: Function
  • Parameters

    • event: "OCSPResponse"
    • listener: function
        • Parameters

          Returns void

  • Parameters

    • event: "secureConnect"
    • listener: function
        • (): void
        • Returns void

push

  • push(chunk: any, encoding?: string): boolean
  • Parameters

    • chunk: any
    • Optional encoding: string

    Returns boolean

read

  • read(size?: number): any
  • Parameters

    • Optional size: number

    Returns any

removeAllListeners

  • removeAllListeners(event?: string | symbol)

removeListener

  • removeListener(event: string, listener: Function)
  • removeListener(event: "close", listener: function)
  • removeListener(event: "data", listener: function)
  • removeListener(event: "end", listener: function)
  • removeListener(event: "readable", listener: function)
  • removeListener(event: "error", listener: function)

renegotiate

  • renegotiate(options: TlsOptions, callback: function): any
  • Initiate TLS renegotiation process.

    NOTE: Can be used to request peer's certificate after the secure connection has been established. ANOTHER NOTE: When running as the server, socket will be destroyed with an error after handshakeTimeout timeout.

    Parameters

    • options: TlsOptions

      The options may contain the following fields: rejectUnauthorized, requestCert (See tls.createServer() for details).

    • callback: function

      callback(err) will be executed with null as err, once the renegotiation is successfully completed.

        • (err: Error): any
        • Parameters

          • err: Error

          Returns any

    Returns any

resume

  • resume()

setEncoding

  • setEncoding(encoding: string)
  • Parameters

    • encoding: string

setMaxListeners

  • setMaxListeners(n: number)

setMaxSendFragment

  • setMaxSendFragment(size: number): boolean
  • Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). Smaller fragment size decreases buffering latency on the client: large fragments are buffered by the TLS layer until the entire fragment is received and its integrity is verified; large fragments can span multiple roundtrips, and their processing can be delayed due to packet loss or reordering. However, smaller fragments add extra TLS framing bytes and CPU overhead, which may decrease overall server throughput.

    Parameters

    • size: number

      TLS fragment size (default and maximum value is: 16384, minimum is: 512).

    Returns boolean

    • Returns true on success, false otherwise.

unpipe

  • unpipe<T>(destination?: T)

unshift

  • unshift(chunk: any): void
  • Parameters

    • chunk: any

    Returns void

wrap

write

  • write(chunk: any, cb?: Function): boolean
  • write(chunk: any, encoding?: string, cb?: Function): boolean
  • Parameters

    • chunk: any
    • Optional cb: Function

    Returns boolean

  • Parameters

    • chunk: any
    • Optional encoding: string
    • Optional cb: Function

    Returns boolean

listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc