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)
Class methods
def self.new(*, roots: TLS::Roots = …, alpn: Array[String] = …, min_version: Symbol = …, verify: Bool = …) -> TLS::Config
def self.default -> TLS::Config
The system's roots, no ALPN, TLS 1.2 and later, verified.
Methods
def roots -> TLS::Roots
The roots the peer's certificate must chain to.
def alpn -> Array[String]
The protocols offered by ALPN, preferred first.
def min_version -> Symbol
The oldest version accepted: :tls12 or :tls13.
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).
def to_h -> Hash[Symbol, Object]
The fields as a Hash, by name.