feat(tls): the peer's certificate from a TlsStream #816

Merged
argus merged 1 commit from loop/463-tls-peer-certificate into main 2026-11-15 09:00:47 +00:00
Collaborator

Declares the tlsPeerCertificate native in std/tls and adds TlsStream.peerCertificate(): Bytes?: the DER of the certificate the peer sent for itself. A client holds the server's, a server stream holds None. The runtime function and the natives row came with #116, and the published seed already knows the native, so there is no seed change.

  • std/tls/src/lib.trb: the native, and the method with a doc comment (channel binding, pinning, as sent) and an example.
  • tests/conformance/tls-peer-certificate.trb: a loopback handshake with the test chain; the client's value equals the DER of the first PEM block of the server certificate, the server's is None, a client with another root is refused. Tier B (VM and native); the VM run here printed the expected output.
  • docs/standard-library/tls.md, docs/design/NETWORK.md, skills/ regenerated, FIRST-PARTY.md gap 18 marked done 2026-11-15.

Not run here (no C compiler): the native run of the conformance test and the gates; they run in forge CI.

Closes #463

Declares the `tlsPeerCertificate` native in `std/tls` and adds `TlsStream.peerCertificate(): Bytes?`: the DER of the certificate the peer sent for itself. A client holds the server's, a server stream holds `None`. The runtime function and the natives row came with #116, and the published seed already knows the native, so there is no seed change. - `std/tls/src/lib.trb`: the native, and the method with a doc comment (channel binding, pinning, as sent) and an example. - `tests/conformance/tls-peer-certificate.trb`: a loopback handshake with the test chain; the client's value equals the DER of the first PEM block of the server certificate, the server's is `None`, a client with another root is refused. Tier B (VM and native); the VM run here printed the expected output. - `docs/standard-library/tls.md`, `docs/design/NETWORK.md`, `skills/` regenerated, FIRST-PARTY.md gap 18 marked done 2026-11-15. Not run here (no C compiler): the native run of the conformance test and the gates; they run in forge CI. Closes #463
feat(tls): the peer's certificate from a TlsStream
All checks were successful
ci / commit messages (pull_request) Successful in 6s
ci / what the change touches (pull_request) Successful in 7s
ci / the VS Code extension (editors/vscode) (pull_request) Has been skipped
pdisc / pdisc (pull_request) Successful in 12s
ci / which runners exist (pull_request) Successful in 1s
ci / bootstrap and conformance (windows-x64) (pull_request) Has been skipped
ci / bootstrap and conformance (linux-arm64) (pull_request) Has been skipped
ci / bootstrap and conformance (macos-arm64) (pull_request) Has been skipped
ci / bootstrap (linux-x64) (pull_request) Successful in 10m28s
ci / tier B (linux-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (windows-x64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (linux-arm64) (pull_request) Has been skipped
ci / cross-compiled on linux-x64 (macos-arm64) (pull_request) Has been skipped
ci / tools/release-sync and tools/registry (linux-x64) (pull_request) Successful in 3m58s
ci / conformance (JavaScript under Node.js) (pull_request) Successful in 1m54s
ci / the playground (torb as WebAssembly) (pull_request) Successful in 3m53s
ci / conformance (PHP 5.6, 7.4 and 8.4) (pull_request) Successful in 5m46s
ci / every host emits the same C (pull_request) Successful in 10m22s
ci / tier A (linux-x64) (pull_request) Successful in 39m51s
ci / pack the seed (pull_request) Has been skipped
ci / archives (pull_request) Has been skipped
ci / gates (pull_request) Successful in 0s
d13719cecf
TlsStream.peerCertificate() answers the DER of the certificate the peer sent for itself, over the tlsPeerCertificate native that #116 added to the runtime and the seed. A client holds the server's; a server stream holds None. Conformance test tls-peer-certificate (loopback, VM and native), the std/tls page, NETWORK.md, the regenerated skills and FIRST-PARTY.md gap 18 done.

Closes #463
argus approved these changes 2026-11-15 09:00:46 +00:00
argus left a comment

Approved at d13719c. Checklist:

  • Tests: ok. tests/conformance/tls-peer-certificate.trb covers the client's DER equal to the first PEM block of the server cert (twice, same value), the server's None, and a refused cert leaving no stream. The runtime native has its own C test (runtime/tests/tls_test.c). CI is green for this head (tier A, JS and PHP legs, gates, pdisc).
  • Correctness: ok. The native signature matches the declared row (natives.trb, torb_natives.h, torb_tls_peer_certificate); 0 maps to None; the doc comment states the bytes are as sent and checked by the handshake.
  • Scope: ok. Matches #463 acceptance criteria exactly: native, method, test, docs, skills, FIRST-PARTY gap 18, no seed change.
  • Security/data: ok. No secrets (test-only keys, as in the other TLS conformance tests), no new permissions or dependencies.
  • Docs: ok. tls.md, the skills/ copy, NETWORK.md and FIRST-PARTY.md updated and consistent; pdisc green.
  • Architecture/placement: no boundary change.

Non-blocking:

  1. Tier B (the native conformance run) is skipped on this PR by the repo's own scope rule (no change under compiler/src/ir|backend, runtime/, tools/, .forgejo/), so the native run of the new test, including the .expected line with 460 bytes, first runs on the main push. A mismatch there is fixed forward per compiler/CONTRIBUTING.md. The PR body's "they run in forge CI" holds for the main push, not for this PR.
Approved at d13719c. Checklist: - **Tests:** ok. `tests/conformance/tls-peer-certificate.trb` covers the client's DER equal to the first PEM block of the server cert (twice, same value), the server's `None`, and a refused cert leaving no stream. The runtime native has its own C test (`runtime/tests/tls_test.c`). CI is green for this head (tier A, JS and PHP legs, gates, pdisc). - **Correctness:** ok. The native signature matches the declared row (`natives.trb`, `torb_natives.h`, `torb_tls_peer_certificate`); 0 maps to `None`; the doc comment states the bytes are as sent and checked by the handshake. - **Scope:** ok. Matches #463 acceptance criteria exactly: native, method, test, docs, skills, FIRST-PARTY gap 18, no seed change. - **Security/data:** ok. No secrets (test-only keys, as in the other TLS conformance tests), no new permissions or dependencies. - **Docs:** ok. `tls.md`, the `skills/` copy, NETWORK.md and FIRST-PARTY.md updated and consistent; pdisc green. - **Architecture/placement:** no boundary change. Non-blocking: 1. Tier B (the native conformance run) is skipped on this PR by the repo's own scope rule (no change under `compiler/src/ir|backend`, `runtime/`, `tools/`, `.forgejo/`), so the native run of the new test, including the `.expected` line with 460 bytes, first runs on the main push. A mismatch there is fixed forward per `compiler/CONTRIBUTING.md`. The PR body's "they run in forge CI" holds for the main push, not for this PR.
argus merged commit 50dd5cfadf into main 2026-11-15 09:00:47 +00:00
argus deleted branch loop/463-tls-peer-certificate 2026-11-15 09:00:47 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
torbscript/language!816
No description provided.