Skip to content

Conversation

@ganchoradkov
Copy link
Member

@ganchoradkov ganchoradkov commented Mar 4, 2025

Description

Updated Universal-provider to accept a session as init parameter and implemented checks to ignore events from Sign Client that belong to other sessions. This update allows UP cater only for its session and be isolated from other sessions in a shared Sign Client as well as to be orchestrated along other UP instances without conflicting each other.
Example implementation to orchestrate multiple UP instances with different sessions

Type of change

  • Chore (non-breaking change that addresses non-functional tasks, maintenance, or code quality improvements)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Draft PR (breaking/non-breaking change which needs more work for having a proper functionality [Mark this PR as ready to review only when completely ready])
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How has this been tested?

canary - 2.19.0-canary-mw-2
TODO: add automated tests

Checklist

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Additional Information (Optional)

Please include any additional information that may be useful for the reviewer.

…ultiple UP instances to be ran at the same time with different sessions
@arein arein added the accepted label Mar 4, 2025
@ganchoradkov ganchoradkov changed the title feat: isolate UP to its session feat: isolate UP to a particular session Mar 4, 2025
@ganchoradkov ganchoradkov marked this pull request as ready for review March 10, 2025 15:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds session isolation to the Universal Provider by ensuring that provider operations and events only pertain to the designated session. Key changes include making persistence methods asynchronous with session-specific keys, updating event listeners to ignore events from non-matching sessions, and adjusting tests to use unique storage names for each provider instance.

Reviewed Changes

File Description
providers/universal-provider/src/UniversalProvider.ts Updated persistence methods to use async/await with session-specific storage keys; refined event listener checks and cleanup logic
providers/universal-provider/src/types/misc.ts Added the session parameter to the UniversalProvider options
providers/universal-provider/test/index.spec.ts Modified test storage database naming and session handling for improved isolation and persistence

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

providers/universal-provider/src/UniversalProvider.ts:551

  • Appending an empty string when the session is undefined may lead to key collisions in storage. Consider explicitly handling the case when session is not initialized (for example, by throwing an error or using a separate default storage key).
const topic = this.session?.topic || "";

@ganchoradkov ganchoradkov merged commit 7707c82 into v2.0 Mar 11, 2025
10 checks passed
@ganchoradkov ganchoradkov deleted the feat/multi-session-provider branch March 11, 2025 07:36
@ganchoradkov ganchoradkov mentioned this pull request Mar 12, 2025
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants