Skip to reference

std.x.tls.client

wolf-std d58f9e1 · toolchain pin verified against wolf 0.2.41 (0261597). Source signatures and documentation; execution support is stated in each module.

All modules · Plain text · Stability tier: x

Module

std.x.tls.client — the TLS 1.3 CLIENT (RFC 8446, one profile) over the library's own proven halves. Stability tier: x — the FOURTH rung of the stdc-tls campaign (sprint sc29), and the rung that turns the stack AROUND: sc20's record layer, sc21's handshake machinery and sc22/sc23's chain validation were all built and vectored from the verifier's side, which IS the client's side — this module is the state machine that drives them against a live socket. A wolf program dials loopback TCP, shakes TLS 1.3 with the std server half, verifies the chain + CertificateVerify + Finished, exchanges application data, and closes.

The nursery banner (D31). std.x.tls.client is not std.tls: its path, names and behaviour may change or vanish in one sprint; no other std module may depend on it. Its reason and graduation trigger live in std/x/README.md. It depends on SEVEN sibling residents — std.x.tls.record (seal/open + the key-schedule primitives), std.x.tls.handshake (messages, transcript, schedule, Finished, the §4.1 state machine), std.x.tls.cert (path validation), std.x.crypto.curve25519 (X25519 + Ed25519 verify), std.x.crypto.p256 (ECDSA-P256 verify), std.x.crypto.p384 (ECDSA-P384 verify, sc79) and std.x.crypto.rsa (RSASSA-PSS verify, sc79) — plus the std.net FACADE (a resident may depend on the facade). The resident-on-resident edges are named in the register beside the earlier rungs' own.

## The one profile (the contract's scope line)

