-
Notifications
You must be signed in to change notification settings - Fork 43
feat(sdk): [NET-1663] Signature validation in worker thread #3308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juslesan, thoughts on this?
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.