You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
LedgerBridgeKeyring can accidentally be initialised twice on the same client, resulting in silent failures (e.g. messages be either duplicated or resolved prematurely/incorrectly).
Now that set-up logic is being moved to a separate init function, there's a possibility that the same instance is init'ed twice, and thus requires appropriate handling and fail-safes
setupIframe to throw an error if it detects a duplicate iframe
this.currentMessageId to be removed and replaced with nanoid
Ensures that two different clients sending messages to the same bridge URL will always have a unique (instead of being 0-indexed and incrementing)
Reduces code complexity
Prevent this.bridgeUrl from being null before the iframe is created, or at least update the iframe if the keyring is deserialized with a new bridgeUrl
Issues:
LedgerBridgeKeyring
can accidentally be initialised twice on the same client, resulting in silent failures (e.g. messages be either duplicated or resolved prematurely/incorrectly).init
function, there's a possibility that the same instance isinit
'ed twice, and thus requires appropriate handling and fail-safessetupIframe
to throw an error if it detects a duplicateiframe
this.currentMessageId
to be removed and replaced withnanoid
this.bridgeUrl
from being null before the iframe is created, or at least update the iframe if the keyring is deserialized with a newbridgeUrl
this._eventListener
will be mutated if the keyring is init'ed twice, which would interfere with:window.removeEventListener('message', this._eventListener)
this._eventListener
completely, and replace it with something like this:The text was updated successfully, but these errors were encountered: