-
Notifications
You must be signed in to change notification settings - Fork 701
Open
Labels
type: enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem?
The issue in the provided code lies in the request method, specifically in the wallet_sendCalls case. After the ephemeralSigner.cleanup() method is called, the ephemeralSigner is cleaned up, but the method still attempts to return the result of the ephemeralSigner.request(args) call. This could lead to unexpected behavior if the cleanup invalidates the ephemeralSigner state.
Suggested Fix:
Store the result of ephemeralSigner.request(args) in a variable before calling ephemeralSigner.cleanup(). Then, return the stored result.
Updated Code:
case 'wallet_sendCalls': {
const ephemeralSigner = this.initSigner('scw');
await ephemeralSigner.handshake({ method: 'handshake' }); // exchange session keys
const result = await ephemeralSigner.request(args); // send diffie-hellman encrypted request
await ephemeralSigner.cleanup(); // clean up (rotate) the ephemeral session keys
return result as T; // return the stored result
}Explanation:
- The
resultis stored in a variable before callingephemeralSigner.cleanup(). - This ensures that the cleanup process does not interfere with the returned value.
Metadata
Metadata
Assignees
Labels
type: enhancementNew feature or requestNew feature or request