Banking, parcel, and contract apps often let someone sign on glass and tell them instantly whether the stroke "matches the file on record". When the reference features, the distance thresholds, and the accept/reject rule all run in the browser, you have published the verifier — and a map of what it will accept.
A competitor can lift the model. A user can hook the scorer and force a match, or recover enough of a stored signature to replay it. Neither is acceptable if you later treat that result as a completed authorization.
What actually ships
A typical in-browser verifier includes:
- Feature extractors — stroke timing, pressure (if any), curvature histograms, and the normalization that makes sizes comparable.
- Reference templates — stored feature vectors, or a way to decrypt or fetch them into page memory.
- Distance and cutoff rules — the numeric thresholds that turn a distance into "match", "retry", or "fail".
- Quality gates — minimum stroke count, bounding-box size, and the checks that reject an empty scribble.
- Override hooks — staff or "skip for now" flags that bypass the check if a query parameter is present.
The canvas widget can be open source. The function that decides the signature is valid is often already in the bundle.
How it gets lifted
People search the bundle for strings like dtw, signature, or a function named scoreSignature.
export const THRESHOLDS = { match: 0.18, retry: 0.27, minStrokes: 2 }; export function scoreSignature(strokes, reference) { const a = features(strokes); const b = reference.vector || features(reference.strokes); const d = dtw(a, b) / Math.max(a.length, 1); if (strokes.length < THRESHOLDS.minStrokes) return { ok: false, reason: "short" }; return { ok: d <= THRESHOLDS.match, distance: d }; } Once THRESHOLDS and the feature code are public, a rival product can ship "the same matcher", and a motivated user can hook scoreSignature so it always returns ok: true. If the reference vector is also in memory, you have given away a reusable template, not just a yes/no check.
What actually protects you
Move acceptance off the client
- Authoritative signature checks belong on the server, against the current reference, with the stroke or image you actually received.
- Reference templates should not be downloaded in full into a public page. If you need a local hint, use a coarse quality check only.
- "Accepted signature" decisions on a payment, delivery, or contract workflow must be recorded server-side.
Protect a local quality check if you still want one
A local check can tell the user the scribble is too short before upload. For that chunk:
- Ship quality gates (too few strokes, tiny bounding box), not the production match thresholds or stored templates.
- Bundle the helper separately from the capture UI.
- Apply stronger-than-mangling protection (control-flow flattening or VM-based compilation) to any feature code or cutoffs you still ship.
- Leave source maps off the public CDN.
- Do not put staff bypasses only in the client.
Do not treat the client as a signing authority
If a delivery or a contract is marked signed because the page returned ok, anyone can force the return value. Official acceptance needs a server that saw the strokes.
Practical checklist
- [ ] Payment, delivery, and contract acceptance use a server-side match, not only the in-page scorer.
- [ ] Reference templates are not shipped in full in the public bundle.
- [ ] Any local helper is a quality check, split from the capture UI, and protected with stronger-than-Terser obfuscation.
- [ ] Source maps for the verifier are not on the public CDN.
- [ ] Hooking the scorer cannot mark a signature as accepted in a system you control.
- [ ] Staff bypasses are authorized and logged on the server.
- [ ] The UI does not present a local-only result as a completed legal or payment authorization.
Honest limits
Handwriting varies, and a determined person can still practice against a public demo. Obfuscation raises the cost of lifting the model and hooking the scorer; it does not replace a server-side decision. If a template cannot be public, do not put it in JavaScript you send to every browser.
Summary
A browser signature verifier ships the work that makes it decisive: the features, the templates, and the cutoffs. Use a local quality check if you must, protect that chunk, and let the server be the only path that accepts a signature.
Disclosure: I work on VEILVM, a JavaScript VM-protection service. Free browser tier (3 runs/day, up to 5 KB) and a Pro plan at $9/month or $79/year with API access. Try the playground at vm.ldvmp.com.