code wiki / (root) / nx_acme_response.nx

nx_acme_response.nx

buildroot/runtime/nx_acme_response.nx

7399 B228 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind librarytopic acme
docsdependenciesstructsconstsfunctions

about

nx_acme_response.nx -- ACME (RFC 8555) HTTP response parser. Extracts the four fields the ACME state machine needs from any CA response: 1. HTTP status code (200, 201, 204, 400, etc.) 2. Replay-Nonce header (RFC 8555 §6.5; the nonce we use for the NEXT request -- single-use per RFC 8555 §6.5.1) 3. Location header (account-URL / order-URL / challenge-URL depending on the endpoint) 4. Body offset + length (JSON payload for the caller to parse) Composes: nx_http_header_find.nx -- case-insensitive header search Per cardinal feedback-defensive-at-boundaries-trusting-internally: the parser validates the response shape ONCE; downstream callers trust the parsed fields. Per RFC 8555 §6.4: ACME servers MAY include Replay-Nonce on ANY response (success or error). We extract it always. If absent, the caller treats the next request as needing a fresh /new-nonce roundtrip. nx_capability_claims: needs: [sealed_enum, http_header_search] provides: [acme_response_parse, replay_nonce_extract, location_header_extract] safety: [no_unchecked_deref, no_floating_point, no_syscall, bounded_iteration, bit_equal_reproducible] verdict: [sealed_enum_6_state] license: ORIGINAL kind: racing_crew_specialist layer: L3 (algorithm: HTTP response -> ACME-typed fields)

dependencies 2 imports · 1 importers

nx_syscalls_x86_64.nx nx_http_header_find.nx nx_acme_response.nx nx_acme_response_test.nx

imports: nx_syscalls_x86_64.nxnx_http_header_find.nx

imported by: nx_acme_response_test.nx

structs

130struct AcmeResponse

consts

40const NXAR_OK: i64 = 0
41const NXAR_BAD_STATUS_LINE: i64 = 1
42const NXAR_NO_HEADER_END: i64 = 2
43const NXAR_BODY_TOO_SHORT: i64 = 3
44const NXAR_BAD_ARG: i64 = 4
45const NXAR_VERDICT_N: i64 = 5
140const ACME_RESPONSE_BYTES: i64 = 56 // 7 i64 fields

functions

47func nxar_verdict_is_valid(v: i64) -> i64
called by 1: main
53func nxar_verdict_name(v: i64) -> *u8
called by 1: main
71func nxar_parse_status_code(buf: *u8, len: i64) -> i64
103func nxar_find_body_offset(buf: *u8, len: i64) -> i64
147func nx_acme_response_parse(
207func nx_acme_response_is_success(out: *AcmeResponse) -> i64
called by 1: main
214func nx_acme_response_is_client_error(out: *AcmeResponse) -> i64
called by 1: main
221func nx_acme_response_should_retry(out: *AcmeResponse) -> i64
called by 1: main