Universal JS verifier + static browser verify page (SC6 browser path)#29
Merged
Conversation
… path) Refactor verifiers/js/verify.mjs into an environment-agnostic module (pure-JS SHA-256 validated against node:crypto on 20k+ inputs, number-preserving parser, no Node/DOM APIs) so the same verifier runs under Node, Deno, and in a browser. Move the Node CLI + corpus runner to verifiers/js/cli.mjs. Add verifiers/web/index.html: a static, self-contained, view-source-auditable page that verifies a pasted receipt entirely client-side (no server) -- the SC6 browser path. Paste -> VALID, tamper -> INVALID, malformed -> PARSE_ERROR. Re-ran the 10^6 differential fuzz with the pure-SHA-256 verifier: still 0 divergences. Corpus 28/28. ruff-clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes Phase 1's stranger-UX half (SC6 browser path) by making the SC2 verifier run in a browser.
What changed
verifiers/js/verify.mjsis now environment-agnostic: pure-JS SHA-256 (validated againstnode:cryptoon 20k+ inputs), a number-preserving JSON parser, and no Node/DOM APIs — so the same file runs under Node, Deno, and in a browser. Exportsverdict(text).verifiers/js/cli.mjs(new): the Node CLI + corpus runner (--vectors,--batch, single-file), split out of the verifier.verifiers/web/index.html(new): a static, self-contained, view-source-auditable page that verifies a pasted receipt entirely client-side — no server, nothing to trust. Paste → VALID, tamper → INVALID, malformed → PARSE_ERROR (all instant). This is the SC6 "static browser page".Verification
cli.mjs --vectors.verify.mjs(embedded sample → VALID, tamper → INVALID, malformed → PARSE_ERROR; inlined multiplier set matches the corpus).Design note
One ~300-line file is now simultaneously the SC2 second implementation and the SC6 stranger-facing verifier, because the security core is language-neutral by design (
canon_f64). The only non-neutral surface is the outerattestation_hash(raw floats), handled by the number-preserving parser — still the case for migrating it tocanon_f64in a future spec revision.Remaining
The
pipx run <dist> verifyCLI path + a formal timed cold-start transcript (rest of SC6), and an optional Go/Rust static-binary third impl if a toolchain lands.