TLS 1.3 only, TLS_CHACHA20_POLY1305_SHA256 (0x1303 — the suite the server half speaks), X25519 the only group, SNI + the RFC 8446 minimum extensions. signature_algorithms offers the six schemes this client verifies (signature_schemes). CertificateVerify VERIFIES — see below. NAMED NON-TARGETS: OS truststore reading (the trust anchors are CALLER-SUPPLIED — a distribution's bundle converted to concatenated DER is the intended input, and std opens no file for it), session resumption/0-RTT, the rsa_pss_pss_* and rsa_pkcs1_* CertificateVerify schemes and P-521 (named unsupported_alg, never a silent accept), signature_algorithms_cert (not sent), TLS 1.2 (a downgrade-shaped ServerHello is a named refusal), HelloRetryRequest (one key share is offered and a server that cannot take it is a named refusal, not a second flight).

## The CertificateVerify RETIREMENT (sc21's posture ends here)

sc21 built the §4.4.3 signed octets and verified NOTHING (no verifier existed for the trace's schemes). That posture RETIRES for two schemes at sc29: ed25519 (0x0807) verifies via sc18's curve25519.verify and ecdsa_secp256r1_sha256 (0x0403) verifies via sc23's p256.verify_der — both against the validated leaf's SPKI over the exact §4.4.3 content. sc79 adds the public PKI's: ecdsa_secp384r1_sha384 (0x0503) via p384.verify_der and rsa_pss_rsae_sha256/384/512 (0x0804..0x0806) via rsa.verify_pss (MGF1 over the same hash, salt = digest length, RFC 8446 §4.2.3); every other scheme remains the named unsupported_alg (the sc22 honesty split, unchanged), and a weak RSA leaf key is weak_key. NOTHING about a peer is trusted before path + CertificateVerify + Finished all pass. The path is cert.validate_path from the leaf to one of the caller's roots (sc79; the anchor-at-a-time search it replaces validated the whole chain once per root).

## The API shape: the caller owns the dial, the module owns the state machine — in TWO PHASES

begin(take sock, …) -> Pending writes the ClientHello and returns WITHOUT reading; complete(take p) -> Client reads the server flight, verifies everything, sends the client Finished. Two phases rather than one blocking connect is a deliberate, recorded choice (the contract's single-threaded-reality question): every operation at this tier blocks the whole process (std.net's posture), so an IN-PROCESS client+server witness needs the client to yield between its first write and its first read — between begin and complete the test's server half reads the ClientHello and writes its whole flight into the loopback buffer, and nothing ever blocks (the dial-first discipline generalized to strict alternation with kernel-buffered flights). A two-process shape (std.process exists) was the alternative and costs a spawned binary no lane can build here; phase separation costs one extra call and keeps the witness single-file and three-lane-shaped. A real program against a real server just calls the two in a row.

Entropy is the CALLER'S: begin takes the 32-byte ClientHello random and the 32-byte X25519 private scalar as arguments (no entropy source exists in std — the rand/os_random D-question lives with the crypto ladder, and deterministic tests are the point).

## Rows (each battery refusal is a NAMED tag, never a hang)

Transport: closed, timeout (arm net.set_deadline on the socket BEFORE begin — a deadline is per-fd host state and survives the handoff; this module arms none itself), io. Record layer: bad_record_mac (a tampered/forged record — AEAD reject, zero plaintext exposed), decode_error (malformed framing/messages). Negotiation: illegal_parameter (wrong version/compression/group shapes), downgrade (the §4.1.3 sentinel randoms, or a ServerHello whose supported_versions is absent or not 0x0304 — TLS 1.2 shapes refuse by THIS name), handshake_failure (the suite is not 0x1303, or the peer alerted mid-handshake), unexpected_message (§4.1 flow violations — reordered/duplicated/illegal flights, via sc21's hs_step). Keys: zero (the all-zero X25519 shared secret, sc18's row, RFC 8446 §7.4.2). Identity: cert.validate_path's twelve rows verbatim (der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, and since sc79 weak_key, bad_usage, name_constraints) plus bad_signature/unsupported_alg/weak_key again from CertificateVerify, and decrypt_error (a wrong Finished, §4.4.4 — sc21's tag). Application data: invalid on write for a non-byte element (the net byte tier's tag, §14).

## Naming the row (sc31, wolf-std#3 — the first consumer's ask)

Twenty named rows are twenty ACTIONS for a caller that routes on them, and twenty ARMS for a caller that only wants to say which one killed the handshake. lobo's proxy and ACME doors wanted the second, and paid twice: the full else |e| match e { … } written out at both call sites (module dependency law forbids sharing it), and a DEAD Client forged in every arm, because a Client-yielding handler's arms must produce a Client. Neither cost is the row vocabulary's fault and neither had to be the caller's.

named and row_name at the bottom of this module are the answer, and they are ONE match with two faces. named coarsens this module's whole vocabulary into the single payload-carrying tag Row(str) whose payload is the refusing row's own NAME: the value rides through untouched on success, so nothing is ever forged, and a consumer writes one arm. row_name is the marking face — the word, or "ok" — for a caller that wants to print rather than continue. API-CONVENTIONS §12 is what licenses the shape: coarsening is a NAMED call the caller writes (errors.coarsen is the exemplar), never something a std signature does silently, and what the caller gives up is visible in its own source.

The call-site spelling is BIND, THEN NAME, and it is a measured lane fact, not taste: the checked tier refuses a raising call passed straight into a row-typed parameter — "control flow in an argument" at mem — while lupin and the native rung both run it. That is the same limit std.option's six helpers have worn since sc06 (tests/option/or_else_default.lu is wolfc = unsupported for exactly this), so

    let judged = client.check_negotiation(view)   // bind first
    let word = client.row_name(judged)            // then name

keeps every naming site three-lane, where row_name(check_negotiation(view)) would cost the checked lane. Probed on all three lanes before a line of this was written.

## Lanes (re-measured at the sc31 pin; the sc29 note is superseded)

The socket-bearing functions (begin/complete/read/write/ close) ride net.read_bytes/net.write_bytes, and ALL THREE lanes reach them now: sc29 wrote this paragraph while lupin 0.1.18 could not resolve the byte tier (F-0102) and every loopback witness's lupin column was an honest unsupported; 0.1.19 paid F-0102 and the flagship RAN — the full in-process handshake (client + server halves: four X25519 ladders, Ed25519 sign + verifies, the AEAD flight) evaluates INSIDE lupin's 50M step budget. The one dark lane is wolfc's checked tier, whose step budget the same program measurably exhausts. The pure half — the flight parsers, the negotiation checks, verify_certificate_verify, the naming pair below, the constants — runs on all three lanes (lupin resolves lazily, the sc10 pure-half discipline), and the RFC 8448 client-perspective vector test is three-lane. The ledger records the measured verdict per file, the sc25 per-rig honesty.

A handshake costs SECONDS, not milliseconds, at unoptimized tiers — the lane note wolf-std#3 asked for, after the first consumer measured what this header had left to assumption. lobo's wsm04 doors measured ONE full client handshake against an OpenSSL server half at ~3.6s on an M-series host at the NATIVE tier with WOLF_MIDEND=0 (wolf-lang#146 keeps the mid-end off its release builds): four X25519 ladders plus the Ed25519 verifies dominate, and none of it is I/O. This repo's own in-process flagship — which is TWO halves in one program — measures 18.9s under lupin, idle. A consumer arming a sub-5s deadline around a dial is therefore on a knife edge: lobo widened its ACME transaction deadline from 5s to 15s and said why. Measure the rig you deploy on; do not assume milliseconds because the thing is a network protocol.

## Why Client holds an int fd and not a net.Socket

F-0092: the native rung refuses f(mut param.field) — a mut field path whose base is itself a mut parameter — so net.read_bytes(mut c.sock, …) inside read(mut c: Client) would cost the native lane. The portable spelling: hold the descriptor (an int field read is a copy), rebuild the one-field net.Socket wrapper at each call (a documented-legal construction, the sc08 forge rule), and let close(take c) consume the Client so staleness stays a static use-after-move exactly as the facade's own closers arrange.

## ct: (D53's retrofit clause)

Everything this module PARSES is public wire material (the server flight, certificates, signatures — the sc18 verify-is-public rule); branches on it protect no secret. The key schedule, Finished and the record AEAD carry SECRETS through sc20/sc21/sc16/sc18's own ct: lines; this module adds no secret-dependent branch of its own — the Finished compare is sc21's ct_eq (accumulate-then-single-check), and the traffic keys live in Client fields this pin cannot make private (a forged Client is ordinary code; every consumer answers rows, never traps). The 0..255 ingestion guards are the ladder's recorded ct exception (F-0035).

Types and traits

ServerHelloView

struct · Source line 426

pub struct ServerHelloView { legacy_version: int, random: List[byte], session_echo: List[byte], cipher_suite: int, compression: int, selected_version: int, key_share_group: int, server_share: List[byte], hello_retry: bool, }

A parsed ServerHello — the fields the client judges. server_share is the raw key_exchange bytes of the (single) key_share entry; selected_version/key_share_group are -1 when their extensions are absent; hello_retry is the §4.1.3 HelloRetryRequest sentinel random. ct: public wire material.

CertVerifyView

struct · Source line 711

pub struct CertVerifyView { scheme: int, sig: List[byte], }

A parsed CertificateVerify: the SignatureScheme and the raw signature bytes. ct: public wire material.

Pending

struct · Source line 966

pub struct Pending { fd: int, scalar: List[byte], hostname: str, anchors: List[byte], now: int, transcript: List[byte], }

The state between begin and complete: the ClientHello is on the wire, nothing has been read. This pin has no private fields; the scalar it carries is exactly as secret as the caller's own copy.

Client

struct · Source line 1045

pub struct Client { fd: int, write_key: List[byte], write_iv: List[byte], write_seq: int, read_key: List[byte], read_iv: List[byte], read_seq: int, }

An established TLS 1.3 connection: the application-traffic keys and sequence numbers over the caller's socket. Produced by complete; consumed by close. This pin has no private fields (the header's ct: note); a forged Client misbehaves as rows, never traps.

Functions and methods

suite_chacha20_sha256

fn · Source line 231

pub fn suite_chacha20_sha256() -> int

TLS_CHACHA20_POLY1305_SHA256 (0x1303) — the ONE cipher suite this profile offers and accepts (RFC 8446 §9.1 MTI; the suite sc17/sc20 built). ct: public.

client.suite_chacha20_sha256() == 4867

scheme_ed25519

fn · Source line 241

pub fn scheme_ed25519() -> int

SignatureScheme ed25519 (0x0807) — first-class: CertificateVerify VERIFIES under it (sc18's verifier). ct: public.

client.scheme_ed25519() == 2055

scheme_ecdsa_p256_sha256

fn · Source line 252

pub fn scheme_ecdsa_p256_sha256() -> int

SignatureScheme ecdsa_secp256r1_sha256 (0x0403) — verifies via sc23's p256.verify_der (the sc21 "verify nothing" posture retired for this scheme too). ct: public.

client.scheme_ecdsa_p256_sha256() == 1027

scheme_ecdsa_p384_sha384

fn · Source line 262

pub fn scheme_ecdsa_p384_sha384() -> int

SignatureScheme ecdsa_secp384r1_sha384 (0x0503) — verifies via sc79's p384.verify_der against a P-384 leaf key. ct: public.

client.scheme_ecdsa_p384_sha384() == 1283

scheme_rsa_pss_sha256

fn · Source line 274

pub fn scheme_rsa_pss_sha256() -> int

SignatureScheme rsa_pss_rsae_sha256 (0x0804) — RFC 8446 §9.1's MTI RSA scheme; verifies since sc79 via rsa.verify_pss (SHA-256, MGF1 over SHA-256, a 32-byte salt) against an rsaEncryption leaf key. ct: public.

client.scheme_rsa_pss_sha256() == 2052

scheme_rsa_pss_sha384

fn · Source line 284

pub fn scheme_rsa_pss_sha384() -> int

SignatureScheme rsa_pss_rsae_sha384 (0x0805) — rsa.verify_pss with SHA-384 and a 48-byte salt. ct: public.

client.scheme_rsa_pss_sha384() == 2053

scheme_rsa_pss_sha512

fn · Source line 294

pub fn scheme_rsa_pss_sha512() -> int

SignatureScheme rsa_pss_rsae_sha512 (0x0806) — rsa.verify_pss with SHA-512 and a 64-byte salt. ct: public.

client.scheme_rsa_pss_sha512() == 2054

signature_schemes

fn · Source line 315

pub fn signature_schemes() -> List[int]

The signature_algorithms this client offers (RFC 8446 §4.2.3), in preference order: ed25519, ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512 — every scheme verify_certificate_verify can judge, and nothing else (rsa_pss_pss_*, rsa_pkcs1_* and the SHA-1 schemes are not offered). The list also governs the certificate signatures (no signature_algorithms_cert is sent, §4.2.3), and cert.validate_path additionally accepts sha256/384/512WithRSA certificate signatures, which a server may present regardless (§4.4.2.2). ct: public.

let offered = client.signature_schemes()
offered.len == 6
offered[0] == client.scheme_ed25519()
offered[5] == client.scheme_rsa_pss_sha512()

parse_server_hello

fn · Source line 507

pub fn parse_server_hello(msg: List[byte]) -> ServerHelloView ! {decode_error}

Parse a complete ServerHello wire message (4-byte handshake header included) into its view (§4.1.3). STRUCTURE only — trailing bytes, truncation, a vector that overruns its container are each decode_error; whether the fields are ACCEPTABLE is check_negotiation's question. Unknown extensions are skipped (a client MUST ignore unrecognized extensions). ct: public wire material.

Example: prose — a fenced example cannot carry a realistic ServerHello under §4's one-module rule; tests/x/tls/client/rfc8448_parse_vectors.lu parses RFC 8448's own ServerHello and asserts every extracted field byte-for-byte.

check_negotiation

fn · Source line 592

pub fn check_negotiation(v: ServerHelloView) -> int ! { downgrade, handshake_failure, illegal_parameter, unexpected_message, }

Judge a parsed ServerHello against THIS profile (§4.1.3's checks, each a named refusal): downgrade — the sentinel randoms, an absent supported_versions, or a selected_version that is not 0x0304 (a TLS 1.2-shaped answer refuses by THIS name, RFC 8446 §4.1.3's downgrade protection); unexpected_message — the HelloRetryRequest sentinel (one key share is offered, a second flight is outside the profile); illegal_parameter — a legacy_version that is not 0x0303, a nonzero compression method, a key_share group that is not x25519(29) or a share that is not 32 bytes; handshake_failure — a cipher suite other than 0x1303. Answers the negotiated suite (public data in, public data out). ct: public.

check_encrypted_extensions

fn · Source line 632

pub fn check_encrypted_extensions(msg: List[byte]) -> int ! {decode_error}

Validate an EncryptedExtensions wire message's structure (§4.3.1): header, one uint16-prefixed extensions vector filling the body, each extension well-formed. Contents are not judged (nothing in this profile turns on them). ct: public.

certificate_chain_of

fn · Source line 670

pub fn certificate_chain_of(msg: List[byte]) -> List[byte] ! {decode_error}

The peer's certificate chain out of a Certificate wire message (§4.4.2): the CertificateEntry cert_data blobs CONCATENATED, leaf first — exactly cert.validate_chain's chain currency. Per-entry extensions are skipped; an empty certificate_list is decode_error (a server must certify itself). ct: public.

Example: prose (§4's one-module rule) — tests/x/tls/client/rfc8448_parse_vectors.lu extracts RFC 8448's 432-octet certificate and asserts the bytes verbatim.

certificate_verify_of

fn · Source line 718

pub fn certificate_verify_of(msg: List[byte]) -> CertVerifyView ! {decode_error}

Parse a CertificateVerify wire message (§4.4.3): scheme (uint16) + uint16-prefixed signature filling the body. ct: public.

finished_of

fn · Source line 742

pub fn finished_of(msg: List[byte]) -> List[byte] ! {decode_error}

The verify_data out of a Finished wire message (§4.4.4): the body, which for this profile's SHA-256 must be exactly 32 bytes. ct: public (the MAC is wire material; judging it is handshake.accept_finished's job).

verify_certificate_verify

fn · Source line 794

pub fn verify_certificate_verify( spki_alg: str, spki_key: List[byte], scheme: int, sig: List[byte], transcript_hash: List[byte], ) -> int ! {unsupported_alg, bad_signature, weak_key}

Verify a server CertificateVerify signature (§4.4.3) against the validated leaf's SPKI: spki_alg/spki_key are the leaf's (cert.Cert's fields), transcript_hash is the running hash THROUGH Certificate (CertificateVerify itself excluded), scheme/ sig are the wire message's. The signed content is sc21's §4.4.3 octets (64 spaces + "TLS 1.3, server CertificateVerify" + 0x00 + the hash), built here via handshake.certificate_verify_content.

Dispatch, each answer named (RFC 8446 §4.2.3 binds each scheme to its key type, and for ECDSA to its curve): ed25519 (0x0807) — an Ed25519 key, sc18's curve25519.verify; ecdsa_secp256r1_sha256 (0x0403) — an EC key, sc23's p256.verify_der (a key that is not a P-256 point fails it); ecdsa_secp384r1_sha384 (0x0503) — an EC key of 97 bytes, sc79's p384.verify_der; rsa_pss_rsae_sha256/384/512 (0x0804..0x0806) — an rsaEncryption key, sc79's rsa.verify_pss with MGF1 over the same hash and a salt of the digest's length. The signature is the wire's bytes verbatim (DER for ECDSA). A recognized scheme over the WRONG key type, a malformed RSA key, or a failed verification is bad_signature (that key cannot have produced it); an RSA key the rsa module's policy refuses as weak (a modulus under 2048 bits, a bad exponent) is weak_key; a modulus over 4096 bits and every unrecognized scheme (rsa_pss_pss_*, rsa_pkcs1_*, SHA-1, ed448) are the named unsupported_alg — never a silent accept. Answers 1 on success so the miss is a row, not a bool a caller can forget (§2).

ct: public data throughout (a signature, a public key and a transcript hash are wire material — the sc18 verify-is-public rule). The ECDSA paths are native-only by their verifiers' lane notes; the Ed25519 path is three-lane.

begin

fn · Source line 1005

pub fn begin( take sock: net.Socket, hostname: str, anchors: List[byte], now: int, client_random: List[byte], key_seed: List[byte], ) -> Pending ! {closed, io}

PHASE ONE: take ownership of a connected socket (the CALLER dialed — net.connect is the caller's line), build and send the ClientHello, return without reading.

hostname rides SNI and is the name the chain must certify; anchors is the caller-supplied root store (concatenated DER, one or more roots — a distribution's bundle converted to DER is the intended input; NO OS truststore is read); now is the compact cert.timestamp(...) UTC time the chain is judged at (supplied, never the wall clock — sc22's determinism rule). client_random (32 bytes) and key_seed (the 32-byte X25519 private scalar) are the CALLER'S entropy; both are contract arguments (a wrong length or a non-byte element traps — the caller could have checked).

The ClientHello this profile sends: 0x1303 alone, SNI, groups [x25519], signature_algorithms signature_schemes() (ed25519, ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512), supported_versions [0x0304], one X25519 key share. Rows: the transport's (closed, io).

To bound the WHOLE handshake, arm net.set_deadline on the socket BEFORE calling this — the budget is per-fd host state and survives the handoff; every read complete makes then answers timeout instead of hanging on a stalled peer.

ct: the scalar is SECRET — it is stored, not branched on; the derivation is sc18's ladder (its ct: line holds). Everything else here is public message building.

complete

fn · Source line 1085

pub fn complete(take p: Pending) -> Client ! { closed, timeout, io, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }

PHASE TWO: read the server flight, verify EVERYTHING, send the client Finished, answer the established Client.

The flow (§4.1, driven through sc21's hs_step so a reordered or duplicated flight is the named unexpected_message, never a wrong state): ServerHello (parsed + judged — downgrade, handshake_failure, illegal_parameter, unexpected_message for a HelloRetryRequest), the key schedule's client side (sc21 over sc20/sc16, with sc18's X25519 — the all-zero shared secret is the zero row), then the encrypted flight opened record by record (sc20's open: a forged/tampered record is bad_record_mac with zero plaintext exposed; handshake messages may span or share records — the client reassembles): EncryptedExtensions (structure-checked), Certificate (chain extracted, a path built and validated by cert.validate_path to one of the caller's roots — twelve named rejections), CertificateVerify (VERIFIED — see verify_certificate_verify), server Finished (sc21's accept_finished — a wrong MAC is decrypt_error with nothing derived onward). Then the client Finished goes out under the handshake keys, the application traffic secrets derive, and the Client is the answer.

A ChangeCipherSpec record (middlebox compatibility, §5) is ignored wherever it appears, per the RFC. An alert mid-handshake is handshake_failure (the peer refused; its own named refusal is in ITS log). A stalled peer is a hang unless a deadline was armed (begin's note) — with one, every read here answers timeout.

ct: the schedule and Finished carry secrets through sc20/sc21's own paths; every branch here is on public wire material.

read

fn · Source line 1299

pub fn read(mut c: Client) -> List[byte] ! { closed, timeout, bad_record_mac, decode_error, unexpected_message, io, }

One record's application data, deprotected. Post-handshake HANDSHAKE messages (a NewSessionTicket) are skipped, per the RFC; a close_notify (or any alert) answers the closed row — the outcome that ends a read loop, exactly net.read's convention.

Rows: closed (the peer finished — TLS close_notify or TCP eof), timeout (an armed deadline), bad_record_mac (a tampered or forged record — nothing exposed), decode_error (malformed framing), unexpected_message (a plaintext record where sealed ones must ride), io. Never traps on wire data. ct: the AEAD open carries the read key through sc20/sc17.

write

fn · Source line 1361

pub fn write(mut c: Client, data: List[byte]) -> () ! {closed, invalid, io}

Seal data as one application-data record and send it.

Rows: invalid — DECLARED AND UNREACHABLE FROM TYPED CODE since sc35. It named an element of data outside 0..255, checked before any sealing (the caller's data answers a row, §10; the byte tier's own tag, §14); a List[byte] cannot hold one, so the check is gone and the row stays in the vocabulary — the posture wolf-lang#231 took for the two byte-write builtins, adopted verbatim (§14): the row is still what an FFI caller's wrong-width list earns, and removing the tag would be a vocabulary change this rename is not. closed, io — the transport's. The record sequence advances only on success. ct: the seal carries the write key through sc20/sc17.

close

fn · Source line 1382

pub fn close(take c: Client) -> () ! {io}

Close the connection, consuming the Client: a close_notify alert goes out under the write keys (best-effort — a peer that already vanished does not un-close the socket), then the socket closes. take for the facade's reason: every later use is a static use-after-move.

Rows: io — the socket close's. Never traps. ct: the final seal carries the write key; nothing else is secret.

named

fn · Source line 1443

pub fn named[T]( v: T ! { closed, timeout, io, invalid, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }, ) -> T ! {Row(str)}

The value of v, or the NAME of the row that refused it, coarsened into the single payload-carrying tag Row(str) — ONE handler arm at the consumer instead of this module's twenty-three.

This is API-CONVENTIONS §12's coarsening rule at the protocol tier, and errors.coarsen is its shape: the widening is a NAMED call the caller writes, never something a std signature does silently, and what the caller gives up (the ability to branch on twenty rows) is visible in its own source. What it buys is the two costs the first consumer measured (wolf-std#3): the twenty-arm else |e| match e every logger had to write, and the DEAD Client those arms had to forge because a Client-yielding handler must produce a Client. Neither survives here — the value rides through untouched on success, and the failure path never needs one.

The payload is the tag's own NAME, the word this module's header and docs/error-taxonomy.md already use — "expired", "name_mismatch", "handshake_failure". §12 forbids a payload that carries a rendered SENTENCE (it would force the caller to accept this library's wording and make the position unrecoverable); a row name is neither. It is the tag's identity, it is the finest information the row carries, and it is exactly the token an operator greps for. The names are stable: a rename here is a breaking change to this surface and is spelled as one.

The parameter is the module's WHOLE vocabulary — complete's twenty-three rows (twenty until sc79 added weak_key, bad_usage and name_constraints) plus write's invalid — so any raising call in this module (and cert.validate_path's twelve, which this module re-exports verbatim) rides in by width subtyping. std.option's or/exists are the house shape for a row in parameter position.

Rows: Row(str) and nothing else. Total: no traps of its own.

Example (prose — a row value has no literal, F-0038; the runnable forms are tests/x/tls/client/row_naming.lu and the negative battery): client.named(client.complete(take p)) is the Client when the handshake succeeds, and else |Row(name)| binds "expired" when the chain was.

row_name

fn · Source line 1566

pub fn row_name[T]( v: T ! { closed, timeout, io, invalid, decode_error, bad_record_mac, unexpected_message, illegal_parameter, downgrade, handshake_failure, decrypt_error, zero, der, unsupported_alg, bad_signature, expired, not_yet_valid, name_mismatch, not_ca, issuer_mismatch, unknown_critical, weak_key, bad_usage, name_constraints, }, ) -> str

The NAME of the row that refused v, or "ok" when v carries a value — the marking form, for a caller that wants the WORD and not the value.

Answering CONSUMES v exactly as option.exists consumes its argument: a caller that needs the value back reaches for named instead of asking first and calling again. "ok" is reserved — no row in this module is named ok — so row_name(v) == "ok" is the success test.

Rows: none, and no traps. Thin over named by design: one match lives in this module and both faces read it.

Example (prose, F-0038; runnable in tests/x/tls/client/row_naming.lu): client.row_name(client.check_negotiation(view)) is "handshake_failure" for a ServerHello that selected a suite this profile does not offer, and "ok" for one that negotiates.

Constants

No public declarations in this section.

Errors and row tags

Tags named by public signatures: Row, bad_record_mac, bad_signature, bad_usage, closed, decode_error, decrypt_error, der, downgrade, expired, handshake_failure, illegal_parameter, invalid, io, issuer_mismatch, name_constraints, name_mismatch, not_ca, not_yet_valid, timeout, unexpected_message, unknown_critical, unsupported_alg, weak_key, zero. Their conditions are documented on the functions that return them.

No public declarations in this section.