nx_acme_response.nx
buildroot/runtime/nx_acme_response.nx
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
imports: nx_syscalls_x86_64.nxnx_http_header_find.nx
imported by: nx_acme_response_test.nx
structs
| 130 | struct AcmeResponse |
consts
| 40 | const NXAR_OK: i64 = 0 |
| 41 | const NXAR_BAD_STATUS_LINE: i64 = 1 |
| 42 | const NXAR_NO_HEADER_END: i64 = 2 |
| 43 | const NXAR_BODY_TOO_SHORT: i64 = 3 |
| 44 | const NXAR_BAD_ARG: i64 = 4 |
| 45 | const NXAR_VERDICT_N: i64 = 5 |
| 140 | const ACME_RESPONSE_BYTES: i64 = 56 // 7 i64 fields |
functions
| 47 | func nxar_verdict_is_valid(v: i64) -> i64 called by 1: main |
| 53 | func nxar_verdict_name(v: i64) -> *u8 called by 1: main |
| 71 | func nxar_parse_status_code(buf: *u8, len: i64) -> i64 |
| 103 | func nxar_find_body_offset(buf: *u8, len: i64) -> i64 |
| 147 | func nx_acme_response_parse( |
| 207 | func nx_acme_response_is_success(out: *AcmeResponse) -> i64 called by 1: main |
| 214 | func nx_acme_response_is_client_error(out: *AcmeResponse) -> i64 called by 1: main |
| 221 | func nx_acme_response_should_retry(out: *AcmeResponse) -> i64 called by 1: main |