Skip to content

Wallet timing: custom relay implementation has no session expiry on envelopes #499

Description

@therealjhay

ProblemWalletConnect v2 envelopes and the pairing topic carry no client-side expiry enforcement in walletconnect.ts. Stale pairing/session topics can be reused, and WCEncryptedEnvelope responses are accepted regardless of age.

  1. No expiresAt check on accepted session proposals/settles.
  2. Cached topics are not cleaned up on expiry, so memory and relay subscriptions leak over long sessions.
  3. There is no per-message timestamp/AAD binding in the AES-GCM layers, weakening replay resistance compared with the WC spec.

Solution

  • Store and enforce session/proposal expiry timestamps on both sides of the relay.
  • Purge expired topics on interval and on new pairings.
  • Follow the WC v2 envelope format (metadata, AAD) rather than a custom envelope shape.

Acceptance Criteria

  • Expired session proposals are rejected instead of accepted.
  • Relay subscriptions are cleaned up after session timeout.
  • No growth in walletStore session state after repeated connect/disconnect.
  • npm run build passes.

Note for Contributors: Write a clear PR description. Show a session that is accepted then rejected after expiry, and memory/heap stableness under repeated pairings.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions