Skip to content

Conversation

Step7750
Copy link
Member

@Step7750 Step7750 commented Sep 22, 2025

Mega-PR that provides E2E functionality for computing tlsn proofs. There will be a few follow ups for submitting proofs and auto-computing them in certain circumstances.

Overview:

  • New NOTARY_PROVE method for external communication
  • New bridge layer for service worker <-> offscreen communication
  • Decent chunk of auxiliary bootstrapping in order to load WASM (ie. mutated CSP, headers)
  • Permits only one ongoing proof at a time -- likely a good idea regardless since CPU can briefly spike during proof gen

Firefox is not supported: It appears to not be possible to set Cross-Origin-Embedder-Policy and Cross-Origin-Opener-Policy headers on the FF background page itself (dynamic MV3 header rewrite rules were a no-go as well). Given the small % that FF makes up on the site, we can likely shift them to the app to complete associated tasks.


Note

Introduces TLSNotary proof generation with a new NOTARY_PROVE request, offscreen worker pipeline, and build/manifest updates (CSP, permissions, assets) to load WASM and enable multi-threading.

  • Notary/TLSN:
    • Add NOTARY_PROVE request/handler (src/lib/bridge/handlers/notary_prove.ts) with max concurrency, using tlsn-js to produce presentation proofs.
    • New notary request types/utilities (src/lib/notary/types.ts, src/lib/notary/utils.ts) and offscreen client bridge (src/offscreen/client.ts).
  • Offscreen Infrastructure:
    • Implement offscreen runtime (src/offscreen/offscreen.{html,ts}), request routing (src/offscreen/handlers/*), worker thread (src/offscreen/worker.ts), and lifecycle utils (src/offscreen/utils.ts).
    • Initialize TLSN worker threads and compute request/response byte sizes for proving.
  • Bridge Wiring:
    • Register RequestType.NOTARY_PROVE in handlers.ts and enums; add MaxConcurrency wrapper in cached.ts.
  • Build/Manifest:
    • manifest.json: add minimum_chrome_version, permission offscreen, and CSP for extension pages (allow WASM eval).
    • webpack.config.js: add offscreen entry, copy TLSN assets/snippets, provide Buffer, set COOP/COEP headers for dev; filter offscreen permission for Firefox; add local hosts in dev.
    • tsconfig.json: update module to es2022.
  • Config/Utils:
    • Add notary endpoints and logging levels to environment*.ts.
    • Add wait(ms) util.
  • Dependencies:
    • Add tlsn-js, comlink, and buffer (and associated WASM/snippets) to project.

Written by Cursor Bugbot for commit 75e45c9. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

Copy link
Collaborator

@GODrums GODrums left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few optional minor improvements. Overall, super impressive technology though.

cursor[bot]

This comment was marked as outdated.

@@ -0,0 +1,48 @@
const OFFSCREEN_DOCUMENT_PATH = '/src/offscreen.html';

let creating: Promise<void> | null;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Document Creation Promise Not Reset

The creating variable isn't reset if offscreen document creation fails. This leaves it as a rejected promise, preventing all future attempts to open the document.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants