AtlatestRepositorysigil-http3

sigil-http3 / tree / scriptsphantom-phone-query-check.sh

1#!/usr/bin/env bash
2set -euo pipefail
3cd "$(dirname "$0")/.."
4mkdir -p build
5record_result() {
6 local job_rc=$?
7 printf 'RESULT phone-query-job rc=%s\n' "$job_rc" | tee -a build/phone-query-result.txt
8}
9trap record_result EXIT
10printf 'RESULT phone-query-loopback-only no-live-phone-listener\n' | tee build/phone-query-result.txt
12# This page-only check reuses a measured native binary without recompiling it.
13# Verify its exact hash, QUIC pin and completed real-echo/reaping receipt first.
14node --input-type=module <<'VERIFY'
15import { readFileSync, mkdirSync, copyFileSync, chmodSync } from 'node:fs';
16import { createHash } from 'node:crypto';
17const job = process.env.HTTP3_PREBUILT_JOB;
18if (!/^[a-z0-9][a-z0-9-]{0,63}$/.test(job ?? '')) throw new Error('Expected an admitted prebuilt job');
19const root = ((process.env.HTTP3_WORKSPACE_ROOT ?? (process.cwd() + '/build/workspaces')) + '/') + job + '/src';
20const receipt = JSON.parse(readFileSync(root + '/build/browser/capabilities.json'));
21const source = root + '/tools/interop/build/native/bin/http3-preflight';
22const hash = createHash('sha256').update(readFileSync(source)).digest('hex');
23if (receipt.mode !== 'webtransport-echo' || receipt.binarySha256 !== hash ||
24 receipt.quicRevision !== readFileSync('quic.rev', 'utf8').trim() ||
25 !['ready', 'bidirectionalEcho', 'unidirectionalEcho', 'datagramEcho', 'chromeReaped', 'serverReaped']
26 .every(key => receipt[key] === true)) throw new Error('Prebuilt real-echo provenance mismatch');
27mkdirSync('tools/interop/build/native/bin', { recursive: true });
28copyFileSync(source, 'tools/interop/build/native/bin/http3-preflight');
29chmodSync('tools/interop/build/native/bin/http3-preflight', 0o700);
30console.log('RESULT verified-prebuilt-sha256=' + hash);
31VERIFY
32bash scripts/phantom-lifecycle-check.sh
33HTTP3_PREFLIGHT_PREBUILT=1 HTTP3_PREFLIGHT_HTTPS_PAGE=1 HTTP3_PREFLIGHT_QUERY=1 \
34 bash scripts/phantom-browser-preflight.sh