Repository navigation
Conversation
…y authority checks
This branch has not been deployed
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.
Adds an Iroh P2P listener and client carrier alongside WebSockets in
codework serve, extendsDoorwith read-onlyactoradmission and shared socket transport, and wires Relay-backed access verification with periodic refresh and fail-closed teardown.Stacked on #195 (
feat/iroh-p2p-slice-1).@codeworksh/schema@codeworksh/schema/irohwithALPN = "codeworkrpc/1", frame caps (16 KiBfirst frame,4 MiBdata frames), andHello/Replywire schemas.Principalwith theactorvariant and includedForbiddenin theDoormiddleware error union.device.pairresponse withendpointIdandirohRelayUrl.packages/codeworksrc/server/iroh.ts,src/server/iroh-binding.ts): Lazily loads optional@number0/[email protected]and binds the machine identity key onALPN = "codeworkrpc/1"(degrading cleanly to WebSocket-only serving if unavailable). Implements 4-byte BE length-prefixed framing, handshake limits (10s deadline, 32 concurrent, max 2 per peer, 16 KiB first frame), three admissions (pair,device,actor), and client carrier helpers (bindClient,pair,connect,rpcLayer).src/server/door.ts,src/server/principal.ts): SharedRpcServer.Protocol+Door.Transportserving both WebSocket upgrades and Iroh streams, stripping client-suppliedx-codework-connectionheaders, tracking actor connections (endAllActors), and restrictingactorcallers to read-only RPCs (server.info,index.sync,thread.sync,thread.page).src/server/authority.ts): Verifies incomingactorconnections against Relay's/v1/machines/check, refuses reserved root id/scope and unenrolled/leaving machines locally without contacting Relay, caches denials for 10s, refreshes standing answers every 15s, fails closed at 30s if Relay is unreachable, and clears local Relay registration plus closes all actor connections immediately onRelay.MachineRevoked.src/server/pairing.ts,src/server/handlers.ts,src/machine/,src/cli/cmd/handlers/service/pair.ts): AddedPairing.Service.admit(deviceId, key)for Iroh device connections, wiredIroh.Servicehome relay URL into machine heartbeats, ended actor connections onmachine.disconnect, and updatedcodework service pairto printendpoint id(andiroh relaywhen configured).Testing
packages/codework/test/iroh.test.tswith__artifacts__/iroh.json— passed (1/1): covers Irohpair/device/actorhandshakes,device.revoketeardown, unenrolled/leaving & reserved-root local refusals, negative caching, read-only allowlist & header spoof blocking, live denial refresh, fail-closed on Relay outage while paired devices stay up,MachineRevokedclearing local Relay config, oversized frame rejection, and WebSocket-only fallback.packages/codework:vp test test/door.test.ts(1/1 passed),vp test test/pair.test.ts(6/6 passed, updatedpair.jsonforendpoint id).apps/server:vp test test/door.test.ts test/link.test.ts test/paired.test.ts test/schema.test.ts(8/8 passed).vp run verify(build,vp check, package typechecks, knip) — passed.vp check apps/contract apps/server apps/weband app typechecks — passed..scratch/homeand verifiedvp run dev:cli service pairprintsendpoint id:.Built with Antigravity (Gemini).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.