Repository navigation
fix(truapi-host): serve the host surface from a signing worker host - #1358
Merged
Merged
Conversation
A web host booted with role "signing" could not mount a product: the worker forwards permission reads to the runtime, and WasmSigningHostRuntime had no permission methods. The signing wasm constructor also dropped the host's chat, contacts and device-permission-status callbacks. - SigningHostRuntime gains the three permission authorization methods, delegating to its HostAdmin as PairingHostRuntime does, and WasmSigningHostRuntime exposes them plus notifyContactsChanged. - The signing wasm constructor wires every optional platform adapter the pairing one does, naming each field so a new one cannot be dropped. - The worker records which role it booted. Its runtime types no longer claim a signing runtime has the pairing methods, so a role-specific call must check the role, and a request for the other role rejects by name.
johnthecat
force-pushed
the
fix/signing-host-runtime-parity
branch
from
October 9, 2026 14:23
5cf8de3 to
372ef47
Compare
Contributor
Bundle size reportCompared with
WebAssembly modules
Changed files (1)
Commit: 372ef47 |
Contributor
|
CI Status: 24 required jobs green, 21 passed and 3 skipped by path filter. All job results
Signing credentials: failure as of 2026-10-09, a release may fail Commit |
filvecchiato
approved these changes
Oct 10, 2026
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.
A web host booted with
createWebWorkerPairingHostRuntime(worker, callbacks, { role: "signing" })serves the same host surface as a pairing host.Why
dotli's local wallet mode boots a signing host on the
testingbundle. When it mounts a product it reads stored device permissions to build the iframeallowattribute, and the worker failed withruntime.permissionAuthorizationStatuses is not a function, so no product loaded.WasmSigningHostRuntimehad no permission methods. TypeScript did not catch this because the worker'sWorkerSigningHostRuntimetype extended the pairing type and claimed every pairing method.What the signing host does
SigningHostRuntimehaspermission_authorization_status,permission_authorization_statusesandset_permission_authorization_status, delegating to itsHostAdminasPairingHostRuntimedoes.WasmSigningHostRuntimeexposes them under the pairing wrapper's names and signatures, plusnotifyContactsChanged.Deniedwhatever is stored, and on the test host a Worker product's chat calls reach the mock, which is what the Playwright fixture'sgetChatRooms,getChatBotsandgetChatMessageLogrecord.WorkerHostRuntimeholds what both runtimes offer, and the pairing and signing types extend it with only their own methods, so a role-specific call has to check the role. A request only a pairing host answers, such asgetSessionChatIdentityKeyoractivateStoredSession, rejects with an error naming the request.cancelPairingandnotifySessionStoreChangeddo nothing on a signing host, which has no pairing and no stored session.The worker's runtime types are internal. The published
wasm/*types come from the wasm-bindgen declarations, which gain methods only.Testing
src/worker-signing-host.test.tsruns the realcreateWebWorkerPairingHostRuntimeagainst the real worker script and the testing bundle in one process, which is the path dotli takes. It covers a permission read through the browser's device gate, a Worker product's chat call reaching the mock host, and a pairing-only request being refused by name. Each case fails against the previous code.Locally:
make wasm,REQUIRE_WASM=1 bun testinjs/packages/truapi-host,tsc, rustfmt, and clippy for the native (--all-features) and wasm (wasm-signing-host,test-host) builds oftruapi. Not run: the workspacecargo testand the browser Playwright suites.