feat(sdk): [NET-1663] Signature validation in worker thread#3308
Open
feat(sdk): [NET-1663] Signature validation in worker thread#3308
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| await client.resend(streamId, resendOpts, handler) | ||
| const messageStream = await client.resend(streamId, resendOpts) | ||
| for await (const message of messageStream) { | ||
| console.info(JSON.stringify(message.content)) |
There was a problem hiding this comment.
Inconsistent CLI output between subscribe and resend modes
Medium Severity
Subscribe mode logs the full Message object via JSON.stringify(message) (line 24), but resend mode now logs only message.content via JSON.stringify(message.content). This creates inconsistent output where subscribe mode shows all message metadata (streamId, timestamp, publisherId, etc.) while resend mode shows only the payload content.
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.
Summary
Run validation of messages in a worker thread in the browser
Note
Medium Risk
Changes the core signature verification path to cross-thread worker execution and adds new build/test plumbing for worker bundles, which can introduce subtle runtime/env issues if bundling or serialization breaks.
Overview
Moves SDK signature verification for non-
ERC_1271messages into a Comlink-backed worker (SignatureValidation+SignatureValidationWorker), extracting the crypto checks into serializable, pure helpers (signatureValidationUtils) and addingMessageIdLike/MessageRefLikepayload types to support worker transfer.Adds platform-specific worker factories (
src/_browser,src/_nodejs,src/_jest,src/_karma) and Rollup build outputs for worker bundles underdist/workers, updates Karma to serve worker assets, and includes workers in the published@streamr/sdkpackage. CLI behavior is adjusted toprocess.exit(0)after successful commands (to avoid worker threads keeping the event loop alive), andresendswitches the non-subscribe path to async-iterate theclient.resend()stream.Tests are updated for the new
SignatureValidatorconstructor (now requiresDestroySignal) and an integration test timeout is increased to reduce flakiness.Written by Cursor Bugbot for commit 738a126. This will update automatically on new commits. Configure here.