worktrust 0.11.1 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/engine-release.json +1 -1
- package/package-release.json +1 -1
- package/package.json +2 -1
- package/remote-cli.mjs +19 -5
- package/remote-daemon.mjs +10 -1
- package/remote-endorse.mjs +43 -0
- package/remote-protocol.mjs +260 -185
- package/remote-run.mjs +4 -1
- package/remote-store.mjs +8 -2
- package/worktrust.mjs +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# worktrust
|
|
2
2
|
|
|
3
|
+
## 0.11.2: your phone adds a browser
|
|
4
|
+
|
|
5
|
+
A browser where you use app.worktrust.io can steer this computer's agents without a walk to its keyboard: the browser
|
|
6
|
+
shows a code, your phone scans it and asks Face ID, and this computer adds the browser only if you allowed it here once
|
|
7
|
+
(`npx worktrust remote phones allow-endorse on`, off by default), only for a browser of your own account, and only within
|
|
8
|
+
five minutes. The terminal says when a browser was added and `npx worktrust remote phones` lists which phone added it;
|
|
9
|
+
each one stays revocable. The Passport's issuer key stays pinned. What is measured for the passport is unchanged:
|
|
10
|
+
remote-steered sessions never count as your hours, and the measure rules stay 3.
|
|
11
|
+
|
|
3
12
|
## 0.11.1: terminal sessions, and the live preview you can touch
|
|
4
13
|
|
|
5
14
|
`npx worktrust remote terminal on` lets the phone start Claude Code in a terminal session on WorkTrust's own tmux socket
|
package/engine-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"179baf829eda488bab3f17ae6917473ec01d0d6346f47de7bc144351274f19c8","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"eb3bc0972bc30788521a492e136ed792d8265e0c5b8aede81fec4f3e071a25d0","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","remote-adapter-claude-code.mjs":"a5ef08186128d9fe4023944378bb0ff5682a8ae64ffdb07ef5e76cc51894d721","remote-adapter-codex.mjs":"d2fd6c61d9e3c4a45e9b10da1aa3c15d45c86629d6456e4a8d25ad95b13eb209","remote-adapter-terminal.mjs":"9237d3747a25126fcdad42c0eab10e69393754388a6014b30fb0890b9c735888","remote-approval-bridge.mjs":"092f17b7969e4f35bea064315d04dcde1faa6a3fd3e737dcc05aece82c7a37c4","remote-approvals.mjs":"5a371e049ceb154100a3b0c1900d8a2c1fc193b01e8069f11ce1690bcf4df3e1","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-cdp.mjs":"70e333a1ebe845e872cc3a703a0a507391f8ce59640bdbd662bdad55eeff216b","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"179baf829eda488bab3f17ae6917473ec01d0d6346f47de7bc144351274f19c8","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"eb3bc0972bc30788521a492e136ed792d8265e0c5b8aede81fec4f3e071a25d0","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","remote-adapter-claude-code.mjs":"a5ef08186128d9fe4023944378bb0ff5682a8ae64ffdb07ef5e76cc51894d721","remote-adapter-codex.mjs":"d2fd6c61d9e3c4a45e9b10da1aa3c15d45c86629d6456e4a8d25ad95b13eb209","remote-adapter-terminal.mjs":"9237d3747a25126fcdad42c0eab10e69393754388a6014b30fb0890b9c735888","remote-approval-bridge.mjs":"092f17b7969e4f35bea064315d04dcde1faa6a3fd3e737dcc05aece82c7a37c4","remote-approvals.mjs":"5a371e049ceb154100a3b0c1900d8a2c1fc193b01e8069f11ce1690bcf4df3e1","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-cdp.mjs":"70e333a1ebe845e872cc3a703a0a507391f8ce59640bdbd662bdad55eeff216b","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"61d2f9ed71f3bfc9b9526084da8936e555373d0208e1c54aeb644e926c450788","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-daemon.mjs":"5dadcced9bd2c69be8c48afbaabbf50bd16879612ada0553aa2284a873907492","remote-endorse.mjs":"89eda4883567176703e01e44d83e987271bc2a6134e108f517b3b213719a21f9","remote-inventory.mjs":"ece467b45a50a3fff8c59a13f8224bc1a8a723fbeadb2371d9843ba1147b685c","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-live-preview.mjs":"faa70f9260ac05037204c2a0c3facf4ffe42f68408948390b341b453a2932289","remote-pairing.mjs":"ae03427b6510e52da08aaf9387d5e08516ee25380c7efa420432f4e1e936a7c5","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"aacf7578537021ab3849095bb1f58f0ed12c453c6ca2ab1352a1716fb13b0ca4","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"d07997167d1f51139ff010c8753639e48c5cd33688568459e184eabb12bfff84","remote-protocol.mjs":"7b2a78e585983be40e240b9ab0b2e31a69e586bd72292071886c60b217d97a60","remote-qr.mjs":"b80e2b4a5bc020cf6ed92e91d06b327cb5197de1c35b3445a0fc2c7a3bf1ab3f","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"c72c77fdd14115e66f1f2be383ca4f1363a4cecc9dced9cc48cbb3e4bb44bc66","remote-screen-approvals.mjs":"c43ab286d36a38d17639d155782ffa017f1a9b6806a09b82ed0142a1290b6000","remote-screen-push.mjs":"4ee8bd48d24b2c87581e9f33d8354a86381f7febd82f89ed509a7a87c1442608","remote-screen-states.mjs":"7c3c86a584bebf52461f3cab39c05ea2a13910061704d48fc622956e842940f7","remote-service.mjs":"1b9d4ecf99b667f2ab7c78fe1dfd5cf507cbb36c5bcad15bfa2a88c313ae758e","remote-session-list.mjs":"494fdbe20f0542806ac6c42ad149c52e2d3ace23a3a7567f96dc7e80d092c727","remote-sessions.mjs":"fad62c5c3cb9dabf177b39bcc843a78b77784e3711f8a22398f1b518a6adfc08","remote-steered.mjs":"fbbd3685a8cd497ae03235d258e2116e2129aac19046759fb2468fe79911f0b3","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"9dc5d436890f0b63edb13d513993666e83e40946983f2387941c9705a7440ddb","remote-terminal-cli.mjs":"82a048b75e412d0b6db076afbb84cab7c754dec72b6c8b6af4d4906b38e988a7","remote-terminal-sessions.mjs":"6ab51824890a18768d23cedc499f3840b2b02a8ed651463c1fe2d74dd352a361","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"b9fe20d7445205bdbf4cf2eaaf9cc770dad01e23d41e644b04930ca34e10426d","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"2f5b4331e3a258dedc8fbe6a02be86e255dc4f6428498852f2e44c3cd60028cd"},"format":"worktrust-package/1","kind":"engine","version":"0.11.2"},"signature":"UKw1rWDLf-EoEkix6K2KdE-AIf-k2slr0uDlInwPEu5WE1JwG_NVXuZZa4OrH5IE9737JaBGUeV-BvW-V_8bAw"}
|
package/package-release.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"b38ea343eb95892d4164274be4184d6e34eade9d4c454e1dcf8bc7735736425e","README.md":"
|
|
1
|
+
{"keyId":"608168ccdef72562fc91f9c0f9f2c2d6876bece7f7362cb545b818f7947da6b5","payload":{"files":{"AGENTS.md":"e8abb38c293b57b71d3a6163d6242d1f375e773372b91b6d8ce39c584c51262a","CLAUDE.md":"5933504f93e5a40369a4790e96dd5dad791d849d3178b1833eb64088e456aaeb","LICENSE":"b38ea343eb95892d4164274be4184d6e34eade9d4c454e1dcf8bc7735736425e","README.md":"5ae43f9eb213f460452ac5ef2103fc133e338293c7834751bfc07720e17ac6ff","SECURITY.md":"69f654b8101ab49821b8eb54b631f0a028035149c727953dc7d609faa2a9b2e0","chat-exports.mjs":"f026c5a063f62c22ba6f25474a9d9fdbb6074beebbfe1faff2a876c437a1a000","claude-mod.mjs":"02d86b0cdddf39879efc5194c0a5be6b41456faedec28963dc123a4e88dc3942","commit-rules.mjs":"e94cc32a5415f6d9e978145ab9505ac4ae0bac9431e6e9104b9b37155260b51f","config-edits.mjs":"527a7674f9d52b284bfda3b8089eb4b930a709bf14aedbec7f6eef1e59ef52ee","count-behaviour.mjs":"179baf829eda488bab3f17ae6917473ec01d0d6346f47de7bc144351274f19c8","credential-store.mjs":"a4b3540a61f4ce19e535c7f1d260c0d817686cd066d559a76db2ab108144abba","credential-vault-scripts.mjs":"7e42fe1db3885c2dec6f1de87bebfbefe2292d29179a68f3da87d19eb6c7704b","credential-vault.mjs":"279baabb217e2a3f170e8d7f2b271a88484531f9031c441360ea91561a70da99","engine-release.json":"0fa871e5b2683205b8a97b2f66efddcae1949e4148dbc92cb3e1cd18b1b7cb3c","export-facts.mjs":"3bbb46c80e8678b5cea7e15dcbfc456a2b48595053241c2b3cea508092f9b917","git-commits.mjs":"f9c084c54937a86df8fe30a0db2a58e04eeef0dbae69c54b8e368efc9964d6d8","history-outbox.mjs":"85c70389effc5b4ec9d9b33af9192314e67f47af2752515b42a7959344ce2354","history-progress.mjs":"dcc25ee94b727f2605a763349a4d8764640335d6cf0043fb6108cebeed16dcb9","log-session.mjs":"eb3bc0972bc30788521a492e136ed792d8265e0c5b8aede81fec4f3e071a25d0","orchestration-contract.mjs":"ec08f303a166365b99e70b675de4cfe76c6156c2567e14b5569f6d992f0231b7","orchestration-evidence.mjs":"d0d06cecf0eb08e5c6e653c62a4f45b1eddf2119c2acb8341056b34f488d214a","orchestration-report.mjs":"d4e0a9ad8e4a01b462d22c6b1866aac291565c533ff476085d3367cb6d59bc1b","package-integrity.mjs":"a8210c9494a56bfb9a5ea3d10064c7a269f0b6330c0af7c0700e706c3c0224e3","package.json":"990fb6526487b14dfe3241639d67293679ba465ab4c0f3d8e1a1554af7e98a67","preserve-lines.mjs":"2df64a69687aa51219bf7b86b88d175cc50990fa29574b31897e41a9ebeecf43","preserve-summary.mjs":"137f781ed7021596a3f0ea67afcf2ab8616ac293f833dbb8f176e838e0ed8321","preserve.mjs":"cd111cae0f53a25a2d878a158479abfb1ace353361454843f91a16d241101d46","remote-adapter-claude-code.mjs":"a5ef08186128d9fe4023944378bb0ff5682a8ae64ffdb07ef5e76cc51894d721","remote-adapter-codex.mjs":"d2fd6c61d9e3c4a45e9b10da1aa3c15d45c86629d6456e4a8d25ad95b13eb209","remote-adapter-terminal.mjs":"9237d3747a25126fcdad42c0eab10e69393754388a6014b30fb0890b9c735888","remote-approval-bridge.mjs":"092f17b7969e4f35bea064315d04dcde1faa6a3fd3e737dcc05aece82c7a37c4","remote-approvals.mjs":"5a371e049ceb154100a3b0c1900d8a2c1fc193b01e8069f11ce1690bcf4df3e1","remote-attachments.mjs":"2e9c1277329a45cf26c0c62abda632cf0ab9fad78d0504416ecee9805220e16c","remote-cdp.mjs":"70e333a1ebe845e872cc3a703a0a507391f8ce59640bdbd662bdad55eeff216b","remote-changes.mjs":"2141fece4961a5bc1bb1b046f78222812617457b1ba6452275eac6a897e62e19","remote-claude-events.mjs":"58822471203c6a1b66cf81c115c4d713657c3dea5c7b98df959f894ee5b2e704","remote-claude-progress.mjs":"2ca626d3dbc16d8d570abe1df6477b7e44ffb43c1d9145228ec5ea1928e415ca","remote-cli.mjs":"61d2f9ed71f3bfc9b9526084da8936e555373d0208e1c54aeb644e926c450788","remote-coalesce.mjs":"cb0967d9cfe81e3892bcade8349d6814db98be8c2adbdb54df0b8d1b142f65d1","remote-codex-events.mjs":"58657d6070a50c837737cb85f5a1eaf9c2cbc4e1adfe3e970748ab3b2af94631","remote-daemon.mjs":"5dadcced9bd2c69be8c48afbaabbf50bd16879612ada0553aa2284a873907492","remote-endorse.mjs":"89eda4883567176703e01e44d83e987271bc2a6134e108f517b3b213719a21f9","remote-inventory.mjs":"ece467b45a50a3fff8c59a13f8224bc1a8a723fbeadb2371d9843ba1147b685c","remote-journal.mjs":"907ebd48c53162b22dc743ef95b53c1a6be6886a7495605b5cfa820b8de9d330","remote-live-preview.mjs":"faa70f9260ac05037204c2a0c3facf4ffe42f68408948390b341b453a2932289","remote-pairing.mjs":"ae03427b6510e52da08aaf9387d5e08516ee25380c7efa420432f4e1e936a7c5","remote-pipeline-config.mjs":"00cde6a61ce21144c51ac56fce42fee159aa9dba6586218a7ea790ce4a6bd40b","remote-pipeline-parsers.mjs":"43ca0d332d7bc883c4759a754a555815ae5dfe133446b91ba9f2e48a350fa20f","remote-pipeline.mjs":"b856ead989b29ddb618ef69bbacd104bae2b02c9d1c5214291d08ce469a8b24e","remote-policy.mjs":"aacf7578537021ab3849095bb1f58f0ed12c453c6ca2ab1352a1716fb13b0ca4","remote-preview.mjs":"fe504ad6f83dcb4a4ebdcc018686a9a5a900c47cdf8c45b75e7d02e2f3056155","remote-projects.mjs":"d07997167d1f51139ff010c8753639e48c5cd33688568459e184eabb12bfff84","remote-protocol.mjs":"7b2a78e585983be40e240b9ab0b2e31a69e586bd72292071886c60b217d97a60","remote-qr.mjs":"b80e2b4a5bc020cf6ed92e91d06b327cb5197de1c35b3445a0fc2c7a3bf1ab3f","remote-release-plans.mjs":"11884a62b7d6dcccb5e154a26603bdf650f7b40f946329fb174d8c13729bec74","remote-releases.mjs":"fb08b72593ea00013c8b679e0c0d7dee95b0fd7cc5fd31b80ac575d0e340927d","remote-run.mjs":"c72c77fdd14115e66f1f2be383ca4f1363a4cecc9dced9cc48cbb3e4bb44bc66","remote-screen-approvals.mjs":"c43ab286d36a38d17639d155782ffa017f1a9b6806a09b82ed0142a1290b6000","remote-screen-push.mjs":"4ee8bd48d24b2c87581e9f33d8354a86381f7febd82f89ed509a7a87c1442608","remote-screen-states.mjs":"7c3c86a584bebf52461f3cab39c05ea2a13910061704d48fc622956e842940f7","remote-service.mjs":"1b9d4ecf99b667f2ab7c78fe1dfd5cf507cbb36c5bcad15bfa2a88c313ae758e","remote-session-list.mjs":"494fdbe20f0542806ac6c42ad149c52e2d3ace23a3a7567f96dc7e80d092c727","remote-sessions.mjs":"fad62c5c3cb9dabf177b39bcc843a78b77784e3711f8a22398f1b518a6adfc08","remote-steered.mjs":"fbbd3685a8cd497ae03235d258e2116e2129aac19046759fb2468fe79911f0b3","remote-steering.mjs":"7ba22e6110cea3ac75a4f084f8f92a5bd90c31a19d3ce58a88a0843bdadea834","remote-store.mjs":"9dc5d436890f0b63edb13d513993666e83e40946983f2387941c9705a7440ddb","remote-terminal-cli.mjs":"82a048b75e412d0b6db076afbb84cab7c754dec72b6c8b6af4d4906b38e988a7","remote-terminal-sessions.mjs":"6ab51824890a18768d23cedc499f3840b2b02a8ed651463c1fe2d74dd352a361","remote-transport.mjs":"68650fd77ea09b5762377f87cabdc1c73a34d77324aa5bf0cd9742094a50c32b","runtime-install.mjs":"aab47b52c79d726ef428a24f982c648fa3f1c2dc2b574f633611d02924864e5f","self-update.mjs":"378e3620d48c72cf0bf812be408883b995cdb2223de34a20f762dd73eeffb258","session-databases.mjs":"b9fe20d7445205bdbf4cf2eaaf9cc770dad01e23d41e644b04930ca34e10426d","setup-mcp.mjs":"b732e3dd9b3e522b7cc8acf167ce28ba8f1a8dee797ee15bd7c3b02919b13e6f","stack-rules.mjs":"b23c56e72ec56ba02b17ed895f869172d988c468a697e8d6026b0e268f61e489","stretch-evidence.mjs":"5f5667b92adf11b1a5a6330a0f26dd6db73d56fe60823d9a5246dab71d27d380","transcript-readers.mjs":"e9f20415c2b5d62a09f35a63075002ebd1da56edb32f242d52822d58ecbd8ac3","worktrust-launch.mjs":"84801bd29d472d48188c126b9ebe3989a3132b54e13cc4fe534ff7c383a294ee","worktrust.mjs":"2f5b4331e3a258dedc8fbe6a02be86e255dc4f6428498852f2e44c3cd60028cd"},"format":"worktrust-package/1","kind":"npm","version":"0.11.2"},"signature":"D0Yl2npatOy2Oujr2Y9u6mW-cjcdqo5yXAE33Wp6bqzXmQnEVtlT43iKkMWOwaWz6olmOBNOXgViEI-QnTt4Bg"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "worktrust",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"description": "Couple this computer to WorkTrust: approve a code in your browser, and every AI app here reports what you built. Metadata only, no dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
"remote-sessions.mjs",
|
|
78
78
|
"remote-session-list.mjs",
|
|
79
79
|
"remote-changes.mjs",
|
|
80
|
+
"remote-endorse.mjs",
|
|
80
81
|
"remote-daemon.mjs",
|
|
81
82
|
"remote-transport.mjs",
|
|
82
83
|
"remote-run.mjs",
|
package/remote-cli.mjs
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* remote pause | resume refuse every command for now | take them again
|
|
10
10
|
* remote disable [--forget] the hard off: the service removed; --forget also deletes the keys
|
|
11
11
|
* remote phones [confirm <id> | remove <id>] phones: pending ones are confirmed here, at the keyboard
|
|
12
|
+
* remote phones allow-endorse on|off may a confirmed phone add a browser it scanned (default off)
|
|
12
13
|
* remote projects add <folder> | remove <id> | list the folders a phone may steer an agent in
|
|
13
14
|
* remote run the daemon in the foreground (Windows runs only this way)
|
|
14
15
|
* remote pipeline review <folder> | status read a granted folder's .worktrust/pipeline.json, show every stage
|
|
@@ -143,6 +144,15 @@ async function phones(io, rest) {
|
|
|
143
144
|
io.say(` ✓ Confirmed: phone · ${phone.fingerprint}`);
|
|
144
145
|
return;
|
|
145
146
|
}
|
|
147
|
+
if (rest[0] === "allow-endorse") {
|
|
148
|
+
// At this keyboard only (2026-11-09, remote-endorse.mjs): a phone confirmed here may then add a browser it scanned.
|
|
149
|
+
if (rest[1] !== "on" && rest[1] !== "off") io.fail("npx worktrust remote phones allow-endorse on|off");
|
|
150
|
+
if (rest[1] === "on" && !process.stdin.isTTY) io.fail("endorsements are allowed at this keyboard, in a terminal");
|
|
151
|
+
if (rest[1] === "on" && !(await askTyped(" A phone confirmed here may then add a browser it scanned as a controller of this computer. Allow it?"))) { io.say(" Not changed."); return; }
|
|
152
|
+
saveSettings({ ...loadSettings(), allow_endorse: rest[1] === "on" });
|
|
153
|
+
io.say(rest[1] === "on" ? " ✓ Your confirmed phones may add a browser. Each one is listed here with the phone that added it." : " ✓ No phone may add a browser. Browsers already added stay until you remove them.");
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
146
156
|
if (rest[0] === "remove") {
|
|
147
157
|
const phone = find(rest[1]);
|
|
148
158
|
if (!phone) io.fail("no phone by that fingerprint or id");
|
|
@@ -152,7 +162,10 @@ async function phones(io, rest) {
|
|
|
152
162
|
return;
|
|
153
163
|
}
|
|
154
164
|
io.say(` Confirmed phones (${list.confirmed.length}):`);
|
|
155
|
-
|
|
165
|
+
const when = (ms) => new Date(ms).toISOString().slice(0, 16).replace("T", " ");
|
|
166
|
+
const how = (p) => p.how === "endorsed" ? `a browser, added by phone ${p.endorsed_by?.fingerprint ?? "?"}${[...list.confirmed, ...list.removed].some((x) => x.device_id === p.endorsed_by?.device_id && !list.confirmed.includes(x)) ? " (since removed)" : ""} on ${when(p.confirmed_at)}` : p.how === "qr" ? "scanned the QR" : "confirmed at the keyboard";
|
|
167
|
+
for (const p of list.confirmed) io.say(` ${p.fingerprint} ${p.device_id} (${how(p)})`);
|
|
168
|
+
io.say(` Phones may add a browser: ${loadSettings().allow_endorse ? "yes" : "no"} (npx worktrust remote phones allow-endorse on|off)`);
|
|
156
169
|
io.say(` Pending phones (${list.pending.length}):`);
|
|
157
170
|
for (const p of list.pending) io.say(` ${p.fingerprint} ${p.device_id} confirm: npx worktrust remote phones confirm ${p.fingerprint}`);
|
|
158
171
|
if (list.removed.length > 0) {
|
|
@@ -261,14 +274,15 @@ function status(io) {
|
|
|
261
274
|
const settings = loadSettings(), identity = loadIdentity(), keys = identity ? loadKeys() : null, phonesList = loadPhones(), service = serviceState();
|
|
262
275
|
const agents = inventory({ env: { ...process.env, PATH: settings.agent_path ?? process.env.PATH } }).reports.filter((r) => r.installed);
|
|
263
276
|
const summary = { enabled: settings.enabled, paused: settings.paused, paired: Boolean(identity), device_id: identity?.device_id ?? null, fingerprint: keys ? fingerprintOf(keys) : null,
|
|
264
|
-
gateway: settings.gateway, service, node_websocket: webSocketAvailable(), phones: { confirmed: phonesList.confirmed.length, pending: phonesList.pending.length }, projects: loadProjects().length,
|
|
277
|
+
gateway: settings.gateway, service, node_websocket: webSocketAvailable(), phones: { confirmed: phonesList.confirmed.length, pending: phonesList.pending.length, browsers_added: phonesList.confirmed.filter((p) => p.how === "endorsed").length, allow_endorse: settings.allow_endorse === true }, projects: loadProjects().length,
|
|
265
278
|
agents: agents.map((a) => ({ adapter: a.adapter, version: a.version, adapter_ready: a.capabilities.start, models: a.models === null ? "not listed" : a.models.length })), invite_open: Boolean(readJson("invite.json")?.used === false) };
|
|
266
279
|
if (io.has("json")) { io.say(JSON.stringify(summary, null, 2)); return; }
|
|
267
280
|
io.say(` Remote: ${settings.enabled ? (settings.paused ? `paused (${settings.paused === "desk" ? "here" : "from a phone"})` : "on") : "off"}`);
|
|
268
281
|
io.say(` Paired: ${identity ? `${identity.device_id} · key ${summary.fingerprint}` : "no"}`);
|
|
269
282
|
io.say(` Gateway: ${settings.gateway ?? "none set"}${settings.gateway && isLoopbackGateway(settings.gateway) ? " (this computer: dev relay)" : ""}`);
|
|
270
283
|
io.say(` Service: ${service.kind === "foreground" ? "none on this system: run `npx worktrust remote run`" : `${service.installed ? "installed" : "not installed"}, ${service.running ? "running" : "not running"}`}`);
|
|
271
|
-
io.say(` Phones: ${summary.phones.confirmed} confirmed, ${summary.phones.pending} pending · Folders granted: ${summary.projects}`);
|
|
284
|
+
io.say(` Phones: ${summary.phones.confirmed} confirmed (${summary.phones.browsers_added} browsers added by a phone), ${summary.phones.pending} pending · Folders granted: ${summary.projects}`);
|
|
285
|
+
io.say(` Phones may add a browser: ${summary.phones.allow_endorse ? "yes" : "no"}`);
|
|
272
286
|
for (const a of summary.agents) io.say(` Agent: ${a.adapter} ${a.version ?? ""} · ${a.adapter_ready ? "remote adapter ready" : "installed, no adapter yet"} · models: ${a.models}`);
|
|
273
287
|
}
|
|
274
288
|
|
|
@@ -282,7 +296,7 @@ export async function remoteCommand(args, io) {
|
|
|
282
296
|
const s = loadSettings();
|
|
283
297
|
saveSettings({ ...s, enabled: false, paused: null });
|
|
284
298
|
io.say(` Off. The service is removed (${removeService()}); the daemon stops by itself within seconds.`);
|
|
285
|
-
if (io.has("forget")) { for (const f of ["remote-keys.json", "identity.json", "channels.json", "phones.json", "invite.json", "journal.jsonl", "projects.json", "pipelines.json", "released.json", "roots.json", "previews.json"]) removeFile(f); io.say(" The remote keys, phones, folders and journal are deleted. The steered-session ledger stays, so earlier remote work stays out of your AI Hours."); }
|
|
299
|
+
if (io.has("forget")) { for (const f of ["remote-keys.json", "identity.json", "channels.json", "phones.json", "endorsements.json", "invite.json", "journal.jsonl", "projects.json", "pipelines.json", "released.json", "roots.json", "previews.json"]) removeFile(f); io.say(" The remote keys, phones, folders and journal are deleted. The steered-session ledger stays, so earlier remote work stays out of your AI Hours."); }
|
|
286
300
|
return;
|
|
287
301
|
}
|
|
288
302
|
if (sub === "phones") return phones(io, rest);
|
|
@@ -326,5 +340,5 @@ export async function remoteCommand(args, io) {
|
|
|
326
340
|
if (sub === "releases") return releasesCommand(io, rest);
|
|
327
341
|
if (sub === "terminal") return (await import("./remote-terminal-cli.mjs")).terminalCommand(io, rest, askTyped);
|
|
328
342
|
if (sub === "attach") return (await import("./remote-terminal-cli.mjs")).attachCommand(io, rest);
|
|
329
|
-
io.say(" npx worktrust remote enable | pair | status | pause | resume | disable [--forget] | phones [confirm|remove <id
|
|
343
|
+
io.say(" npx worktrust remote enable | pair | status | pause | resume | disable [--forget] | phones [confirm|remove <id>|allow-endorse on|off] | projects add|remove|list | run | pipeline review <folder>|status | roots add|remove|list | preview allow|deny|list | codex on|off | terminal on|off|list|start | attach <id> | releases [released <n>]");
|
|
330
344
|
}
|
package/remote-daemon.mjs
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { basename } from "node:path";
|
|
14
14
|
import * as P from "./remote-protocol.mjs";
|
|
15
|
-
import { confirmedFingerprints, controllerKeys, loadChannels, loadPhones, loadProjects, loadRoots, loadSettings, readJson, saveChannels, savePhones, saveProjects, saveSettings, writeJson } from "./remote-store.mjs";
|
|
15
|
+
import { confirmedFingerprints, controllerKeys, loadChannels, loadEndorsements, loadPhones, loadProjects, loadRoots, loadSettings, readJson, saveChannels, saveEndorsements, savePhones, saveProjects, saveSettings, writeJson } from "./remote-store.mjs";
|
|
16
|
+
import { acceptEndorsement } from "./remote-endorse.mjs";
|
|
16
17
|
import { createProject, rootLabel, worktreeMain } from "./remote-projects.mjs";
|
|
17
18
|
|
|
18
19
|
// What a paused computer still answers: reading, configuring, disconnecting, and taking work away (a pipeline's cancel).
|
|
@@ -148,6 +149,14 @@ export function createDaemonCore(o) {
|
|
|
148
149
|
o.log("project_created", { git: made.git });
|
|
149
150
|
return "taken";
|
|
150
151
|
}
|
|
152
|
+
if (env.type === "browser.endorse") {
|
|
153
|
+
// A confirmed phone adds a browser it scanned (remote-endorse.mjs): only with this computer's opt-in, for its own account.
|
|
154
|
+
const decided = acceptEndorsement({ allowed: settings.allow_endorse, phones: loadPhones(), spent: loadEndorsements().spent, sender: env.sender_device_id, payload, issuerKeys: o.issuerKeys, account: o.local.claims.sub, now: o.now() });
|
|
155
|
+
if (!decided.ok) { o.log("endorse_refused", { reason: decided.reason }); return decided.reason; }
|
|
156
|
+
saveEndorsements({ spent: decided.spent });
|
|
157
|
+
if (decided.added) { savePhones(decided.phones); o.log("browser_endorsed", { device_id: decided.added.device_id, fingerprint: decided.added.fingerprint, by: decided.added.endorsed_by.device_id }); }
|
|
158
|
+
return "taken";
|
|
159
|
+
}
|
|
151
160
|
if (env.type === "approval.decision") return approvals.decide(payload.decision_token).ok ? "taken" : "approval_invalid";
|
|
152
161
|
if (P.RELEASE_COMMANDS.has(env.type)) return releases ? releases.handle(env, payload) : "unsupported"; // remote-releases.mjs
|
|
153
162
|
if (env.type === "attachment.put" || env.type === "attachment.clear") return o.attachments ? o.attachments.handle(env, payload) : "unsupported"; // remote-attachments.mjs
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A PHONE ADDS A BROWSER TO THIS COMPUTER (2026-11-09, docs/remote-agents/PROTOCOL.md §A phone endorses a browser). The
|
|
3
|
+
* daemon's decision on a sealed `browser.endorse`, pure: it takes the state and answers the next state, so
|
|
4
|
+
* scripts/check-remote-cli.mjs proves each refusal on its own. The browser becomes a controller ONLY when all hold:
|
|
5
|
+
* 1. this computer allowed endorsements at its keyboard (`worktrust remote phones allow-endorse on`; default off);
|
|
6
|
+
* 2. the sender is a controller confirmed here at the keyboard or by a scanned QR, never one added by endorsement (no
|
|
7
|
+
* chains: an endorsed browser endorses nobody);
|
|
8
|
+
* 3. the browser's issuer binding verifies, as a controller, for THIS computer's own account (crypto/endorse.ts);
|
|
9
|
+
* 4. the endorsement is in time (five minutes at most) and its nonce was never spent here (single use).
|
|
10
|
+
* The browser is listed with who added it and when; removing the endorsing phone later does not remove the browsers it
|
|
11
|
+
* added (each stays revocable here and in WorkTrust, and `remote phones` names the phone that added it).
|
|
12
|
+
*/
|
|
13
|
+
import * as P from "./remote-protocol.mjs";
|
|
14
|
+
|
|
15
|
+
const KEEP_SPENT_MS = (P.ENDORSE_LIFETIME_S * 1000) + 10 * 60_000;
|
|
16
|
+
const MAX_SPENT = 200;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* → { ok: true, phones, spent, added } | { ok: false, reason } where reason is a protocol reject reason:
|
|
20
|
+
* `not_allowed` (no opt-in, a sender that may not, another account, a binding that does not verify), `expired`, `conflict`
|
|
21
|
+
* (a nonce already spent). An endorsement of a browser already confirmed is taken again without a change.
|
|
22
|
+
*/
|
|
23
|
+
export function acceptEndorsement({ allowed, phones, spent, sender, payload, issuerKeys, account, now }) {
|
|
24
|
+
if (allowed !== true) return { ok: false, reason: "not_allowed" };
|
|
25
|
+
const from = phones.confirmed.find((p) => p.device_id === sender);
|
|
26
|
+
if (!from || (from.how !== "keyboard" && from.how !== "qr")) return { ok: false, reason: "not_allowed" };
|
|
27
|
+
const checked = P.checkEndorsement(payload, { issuerKeys, now, account });
|
|
28
|
+
if (!checked.ok) return { ok: false, reason: checked.code === "expired" ? "expired" : "not_allowed" };
|
|
29
|
+
const live = (spent ?? []).filter((s) => s.at + KEEP_SPENT_MS > now);
|
|
30
|
+
if (live.some((s) => s.nonce === checked.value.nonce)) return { ok: false, reason: "conflict" };
|
|
31
|
+
const b = checked.value;
|
|
32
|
+
const nextSpent = [...live, { nonce: b.nonce, at: now }].slice(-MAX_SPENT);
|
|
33
|
+
if (phones.confirmed.some((p) => p.fingerprint === b.fingerprint)) return { ok: true, phones, spent: nextSpent, added: null };
|
|
34
|
+
const browser = { device_id: b.device_id, fingerprint: b.fingerprint, ed25519_pub: b.keys.ed25519_pub, x25519_pub: b.keys.x25519_pub, how: "endorsed", confirmed_at: now,
|
|
35
|
+
endorsed_by: { device_id: from.device_id, fingerprint: from.fingerprint } };
|
|
36
|
+
return {
|
|
37
|
+
ok: true,
|
|
38
|
+
spent: nextSpent,
|
|
39
|
+
added: browser,
|
|
40
|
+
phones: { ...phones, pending: phones.pending.filter((p) => p.fingerprint !== b.fingerprint), removed: (phones.removed ?? []).filter((p) => p.device_id !== b.device_id),
|
|
41
|
+
confirmed: [...phones.confirmed.filter((p) => p.fingerprint !== b.fingerprint), browser] },
|
|
42
|
+
};
|
|
43
|
+
}
|
package/remote-protocol.mjs
CHANGED
|
@@ -1834,6 +1834,257 @@ export function controlsOffered(actions , delivery
|
|
|
1834
1834
|
};
|
|
1835
1835
|
}
|
|
1836
1836
|
|
|
1837
|
+
// ---- packages/remote-protocol/src/crypto/keys.ts
|
|
1838
|
+
/**
|
|
1839
|
+
* REMOTE DEVICE KEYS. Each computer and each phone install has its own pair: Ed25519 to sign, X25519 to agree keys.
|
|
1840
|
+
* They are NOT the computer's measurement key: a different key, a different store entry, a different audience. A
|
|
1841
|
+
* stolen remote key cannot sign a measurement, and a measurement key cannot steer an agent; every signature here is
|
|
1842
|
+
* also domain-separated ("worktrust-remote/v1/..."), so a signature made for one purpose verifies for no other.
|
|
1843
|
+
*
|
|
1844
|
+
* A FINGERPRINT FOR PEOPLE. 80 bits of SHA-256 over both public keys, as sixteen Crockford base32 characters in four
|
|
1845
|
+
* groups (no I, L, O or U to misread). Shown on the computer's screen and on the phone when a phone is confirmed at
|
|
1846
|
+
* the computer's keyboard, so a compromised issuer cannot slip in a key of its own unnoticed.
|
|
1847
|
+
*/
|
|
1848
|
+
|
|
1849
|
+
export function generateDeviceKeys(random ) {
|
|
1850
|
+
return { ed25519: random(KEY_BYTES), x25519: random(KEY_BYTES) };
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1853
|
+
export function publicKeysOf(secret ) {
|
|
1854
|
+
return { ed25519_pub: toBase64Url(ed25519PublicKey(secret.ed25519)), x25519_pub: toBase64Url(x25519PublicKey(secret.x25519)) };
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
/** For a store that holds strings (expo-secure-store, the CLI's credential store). */
|
|
1858
|
+
export const exportSecretKeys = (secret ) => ({
|
|
1859
|
+
ed25519: toBase64Url(secret.ed25519),
|
|
1860
|
+
x25519: toBase64Url(secret.x25519),
|
|
1861
|
+
});
|
|
1862
|
+
|
|
1863
|
+
export function importSecretKeys(stored ) {
|
|
1864
|
+
const ed = fromBase64Url(stored.ed25519);
|
|
1865
|
+
const x = fromBase64Url(stored.x25519);
|
|
1866
|
+
return ed?.length === KEY_BYTES && x?.length === KEY_BYTES ? { ed25519: ed, x25519: x } : null;
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
1870
|
+
const FINGERPRINT_DOMAIN = utf8Encode("worktrust-remote/v1/fingerprint\n");
|
|
1871
|
+
|
|
1872
|
+
function base32Groups(bytes ) {
|
|
1873
|
+
let bits = 0;
|
|
1874
|
+
let acc = 0;
|
|
1875
|
+
let out = "";
|
|
1876
|
+
for (const b of bytes) {
|
|
1877
|
+
acc = (acc << 8) | b;
|
|
1878
|
+
bits += 8;
|
|
1879
|
+
while (bits >= 5) {
|
|
1880
|
+
bits -= 5;
|
|
1881
|
+
out += CROCKFORD[(acc >> bits) & 31] ;
|
|
1882
|
+
}
|
|
1883
|
+
acc &= (1 << bits) - 1;
|
|
1884
|
+
}
|
|
1885
|
+
return out.match(/.{1,4}/g) .join("-");
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
function decodeKey(text ) {
|
|
1889
|
+
const bytes = fromBase64Url(text);
|
|
1890
|
+
if (bytes?.length !== KEY_BYTES) throw new TypeError("a public key is 32 bytes of base64url");
|
|
1891
|
+
return bytes;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
/** "ABCD-EFGH-JKMN-PQRS" for one device's public keys. */
|
|
1895
|
+
export function deviceFingerprint(keys ) {
|
|
1896
|
+
const digest = sha256(concatBytes(FINGERPRINT_DOMAIN, decodeKey(keys.ed25519_pub), decodeKey(keys.x25519_pub)));
|
|
1897
|
+
return base32Groups(digest.subarray(0, 10));
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
// ---- packages/remote-protocol/src/crypto/jws.ts
|
|
1901
|
+
/**
|
|
1902
|
+
* COMPACT SIGNED TOKENS: JWS (RFC 7515) with EdDSA over Ed25519 (RFC 8037), so the gateway can verify an assertion
|
|
1903
|
+
* with any standard library, and so can the phone and the computer with this package. Three token types, told apart
|
|
1904
|
+
* by `typ` and never interchangeable:
|
|
1905
|
+
* wt-remote-binding+jwt the Passport app binds a device's remote keys to an account
|
|
1906
|
+
* wt-remote-auth+jwt the Passport app authorizes one device at the gateway for five minutes
|
|
1907
|
+
* wt-remote-approval+jwt a phone decides one pending approval
|
|
1908
|
+
* The verifier fixes alg, typ and the key set before it looks at the token: a token cannot choose how it is checked.
|
|
1909
|
+
* Header and payload are canonical JSON, so one claim set has one signing input.
|
|
1910
|
+
*/
|
|
1911
|
+
|
|
1912
|
+
export const TOKEN_TYPES = ["wt-remote-binding+jwt", "wt-remote-auth+jwt", "wt-remote-approval+jwt"] ;
|
|
1913
|
+
|
|
1914
|
+
export const MAX_TOKEN_CHARS = 4096;
|
|
1915
|
+
|
|
1916
|
+
/** Public keys by key id: the issuer's keys (pinned in the app and CLI builds), or a phone's bound key. */
|
|
1917
|
+
|
|
1918
|
+
export function signToken(typ , kid , claims , secret ) {
|
|
1919
|
+
const header = toBase64Url(utf8Encode(canonicalJson({ alg: "EdDSA", kid, typ })));
|
|
1920
|
+
const payload = toBase64Url(utf8Encode(canonicalJson(claims)));
|
|
1921
|
+
const signature = ed25519Sign(utf8Encode(`${header}.${payload}`), secret);
|
|
1922
|
+
return `${header}.${payload}.${toBase64Url(signature)}`;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
const decodeJson = (part ) => {
|
|
1926
|
+
const bytes = fromBase64Url(part);
|
|
1927
|
+
const text = bytes === null ? null : utf8Decode(bytes);
|
|
1928
|
+
return text === null ? undefined : parseJson(text);
|
|
1929
|
+
};
|
|
1930
|
+
|
|
1931
|
+
export function verifyToken(token , typ , keys ) {
|
|
1932
|
+
if (token.length > MAX_TOKEN_CHARS) return refuse("shape", "token: too long");
|
|
1933
|
+
const parts = token.split(".");
|
|
1934
|
+
if (parts.length !== 3) return refuse("shape", "token: not three parts");
|
|
1935
|
+
const [h, p, s] = parts ;
|
|
1936
|
+
const header = decodeJson(h);
|
|
1937
|
+
if (typeof header !== "object" || header === null || Array.isArray(header)) return refuse("shape", "token: header");
|
|
1938
|
+
const hd = header ;
|
|
1939
|
+
if (Object.keys(hd).sort().join(",") !== "alg,kid,typ") return refuse("shape", "token: header fields");
|
|
1940
|
+
if (hd.alg !== "EdDSA") return refuse("shape", "token: alg");
|
|
1941
|
+
if (hd.typ !== typ) return refuse("shape", "token: typ");
|
|
1942
|
+
if (typeof hd.kid !== "string" || !Object.hasOwn(keys, hd.kid)) return refuse("unknown_key", "token: kid");
|
|
1943
|
+
const key = keys[hd.kid] ;
|
|
1944
|
+
const signature = fromBase64Url(s);
|
|
1945
|
+
if (key.length !== KEY_BYTES || signature === null) return refuse("signature", "token: signature encoding");
|
|
1946
|
+
if (!ed25519Verify(signature, utf8Encode(`${h}.${p}`), key)) return refuse("signature", "token: signature");
|
|
1947
|
+
const claims = decodeJson(p);
|
|
1948
|
+
if (typeof claims !== "object" || claims === null || Array.isArray(claims)) return refuse("shape", "token: payload");
|
|
1949
|
+
// The signed bytes must BE the canonical encoding, so one claim set has exactly one valid token form.
|
|
1950
|
+
if (toBase64Url(utf8Encode(canonicalJson(claims))) !== p) return refuse("shape", "token: payload not canonical");
|
|
1951
|
+
if (toBase64Url(utf8Encode(canonicalJson(hd))) !== h) return refuse("shape", "token: header not canonical");
|
|
1952
|
+
return accept({ kid: hd.kid, claims: claims });
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/** iat/exp checks shared by every token kind; seconds, with the protocol's skew. */
|
|
1956
|
+
export function checkTimes(iat , exp , nowMs , maxLifetimeS , skewMs ) {
|
|
1957
|
+
if (exp <= iat) return refuse("lifetime", "token: exp not after iat");
|
|
1958
|
+
if (exp - iat > maxLifetimeS) return refuse("lifetime", "token: lives too long");
|
|
1959
|
+
if (iat * 1000 > nowMs + skewMs) return refuse("not_yet_valid", "token: issued in the future");
|
|
1960
|
+
if (exp * 1000 + skewMs < nowMs) return refuse("expired", "token: expired");
|
|
1961
|
+
return accept(true);
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
// ---- packages/remote-protocol/src/crypto/binding.ts
|
|
1965
|
+
/**
|
|
1966
|
+
* A REMOTE KEY BINDING: the Passport app's signed word that these public keys belong to this device of this account.
|
|
1967
|
+
* The person approves the device in app.worktrust.io, signed in with a second factor; the app signs
|
|
1968
|
+
* { iss, aud, sub, device_id, kind, ed25519_pub, x25519_pub, iat, exp, jti }
|
|
1969
|
+
* with a WorkTrust issuer key. `sub` is an opaque account reference for the remote system (an HMAC of the owner id
|
|
1970
|
+
* under a Passport secret, prefixed usr_), never the Passport owner id, so the relay's records join to nothing else.
|
|
1971
|
+
*
|
|
1972
|
+
* Endpoints verify bindings against the issuer's public keys PINNED in the app and CLI builds, never against a key the
|
|
1973
|
+
* relay hands them. The relay cannot forge a binding. The issuer alone cannot add a controller either: a new phone is
|
|
1974
|
+
* pending on the computer until the person confirms its fingerprint at the computer's keyboard (handshake.ts).
|
|
1975
|
+
*/
|
|
1976
|
+
|
|
1977
|
+
export const DEVICE_KINDS = ["phone", "computer"] ;
|
|
1978
|
+
|
|
1979
|
+
export const BINDING_CLAIMS_SPEC = object({
|
|
1980
|
+
iss: oneOf([PASSPORT_ISSUER]),
|
|
1981
|
+
aud: oneOf([GATEWAY_AUDIENCE]),
|
|
1982
|
+
sub: id("usr"),
|
|
1983
|
+
device_id: id("dev"),
|
|
1984
|
+
kind: oneOf(DEVICE_KINDS),
|
|
1985
|
+
ed25519_pub: b64({ exact: 32 }),
|
|
1986
|
+
x25519_pub: b64({ exact: 32 }),
|
|
1987
|
+
iat: int(0),
|
|
1988
|
+
exp: int(0),
|
|
1989
|
+
jti: id("jti"),
|
|
1990
|
+
});
|
|
1991
|
+
|
|
1992
|
+
/** For the Passport app: validate, then sign. */
|
|
1993
|
+
export function issueBinding(claims , issuerSecret , kid ) {
|
|
1994
|
+
const checked = validate(BINDING_CLAIMS_SPEC, claims, "$binding");
|
|
1995
|
+
if (!checked.ok) throw new TypeError(checked.detail);
|
|
1996
|
+
if (claims.exp - claims.iat > MAX_BINDING_LIFETIME_S || claims.exp <= claims.iat) throw new RangeError("binding lifetime");
|
|
1997
|
+
return signToken("wt-remote-binding+jwt", kid, claims, issuerSecret);
|
|
1998
|
+
}
|
|
1999
|
+
|
|
2000
|
+
export function verifyBinding(token , expect ) {
|
|
2001
|
+
const verified = verifyToken(token, "wt-remote-binding+jwt", expect.issuerKeys);
|
|
2002
|
+
if (!verified.ok) return refuse(verified.code === "shape" ? "binding" : verified.code, verified.detail);
|
|
2003
|
+
const shaped = validate(BINDING_CLAIMS_SPEC, verified.value.claims, "$binding");
|
|
2004
|
+
if (!shaped.ok) return refuse("binding", shaped.detail);
|
|
2005
|
+
const b = shaped.value;
|
|
2006
|
+
const times = checkTimes(b.iat, b.exp, expect.now, MAX_BINDING_LIFETIME_S, CLOCK_SKEW_MS);
|
|
2007
|
+
if (!times.ok) return times;
|
|
2008
|
+
if (expect.kind !== undefined && b.kind !== expect.kind) return refuse("binding", "$binding.kind: not the expected kind");
|
|
2009
|
+
if (expect.deviceId !== undefined && b.device_id !== expect.deviceId) return refuse("wrong_device", "$binding.device_id");
|
|
2010
|
+
if (expect.sub !== undefined && b.sub !== expect.sub) return refuse("account_mismatch", "$binding.sub");
|
|
2011
|
+
if (expect.isRevoked?.(b)) return refuse("revoked", "$binding: revoked");
|
|
2012
|
+
return accept(b);
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
/** The signing key a verified binding names, as bytes. */
|
|
2016
|
+
export const bindingSigningKey = (b ) => fromBase64Url(b.ed25519_pub) ;
|
|
2017
|
+
export const bindingAgreementKey = (b ) => fromBase64Url(b.x25519_pub) ;
|
|
2018
|
+
export const bindingFingerprint = (b ) =>
|
|
2019
|
+
deviceFingerprint({ ed25519_pub: b.ed25519_pub, x25519_pub: b.x25519_pub });
|
|
2020
|
+
|
|
2021
|
+
// ---- packages/remote-protocol/src/crypto/endorse.ts
|
|
2022
|
+
/**
|
|
2023
|
+
* A PHONE ADDS A BROWSER (owner, 2026-11-09: "your phone approves a new browser"; docs/remote-agents/PROTOCOL.md §A phone
|
|
2024
|
+
* endorses a browser). Like linking a messenger's web client: the browser shows a QR code with its issuer binding (its
|
|
2025
|
+
* keys, its device id, its account), a one-time nonce and a short expiry; a CONFIRMED phone scans it, asks the device
|
|
2026
|
+
* unlock, and sends each chosen computer a sealed, signed `browser.endorse` command carrying exactly those three. The
|
|
2027
|
+
* computer adds the browser as a controller only if it allowed endorsements at its keyboard (`worktrust remote phones
|
|
2028
|
+
* allow-endorse on`), the sender is a controller confirmed there or by a scanned QR (never one added by endorsement), the
|
|
2029
|
+
* binding verifies for the computer's OWN account, the endorsement is in time and its nonce was never spent.
|
|
2030
|
+
*
|
|
2031
|
+
* The QR holds one link, everything in the fragment, which no browser sends to a server:
|
|
2032
|
+
* https://app.worktrust.io/remote/endorse#v=1&b=<binding>&n=<16-byte nonce>&e=<expiry, unix s>
|
|
2033
|
+
* This file is the only reader and writer of that link and the one check both the phone and the computer run.
|
|
2034
|
+
*/
|
|
2035
|
+
|
|
2036
|
+
export const ENDORSE_VERSION = 1;
|
|
2037
|
+
/** Five minutes at most from the browser showing it to the computer taking it. */
|
|
2038
|
+
export const ENDORSE_LIFETIME_S = 300;
|
|
2039
|
+
export const ENDORSE_LINK_BASE = "https://app.worktrust.io/remote/endorse";
|
|
2040
|
+
|
|
2041
|
+
/** What travels: the QR's three fields, and the sealed `browser.endorse` payload, the same three. */
|
|
2042
|
+
export const ENDORSEMENT_SPEC = object({ binding: token(4096), nonce: b64({ exact: 16 }), expires_at: int(0) });
|
|
2043
|
+
|
|
2044
|
+
/** The browser makes one for its own binding: a fresh nonce, five minutes. */
|
|
2045
|
+
export function createEndorsement(binding , nowMs , random ) {
|
|
2046
|
+
return { binding, nonce: toBase64Url(random(16)), expires_at: Math.floor(nowMs / 1000) * 1000 + ENDORSE_LIFETIME_S * 1000 };
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
export function encodeEndorseLink(e , base = ENDORSE_LINK_BASE) {
|
|
2050
|
+
return `${base}#v=${ENDORSE_VERSION}&b=${encodeURIComponent(e.binding)}&n=${e.nonce}&e=${Math.floor(e.expires_at / 1000)}`;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
export function decodeEndorseLink(link ) {
|
|
2054
|
+
if (typeof link !== "string" || link.length > 6000) return refuse("shape", "$link");
|
|
2055
|
+
const hash = link.indexOf("#");
|
|
2056
|
+
if (hash < 0 || link.slice(0, hash) !== ENDORSE_LINK_BASE) return refuse("shape", "$link: not a WorkTrust browser link");
|
|
2057
|
+
const raw = {};
|
|
2058
|
+
for (const part of link.slice(hash + 1).split("&")) {
|
|
2059
|
+
const eq = part.indexOf("=");
|
|
2060
|
+
const key = eq > 0 ? part.slice(0, eq) : "";
|
|
2061
|
+
if (!["v", "b", "n", "e"].includes(key) || Object.hasOwn(raw, key)) return refuse("shape", "$link: an unknown or repeated key");
|
|
2062
|
+
try { raw[key] = decodeURIComponent(part.slice(eq + 1)); } catch { return refuse("shape", "$link: encoding"); }
|
|
2063
|
+
}
|
|
2064
|
+
if (raw.v !== String(ENDORSE_VERSION) || !/^[1-9][0-9]{0,11}$/.test(raw.e ?? "")) return refuse("shape", "$link: version or expiry");
|
|
2065
|
+
const shaped = validate(ENDORSEMENT_SPEC, { binding: raw.b, nonce: raw.n, expires_at: Number(raw.e) * 1000 }, "$endorsement");
|
|
2066
|
+
return shaped.ok ? accept(shaped.value) : refuse("shape", shaped.detail);
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* THE CHECK, on the phone before it asks the unlock and on the computer before it adds anyone: the binding verifies against
|
|
2071
|
+
* the pinned issuer keys as a controller (kind phone), for `account` (the checker's own binding's `sub`: a phone of account
|
|
2072
|
+
* A never endorses a browser of account B, and a computer never takes a browser of another account), and the endorsement
|
|
2073
|
+
* is in time and never lives longer than five minutes. Single use is the computer's spent-nonce list, not this function.
|
|
2074
|
+
*/
|
|
2075
|
+
export function checkEndorsement(input , o ) {
|
|
2076
|
+
const shaped = validate(ENDORSEMENT_SPEC, input, "$endorsement");
|
|
2077
|
+
if (!shaped.ok) return refuse("shape", shaped.detail);
|
|
2078
|
+
const e = shaped.value;
|
|
2079
|
+
if (e.expires_at <= o.now) return refuse("expired", "$endorsement.expires_at");
|
|
2080
|
+
if (e.expires_at > o.now + ENDORSE_LIFETIME_S * 1000 + CLOCK_SKEW_MS) return refuse("lifetime", "$endorsement.expires_at");
|
|
2081
|
+
const bound = verifyBinding(e.binding, { issuerKeys: o.issuerKeys, now: o.now, kind: "phone" });
|
|
2082
|
+
if (!bound.ok) return refuse(bound.code, bound.detail);
|
|
2083
|
+
if (bound.value.sub !== o.account) return refuse("account_mismatch", "$endorsement.binding.sub");
|
|
2084
|
+
const keys = { ed25519_pub: bound.value.ed25519_pub, x25519_pub: bound.value.x25519_pub };
|
|
2085
|
+
return accept({ device_id: bound.value.device_id, fingerprint: deviceFingerprint(keys), keys, binding: bound.value, nonce: e.nonce, expires_at: e.expires_at });
|
|
2086
|
+
}
|
|
2087
|
+
|
|
1837
2088
|
// ---- packages/remote-protocol/src/commands.ts
|
|
1838
2089
|
/**
|
|
1839
2090
|
* THE COMMANDS A PHONE MAY SEND, AND NOTHING ELSE. A fixed list, each with a sealed payload schema. A computer refuses
|
|
@@ -1947,6 +2198,12 @@ export const COMMAND_PAYLOAD_SPECS = {
|
|
|
1947
2198
|
* in it only when the person enabled that for the root at the keyboard. Answered with project.created.
|
|
1948
2199
|
*/
|
|
1949
2200
|
"project.create": object({ name: text(100, 1), root_id: id("rot") }),
|
|
2201
|
+
/**
|
|
2202
|
+
* A confirmed phone adds a browser it scanned as a controller of this computer (2026-11-09, crypto/endorse.ts): the
|
|
2203
|
+
* browser's issuer binding, the QR's one-time nonce and its expiry. Taken only when the computer allowed endorsements at
|
|
2204
|
+
* its keyboard, from a phone confirmed there or by a scanned QR, for the computer's own account, in time, nonce unspent.
|
|
2205
|
+
*/
|
|
2206
|
+
"browser.endorse": ENDORSEMENT_SPEC,
|
|
1950
2207
|
/** A release: a bundle of tasks in one project (release.ts). Ids are minted by the phone, once. */
|
|
1951
2208
|
"release.create": object({
|
|
1952
2209
|
release_id: id("rel"),
|
|
@@ -1991,7 +2248,7 @@ export const COMMAND_PAYLOAD_SPECS = {
|
|
|
1991
2248
|
export const COMMAND_TYPES = Object.keys(COMMAND_PAYLOAD_SPECS) ;
|
|
1992
2249
|
|
|
1993
2250
|
export const RELEASE_COMMANDS = new Set (["release.create", "release.add_task", "release.reorder", "release.cancel_task", "release.start", "release.list", "pipeline.start", "pipeline.cancel"]);
|
|
1994
|
-
export const DEVICE_COMMANDS = new Set (["inventory.get", "device.configure", "pairing.revoke", "project.create", "preview.targets", "preview.render", ...RELEASE_COMMANDS]);
|
|
2251
|
+
export const DEVICE_COMMANDS = new Set (["inventory.get", "device.configure", "pairing.revoke", "project.create", "browser.endorse", "preview.targets", "preview.render", ...RELEASE_COMMANDS]);
|
|
1995
2252
|
export const commandScope = (type ) => (DEVICE_COMMANDS.has(type) ? "device" : "session");
|
|
1996
2253
|
|
|
1997
2254
|
/** Commands whose acceptance starts a run with steps, approvals and an end (state-machine.ts follows those through
|
|
@@ -2018,6 +2275,7 @@ export const COMMAND_TTL_MS = {
|
|
|
2018
2275
|
"session.close": 5 * MINUTE,
|
|
2019
2276
|
"session.rename": 5 * MINUTE,
|
|
2020
2277
|
"project.create": 10 * MINUTE,
|
|
2278
|
+
"browser.endorse": 5 * MINUTE,
|
|
2021
2279
|
"attachment.put": 60 * MINUTE,
|
|
2022
2280
|
"attachment.clear": 10 * MINUTE,
|
|
2023
2281
|
"preview.targets": 1 * MINUTE,
|
|
@@ -2173,6 +2431,7 @@ export const REJECT_REASONS = [
|
|
|
2173
2431
|
"conflict", // a command id reused for different bytes
|
|
2174
2432
|
"busy", // the agent is mid-turn and the command needs it idle (a release: its tasks still run, or no slot for a pipeline)
|
|
2175
2433
|
"unreviewed", // the project's pipeline file was not reviewed at the keyboard, or changed since (2026-11-07)
|
|
2434
|
+
"not_allowed", // the computer did not allow it at its keyboard (a browser endorsement without allow-endorse), or the sender may not (2026-11-09)
|
|
2176
2435
|
] ;
|
|
2177
2436
|
|
|
2178
2437
|
export const FAIL_REASONS = ["agent_exited", "adapter_error", "not_ready", "timeout", "internal"] ;
|
|
@@ -2896,190 +3155,6 @@ export function readSteeredLedger(textValue )
|
|
|
2896
3155
|
return { byRef, unreadable, pipelines };
|
|
2897
3156
|
}
|
|
2898
3157
|
|
|
2899
|
-
// ---- packages/remote-protocol/src/crypto/keys.ts
|
|
2900
|
-
/**
|
|
2901
|
-
* REMOTE DEVICE KEYS. Each computer and each phone install has its own pair: Ed25519 to sign, X25519 to agree keys.
|
|
2902
|
-
* They are NOT the computer's measurement key: a different key, a different store entry, a different audience. A
|
|
2903
|
-
* stolen remote key cannot sign a measurement, and a measurement key cannot steer an agent; every signature here is
|
|
2904
|
-
* also domain-separated ("worktrust-remote/v1/..."), so a signature made for one purpose verifies for no other.
|
|
2905
|
-
*
|
|
2906
|
-
* A FINGERPRINT FOR PEOPLE. 80 bits of SHA-256 over both public keys, as sixteen Crockford base32 characters in four
|
|
2907
|
-
* groups (no I, L, O or U to misread). Shown on the computer's screen and on the phone when a phone is confirmed at
|
|
2908
|
-
* the computer's keyboard, so a compromised issuer cannot slip in a key of its own unnoticed.
|
|
2909
|
-
*/
|
|
2910
|
-
|
|
2911
|
-
export function generateDeviceKeys(random ) {
|
|
2912
|
-
return { ed25519: random(KEY_BYTES), x25519: random(KEY_BYTES) };
|
|
2913
|
-
}
|
|
2914
|
-
|
|
2915
|
-
export function publicKeysOf(secret ) {
|
|
2916
|
-
return { ed25519_pub: toBase64Url(ed25519PublicKey(secret.ed25519)), x25519_pub: toBase64Url(x25519PublicKey(secret.x25519)) };
|
|
2917
|
-
}
|
|
2918
|
-
|
|
2919
|
-
/** For a store that holds strings (expo-secure-store, the CLI's credential store). */
|
|
2920
|
-
export const exportSecretKeys = (secret ) => ({
|
|
2921
|
-
ed25519: toBase64Url(secret.ed25519),
|
|
2922
|
-
x25519: toBase64Url(secret.x25519),
|
|
2923
|
-
});
|
|
2924
|
-
|
|
2925
|
-
export function importSecretKeys(stored ) {
|
|
2926
|
-
const ed = fromBase64Url(stored.ed25519);
|
|
2927
|
-
const x = fromBase64Url(stored.x25519);
|
|
2928
|
-
return ed?.length === KEY_BYTES && x?.length === KEY_BYTES ? { ed25519: ed, x25519: x } : null;
|
|
2929
|
-
}
|
|
2930
|
-
|
|
2931
|
-
const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
2932
|
-
const FINGERPRINT_DOMAIN = utf8Encode("worktrust-remote/v1/fingerprint\n");
|
|
2933
|
-
|
|
2934
|
-
function base32Groups(bytes ) {
|
|
2935
|
-
let bits = 0;
|
|
2936
|
-
let acc = 0;
|
|
2937
|
-
let out = "";
|
|
2938
|
-
for (const b of bytes) {
|
|
2939
|
-
acc = (acc << 8) | b;
|
|
2940
|
-
bits += 8;
|
|
2941
|
-
while (bits >= 5) {
|
|
2942
|
-
bits -= 5;
|
|
2943
|
-
out += CROCKFORD[(acc >> bits) & 31] ;
|
|
2944
|
-
}
|
|
2945
|
-
acc &= (1 << bits) - 1;
|
|
2946
|
-
}
|
|
2947
|
-
return out.match(/.{1,4}/g) .join("-");
|
|
2948
|
-
}
|
|
2949
|
-
|
|
2950
|
-
function decodeKey(text ) {
|
|
2951
|
-
const bytes = fromBase64Url(text);
|
|
2952
|
-
if (bytes?.length !== KEY_BYTES) throw new TypeError("a public key is 32 bytes of base64url");
|
|
2953
|
-
return bytes;
|
|
2954
|
-
}
|
|
2955
|
-
|
|
2956
|
-
/** "ABCD-EFGH-JKMN-PQRS" for one device's public keys. */
|
|
2957
|
-
export function deviceFingerprint(keys ) {
|
|
2958
|
-
const digest = sha256(concatBytes(FINGERPRINT_DOMAIN, decodeKey(keys.ed25519_pub), decodeKey(keys.x25519_pub)));
|
|
2959
|
-
return base32Groups(digest.subarray(0, 10));
|
|
2960
|
-
}
|
|
2961
|
-
|
|
2962
|
-
// ---- packages/remote-protocol/src/crypto/jws.ts
|
|
2963
|
-
/**
|
|
2964
|
-
* COMPACT SIGNED TOKENS: JWS (RFC 7515) with EdDSA over Ed25519 (RFC 8037), so the gateway can verify an assertion
|
|
2965
|
-
* with any standard library, and so can the phone and the computer with this package. Three token types, told apart
|
|
2966
|
-
* by `typ` and never interchangeable:
|
|
2967
|
-
* wt-remote-binding+jwt the Passport app binds a device's remote keys to an account
|
|
2968
|
-
* wt-remote-auth+jwt the Passport app authorizes one device at the gateway for five minutes
|
|
2969
|
-
* wt-remote-approval+jwt a phone decides one pending approval
|
|
2970
|
-
* The verifier fixes alg, typ and the key set before it looks at the token: a token cannot choose how it is checked.
|
|
2971
|
-
* Header and payload are canonical JSON, so one claim set has one signing input.
|
|
2972
|
-
*/
|
|
2973
|
-
|
|
2974
|
-
export const TOKEN_TYPES = ["wt-remote-binding+jwt", "wt-remote-auth+jwt", "wt-remote-approval+jwt"] ;
|
|
2975
|
-
|
|
2976
|
-
export const MAX_TOKEN_CHARS = 4096;
|
|
2977
|
-
|
|
2978
|
-
/** Public keys by key id: the issuer's keys (pinned in the app and CLI builds), or a phone's bound key. */
|
|
2979
|
-
|
|
2980
|
-
export function signToken(typ , kid , claims , secret ) {
|
|
2981
|
-
const header = toBase64Url(utf8Encode(canonicalJson({ alg: "EdDSA", kid, typ })));
|
|
2982
|
-
const payload = toBase64Url(utf8Encode(canonicalJson(claims)));
|
|
2983
|
-
const signature = ed25519Sign(utf8Encode(`${header}.${payload}`), secret);
|
|
2984
|
-
return `${header}.${payload}.${toBase64Url(signature)}`;
|
|
2985
|
-
}
|
|
2986
|
-
|
|
2987
|
-
const decodeJson = (part ) => {
|
|
2988
|
-
const bytes = fromBase64Url(part);
|
|
2989
|
-
const text = bytes === null ? null : utf8Decode(bytes);
|
|
2990
|
-
return text === null ? undefined : parseJson(text);
|
|
2991
|
-
};
|
|
2992
|
-
|
|
2993
|
-
export function verifyToken(token , typ , keys ) {
|
|
2994
|
-
if (token.length > MAX_TOKEN_CHARS) return refuse("shape", "token: too long");
|
|
2995
|
-
const parts = token.split(".");
|
|
2996
|
-
if (parts.length !== 3) return refuse("shape", "token: not three parts");
|
|
2997
|
-
const [h, p, s] = parts ;
|
|
2998
|
-
const header = decodeJson(h);
|
|
2999
|
-
if (typeof header !== "object" || header === null || Array.isArray(header)) return refuse("shape", "token: header");
|
|
3000
|
-
const hd = header ;
|
|
3001
|
-
if (Object.keys(hd).sort().join(",") !== "alg,kid,typ") return refuse("shape", "token: header fields");
|
|
3002
|
-
if (hd.alg !== "EdDSA") return refuse("shape", "token: alg");
|
|
3003
|
-
if (hd.typ !== typ) return refuse("shape", "token: typ");
|
|
3004
|
-
if (typeof hd.kid !== "string" || !Object.hasOwn(keys, hd.kid)) return refuse("unknown_key", "token: kid");
|
|
3005
|
-
const key = keys[hd.kid] ;
|
|
3006
|
-
const signature = fromBase64Url(s);
|
|
3007
|
-
if (key.length !== KEY_BYTES || signature === null) return refuse("signature", "token: signature encoding");
|
|
3008
|
-
if (!ed25519Verify(signature, utf8Encode(`${h}.${p}`), key)) return refuse("signature", "token: signature");
|
|
3009
|
-
const claims = decodeJson(p);
|
|
3010
|
-
if (typeof claims !== "object" || claims === null || Array.isArray(claims)) return refuse("shape", "token: payload");
|
|
3011
|
-
// The signed bytes must BE the canonical encoding, so one claim set has exactly one valid token form.
|
|
3012
|
-
if (toBase64Url(utf8Encode(canonicalJson(claims))) !== p) return refuse("shape", "token: payload not canonical");
|
|
3013
|
-
if (toBase64Url(utf8Encode(canonicalJson(hd))) !== h) return refuse("shape", "token: header not canonical");
|
|
3014
|
-
return accept({ kid: hd.kid, claims: claims });
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
|
-
/** iat/exp checks shared by every token kind; seconds, with the protocol's skew. */
|
|
3018
|
-
export function checkTimes(iat , exp , nowMs , maxLifetimeS , skewMs ) {
|
|
3019
|
-
if (exp <= iat) return refuse("lifetime", "token: exp not after iat");
|
|
3020
|
-
if (exp - iat > maxLifetimeS) return refuse("lifetime", "token: lives too long");
|
|
3021
|
-
if (iat * 1000 > nowMs + skewMs) return refuse("not_yet_valid", "token: issued in the future");
|
|
3022
|
-
if (exp * 1000 + skewMs < nowMs) return refuse("expired", "token: expired");
|
|
3023
|
-
return accept(true);
|
|
3024
|
-
}
|
|
3025
|
-
|
|
3026
|
-
// ---- packages/remote-protocol/src/crypto/binding.ts
|
|
3027
|
-
/**
|
|
3028
|
-
* A REMOTE KEY BINDING: the Passport app's signed word that these public keys belong to this device of this account.
|
|
3029
|
-
* The person approves the device in app.worktrust.io, signed in with a second factor; the app signs
|
|
3030
|
-
* { iss, aud, sub, device_id, kind, ed25519_pub, x25519_pub, iat, exp, jti }
|
|
3031
|
-
* with a WorkTrust issuer key. `sub` is an opaque account reference for the remote system (an HMAC of the owner id
|
|
3032
|
-
* under a Passport secret, prefixed usr_), never the Passport owner id, so the relay's records join to nothing else.
|
|
3033
|
-
*
|
|
3034
|
-
* Endpoints verify bindings against the issuer's public keys PINNED in the app and CLI builds, never against a key the
|
|
3035
|
-
* relay hands them. The relay cannot forge a binding. The issuer alone cannot add a controller either: a new phone is
|
|
3036
|
-
* pending on the computer until the person confirms its fingerprint at the computer's keyboard (handshake.ts).
|
|
3037
|
-
*/
|
|
3038
|
-
|
|
3039
|
-
export const DEVICE_KINDS = ["phone", "computer"] ;
|
|
3040
|
-
|
|
3041
|
-
export const BINDING_CLAIMS_SPEC = object({
|
|
3042
|
-
iss: oneOf([PASSPORT_ISSUER]),
|
|
3043
|
-
aud: oneOf([GATEWAY_AUDIENCE]),
|
|
3044
|
-
sub: id("usr"),
|
|
3045
|
-
device_id: id("dev"),
|
|
3046
|
-
kind: oneOf(DEVICE_KINDS),
|
|
3047
|
-
ed25519_pub: b64({ exact: 32 }),
|
|
3048
|
-
x25519_pub: b64({ exact: 32 }),
|
|
3049
|
-
iat: int(0),
|
|
3050
|
-
exp: int(0),
|
|
3051
|
-
jti: id("jti"),
|
|
3052
|
-
});
|
|
3053
|
-
|
|
3054
|
-
/** For the Passport app: validate, then sign. */
|
|
3055
|
-
export function issueBinding(claims , issuerSecret , kid ) {
|
|
3056
|
-
const checked = validate(BINDING_CLAIMS_SPEC, claims, "$binding");
|
|
3057
|
-
if (!checked.ok) throw new TypeError(checked.detail);
|
|
3058
|
-
if (claims.exp - claims.iat > MAX_BINDING_LIFETIME_S || claims.exp <= claims.iat) throw new RangeError("binding lifetime");
|
|
3059
|
-
return signToken("wt-remote-binding+jwt", kid, claims, issuerSecret);
|
|
3060
|
-
}
|
|
3061
|
-
|
|
3062
|
-
export function verifyBinding(token , expect ) {
|
|
3063
|
-
const verified = verifyToken(token, "wt-remote-binding+jwt", expect.issuerKeys);
|
|
3064
|
-
if (!verified.ok) return refuse(verified.code === "shape" ? "binding" : verified.code, verified.detail);
|
|
3065
|
-
const shaped = validate(BINDING_CLAIMS_SPEC, verified.value.claims, "$binding");
|
|
3066
|
-
if (!shaped.ok) return refuse("binding", shaped.detail);
|
|
3067
|
-
const b = shaped.value;
|
|
3068
|
-
const times = checkTimes(b.iat, b.exp, expect.now, MAX_BINDING_LIFETIME_S, CLOCK_SKEW_MS);
|
|
3069
|
-
if (!times.ok) return times;
|
|
3070
|
-
if (expect.kind !== undefined && b.kind !== expect.kind) return refuse("binding", "$binding.kind: not the expected kind");
|
|
3071
|
-
if (expect.deviceId !== undefined && b.device_id !== expect.deviceId) return refuse("wrong_device", "$binding.device_id");
|
|
3072
|
-
if (expect.sub !== undefined && b.sub !== expect.sub) return refuse("account_mismatch", "$binding.sub");
|
|
3073
|
-
if (expect.isRevoked?.(b)) return refuse("revoked", "$binding: revoked");
|
|
3074
|
-
return accept(b);
|
|
3075
|
-
}
|
|
3076
|
-
|
|
3077
|
-
/** The signing key a verified binding names, as bytes. */
|
|
3078
|
-
export const bindingSigningKey = (b ) => fromBase64Url(b.ed25519_pub) ;
|
|
3079
|
-
export const bindingAgreementKey = (b ) => fromBase64Url(b.x25519_pub) ;
|
|
3080
|
-
export const bindingFingerprint = (b ) =>
|
|
3081
|
-
deviceFingerprint({ ed25519_pub: b.ed25519_pub, x25519_pub: b.x25519_pub });
|
|
3082
|
-
|
|
3083
3158
|
// ---- packages/remote-protocol/src/crypto/assertion.ts
|
|
3084
3159
|
/**
|
|
3085
3160
|
* THE GATEWAY'S ADMISSION TICKET. The gateway holds no Passport credential and reads no Passport database: it trusts
|
package/remote-run.mjs
CHANGED
|
@@ -36,6 +36,9 @@ import { connectGateway, webSocketAvailable } from "./remote-transport.mjs";
|
|
|
36
36
|
|
|
37
37
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
38
38
|
const log = (kind, fields = {}) => process.stderr.write(`${JSON.stringify({ at: new Date().toISOString(), kind, ...fields })}\n`);
|
|
39
|
+
// A browser a phone added (2026-11-09, remote-endorse.mjs) is said in words too, so it is never news only in a JSON line.
|
|
40
|
+
const notice = (kind, fields) => { if (kind === "browser_endorsed") process.stderr.write(` ! A browser was added by your phone ${fields.by}: ${fields.fingerprint}. See or remove it: npx worktrust remote phones\n`); };
|
|
41
|
+
const logged = (kind, fields = {}) => { log(kind, fields); notice(kind, fields); };
|
|
39
42
|
|
|
40
43
|
export function agentEnv(settings, base = process.env) {
|
|
41
44
|
const env = {};
|
|
@@ -124,7 +127,7 @@ export async function runDaemon({ say = (l) => process.stdout.write(`${l}\n`) }
|
|
|
124
127
|
// The live preview (release 19): the session's granted page, live, over the browser's pipe; one per computer.
|
|
125
128
|
const live = createLivePreview({ emit: (...a) => core.emit(...a), grants: loadPreviewGrants, env: () => agentEnv(loadSettings()), log, now: Date.now,
|
|
126
129
|
sessionProject: (id) => { const s = journal.session(id); return s ? loadProjects().find((p) => p.project_id === s.project_id) ?? null : null; } });
|
|
127
|
-
const core = createDaemonCore({ local, issuerKeys: keysOf, journal, projectSecret: keys.projectSecret, attachments, preview, live, now: Date.now, random, log, send: (f) => transport?.send(f) ?? false, inventory: (refresh) => inventory({ env: agentEnv(loadSettings()), refresh }), online: () => transport?.ready() ?? false, approvals: null });
|
|
130
|
+
const core = createDaemonCore({ local, issuerKeys: keysOf, journal, projectSecret: keys.projectSecret, attachments, preview, live, now: Date.now, random, log: logged, send: (f) => transport?.send(f) ?? false, inventory: (refresh) => inventory({ env: agentEnv(loadSettings()), refresh }), online: () => transport?.ready() ?? false, approvals: null });
|
|
128
131
|
const ctx = { journal, now: Date.now, random, deviceId: identity.device_id, emit: core.emit, paused: () => loadSettings().paused !== null || !loadSettings().enabled, phoneOnline: core.phoneOnline, controllers: core.controllers };
|
|
129
132
|
const approvals = createApprovals(ctx);
|
|
130
133
|
const socket = await approvals.listen(runDir);
|
package/remote-store.mjs
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* remote-keys.json the remote device keys and the secret that derives project ids (never leaves the computer)
|
|
10
10
|
* identity.json this computer's device id and the issuer's binding of its keys
|
|
11
11
|
* settings.json on or off, paused (and by whom), the gateway address, default agent and model, PATH for agents
|
|
12
|
-
* phones.json phones pending a keyboard confirmation, and the confirmed ones with their fingerprints
|
|
12
|
+
* phones.json phones pending a keyboard confirmation, and the confirmed ones with their fingerprints (and, for a
|
|
13
|
+
* browser a phone added, which phone and when)
|
|
14
|
+
* endorsements.json the one-time nonces of browser endorsements already taken, kept a little past their expiry
|
|
13
15
|
* projects.json the folders a phone may steer an agent in, canonical paths
|
|
14
16
|
* channels.json the open end-to-end channels (their keys are secrets)
|
|
15
17
|
* journal.jsonl the command journal (remote-journal.mjs); steered.jsonl the steered ledger (remote-steered.mjs)
|
|
@@ -65,12 +67,16 @@ export function loadKeys() {
|
|
|
65
67
|
export const loadIdentity = () => readJson("identity.json");
|
|
66
68
|
export const saveIdentity = (identity) => writeJson("identity.json", identity);
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
// allow_endorse (2026-11-09): may a confirmed phone add a browser it scanned (remote-endorse.mjs)? Off until the person says so
|
|
71
|
+
// here, at the keyboard (`worktrust remote phones allow-endorse on`).
|
|
72
|
+
export const DEFAULT_SETTINGS = Object.freeze({ v: 1, enabled: false, paused: null, gateway: null, default_adapter: "claude-code", default_model: null, agent_path: null, codex: false, terminal: false, allow_endorse: false });
|
|
69
73
|
export const loadSettings = () => ({ ...DEFAULT_SETTINGS, ...(readJson("settings.json") ?? {}) });
|
|
70
74
|
export const saveSettings = (settings) => writeJson("settings.json", { ...DEFAULT_SETTINGS, ...settings });
|
|
71
75
|
|
|
72
76
|
export const loadPhones = () => ({ pending: [], confirmed: [], removed: [], ...(readJson("phones.json") ?? {}) });
|
|
73
77
|
export const savePhones = (phones) => writeJson("phones.json", phones);
|
|
78
|
+
export const loadEndorsements = () => readJson("endorsements.json", { spent: [] }) ?? { spent: [] };
|
|
79
|
+
export const saveEndorsements = (value) => writeJson("endorsements.json", value);
|
|
74
80
|
export const confirmedFingerprints = (phones = loadPhones()) => new Set(phones.confirmed.map((p) => p.fingerprint));
|
|
75
81
|
/** The signing keys of the confirmed phones, by device id: the only keys whose approval decisions count. */
|
|
76
82
|
export const controllerKeys = (phones = loadPhones()) => Object.fromEntries(phones.confirmed.map((p) => [p.device_id, P.fromBase64Url(p.ed25519_pub)]));
|
package/worktrust.mjs
CHANGED
|
@@ -78,7 +78,7 @@ const command = args.includes("--help") ? "help" : args.includes("--version") ?
|
|
|
78
78
|
const flag = (name) => { const at = args.indexOf(`--${name}`); return at >= 0 ? args[at + 1] : undefined; };
|
|
79
79
|
const has = (name) => args.includes(`--${name}`);
|
|
80
80
|
/** This CLI's version, said to the door so the app can tell which computer runs an old one (check-cli-package holds it equal to package.json). */
|
|
81
|
-
const CLI_VERSION = "0.11.
|
|
81
|
+
const CLI_VERSION = "0.11.2";
|
|
82
82
|
/**
|
|
83
83
|
* HOW THIS CLI MEASURES, AS A NUMBER OF ITS OWN (0.10.31; owner, 2026-10-28: 0.10.30 offered a re-measure it had no reason
|
|
84
84
|
* to offer). Raised ONLY when what is measured changes: the timeline, the seconds, the tokens, the steering, the session
|
|
@@ -110,7 +110,7 @@ const ORIGIN = (flag("origin") ?? process.env.WORKTRUST_ORIGIN ?? "https://app.w
|
|
|
110
110
|
const MCP = flag("url") ?? process.env.WORKTRUST_MCP_URL ?? `${ORIGIN}/api/mcp`;
|
|
111
111
|
const HOME_DIR = join(homedir(), ".worktrust");
|
|
112
112
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
113
|
-
const SCRIPTS = ["credential-store.mjs", "remote-protocol.mjs", "remote-store.mjs", "remote-policy.mjs", "remote-journal.mjs", "remote-steered.mjs", "remote-inventory.mjs", "remote-claude-events.mjs", "remote-claude-progress.mjs", "remote-attachments.mjs", "remote-preview.mjs", "remote-coalesce.mjs", "remote-steering.mjs", "remote-codex-events.mjs", "remote-adapter-codex.mjs", "remote-adapter-terminal.mjs", "remote-terminal-sessions.mjs", "remote-terminal-cli.mjs", "remote-screen-states.mjs", "remote-screen-approvals.mjs", "remote-screen-push.mjs", "remote-cdp.mjs", "remote-live-preview.mjs", "remote-projects.mjs", "remote-pipeline-config.mjs", "remote-pipeline-parsers.mjs", "remote-pipeline.mjs", "remote-releases.mjs", "remote-release-plans.mjs", "remote-adapter-claude-code.mjs", "remote-approval-bridge.mjs", "remote-approvals.mjs", "remote-sessions.mjs", "remote-session-list.mjs", "remote-changes.mjs", "remote-daemon.mjs", "remote-transport.mjs", "remote-run.mjs", "remote-service.mjs", "remote-pairing.mjs", "remote-qr.mjs", "remote-cli.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "commit-rules.mjs", "git-commits.mjs", "self-update.mjs", "history-progress.mjs"];
|
|
113
|
+
const SCRIPTS = ["credential-store.mjs", "remote-protocol.mjs", "remote-store.mjs", "remote-policy.mjs", "remote-journal.mjs", "remote-steered.mjs", "remote-inventory.mjs", "remote-claude-events.mjs", "remote-claude-progress.mjs", "remote-attachments.mjs", "remote-preview.mjs", "remote-coalesce.mjs", "remote-steering.mjs", "remote-codex-events.mjs", "remote-adapter-codex.mjs", "remote-adapter-terminal.mjs", "remote-terminal-sessions.mjs", "remote-terminal-cli.mjs", "remote-screen-states.mjs", "remote-screen-approvals.mjs", "remote-screen-push.mjs", "remote-cdp.mjs", "remote-live-preview.mjs", "remote-projects.mjs", "remote-pipeline-config.mjs", "remote-pipeline-parsers.mjs", "remote-pipeline.mjs", "remote-releases.mjs", "remote-release-plans.mjs", "remote-adapter-claude-code.mjs", "remote-approval-bridge.mjs", "remote-approvals.mjs", "remote-sessions.mjs", "remote-session-list.mjs", "remote-changes.mjs", "remote-endorse.mjs", "remote-daemon.mjs", "remote-transport.mjs", "remote-run.mjs", "remote-service.mjs", "remote-pairing.mjs", "remote-qr.mjs", "remote-cli.mjs", "credential-vault.mjs", "credential-vault-scripts.mjs", "history-outbox.mjs", "setup-mcp.mjs", "log-session.mjs", "count-behaviour.mjs", "transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "claude-mod.mjs", "package-integrity.mjs", "worktrust-launch.mjs", "commit-rules.mjs", "git-commits.mjs", "self-update.mjs", "history-progress.mjs"];
|
|
114
114
|
/** The modules the scripts import by name from beside them; a download keeps that name. */
|
|
115
115
|
const IMPORTED = new Set(["transcript-readers.mjs", "session-databases.mjs", "config-edits.mjs", "stretch-evidence.mjs", "chat-exports.mjs", "export-facts.mjs", "stack-rules.mjs", "runtime-install.mjs", "orchestration-contract.mjs", "orchestration-evidence.mjs", "orchestration-report.mjs", "commit-rules.mjs", "git-commits.mjs"]);
|
|
116
116
|
const downloaded = (name) => (IMPORTED.has(name) ? name : `${name}.download.mjs`);
|