data TLS::Config(roots: TLS::Roots, alpn: Array[String], min_version: Symbol, verify: Bool)

What a client connection trusts and offers. Immutable, so one config serves any number of connections and tasks; the configuration built from it is kept, so connecting again does not read the roots again.

config = TLS::Config.new(roots: TLS::Roots.from_pem(File.read("ca.pem")),
                         alpn: ["h2", "http/1.1"], min_version: :tls13)

<std:tls>:115

Class methods

def self.new(*, roots: TLS::Roots = …, alpn: Array[String] = …, min_version: Symbol = …, verify: Bool = …) -> TLS::Config

<std:tls>:127

def self.default -> TLS::Config

The system's roots, no ALPN, TLS 1.2 and later, verified.

<std:tls>:138

Methods

def roots -> TLS::Roots

The roots the peer's certificate must chain to.

<std:tls>:117

def alpn -> Array[String]

The protocols offered by ALPN, preferred first.

<std:tls>:119

def min_version -> Symbol

The oldest version accepted: :tls12 or :tls13.

<std:tls>:121

def verify -> Bool

Whether the peer's certificate is verified. false keeps the connection encrypted but drops the peer's authentication: for tests and local setups only (TLSSocket#verified? says so).

<std:tls>:125

def to_h -> Hash[Symbol, Object]

The fields as a Hash, by name.

<std:tls>:127