code wiki / (root) / nx_porkbun_domain.nx

nx_porkbun_domain.nx

buildroot/runtime/nx_porkbun_domain.nx

16765 B320 linesdepth 21pulls 138 transitivereach 3 importersview sourcekind tooltopic porkbun
docsdependenciesstructsconstsfunctions

about

nx_porkbun_domain.nx -- Porkbun DOMAIN lifecycle client: pricing / availability / SSL-bundle retrieve / REGISTER (purchase). Completes the existing Porkbun family (nx_acme_porkbun = DNS records; nx_acme_issue = ACME cert issuance; this = the domain PURCHASE + golive side). Composes nx_acme_http's nx_acme_req transport (TLS 1.3 with the proven 1.2 fallback that api.porkbun.com needs) + nx_acme_porkbun's pk_* builders/checkers. Creds come from the sovereign vault decrypt output (line1=apikey, line2=secretapikey; NEVER printed, NEVER hardcoded). SPEND SAFETY BY CONSTRUCTION (the register path): R1 the endpoint must be VERIFIED against banked documentation bytes on disk (knowledge/library/pb_api_docs.txt must contain the endpoint path) -- an unverified spend endpoint REFUSES before any network I/O (assumption-free APIs, rule 4). R2 creds file must load (both lines nonempty). R3 the caller must pass the LITERAL token confirm-spend (no default-yes anywhere). R4 a price quote (cents) and a spend CAP (cents) are required; quote>cap REFUSES. R5 only after R1-R4 does the request go out; the raw response is printed for the operator. CLI modes: docs -- bank the API documentation page (GET over the 1.2-capable transport) -> knowledge/library/pb_api_docs.txt pricing -- keyless POST /pricing/get (public price list) ping <credfile> -- authed POST /ping (read-only; prints yourIp body) check <domain> <credfile> -- POST /domain/checkDomain/<domain> (availability+price) ssl <domain> <credfile> <outfile> -- POST /ssl/retrieve/<domain>; bundle SAVED 0600, never printed register <domain> <credfile> <price_cents> <cap_cents> confirm-spend license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_acme_porkbun.nx nx_itoa_lib.nx nx_porkbun_domain.nx nx_golive.nx nx_porkbun_domain_gate.nx

imports: nx_acme_porkbun.nxnx_itoa_lib.nx

imported by: nx_golive.nxnx_porkbun_domain_gate.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main pbd_w pbd_store nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_length x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

27const PBD_MAGIC_4194304: i64 = 4194304
28const PBD_MAGIC_2048: i64 = 2048
29const PBD_MAGIC_1200: i64 = 1200
30const PBD_MAGIC_1048576: i64 = 1048576
32const PBD_RESP_CAP: i64 = 262144
33const PBD_DOCS_PATH: *u8 = "knowledge/library/pb_api_docs.txt\x00"
34const PBD_SPEC_PATH: *u8 = "knowledge/library/pb_api_spec.txt\x00"

functions

36func pbd_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: pbd_showmain
41func pbd_n(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: pbd_showmain calls 1: nxi_out
42func pbd_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: pbd_findmain
43func pbd_streq(a: *u8, b: *u8) -> i64
called by 1: main
50func pbd_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 2: pbd_docs_has_createmain calls 1: pbd_slen
64func pbd_read_file(path: *u8, buf: *u8, cap: i64) -> i64
77func pbd_store() -> *TrustStore
83func pbd_creds(path: *u8, ak_off: *i64, ak_len: *i64, sk_off: *i64, sk_len: *i64, raw: *u8) -> i64
called by 2: mainmain calls 1: pbd_read_file
104func pbd_show(resp: *u8, total: i64, maxbody: i64) -> i64
126func pbd_pricing(store: *TrustStore, now: i64, resp: *u8, rn: *i64) -> i64
133func pbd_ping(raw: *u8, ao: i64, an: i64, so: i64, sn2: i64, store: *TrustStore, now: i64, resp: *u8, rn: *i64) -> i64
141func pbd_check(raw: *u8, ao: i64, an: i64, so: i64, sn2: i64, dom: *u8, store: *TrustStore, now: i64, resp: *u8, rn: *i64) -> i64
152func pbd_ssl(raw: *u8, ao: i64, an: i64, so: i64, sn2: i64, dom: *u8, store: *TrustStore, now: i64, resp: *u8, rn: *i64) -> i64
165func pbd_register_wall(docs_ok: i64, creds_ok: i64, confirm_ok: i64, quote_cents: i64, cap_cents: i64) -> i64
called by 3: gl_createmainmain
177func pbd_docs_has_create(buf: *u8, cap: i64) -> i64
183func pbd_putn(dst: *u8, off: i64, v: i64) -> i64
195func main(argc: i64, argv: *i64) -> i64