Skip to content

Commit

Permalink
fix: WindowMessageTransport accepts same origin messages (#273)
Browse files Browse the repository at this point in the history
In order to support browserViews in electron
  • Loading branch information
Justkant authored Dec 6, 2023
1 parent e6da3b3 commit 0eda7fa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 7 additions & 0 deletions .changeset/tidy-berries-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@ledgerhq/wallet-api-core": patch
---

fix: WindowMessageTransport accepts same origin messages

In order to support browserViews in electron
6 changes: 1 addition & 5 deletions packages/core/src/transports/WindowMessageTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,7 @@ export default class WindowMessageTransport implements Transport {
_onMessageEvent = (event: MessageEvent): void => {
if (this._onMessage) {
this.logger.debug("received message event", event);
if (
event.origin !== this.target.location.origin &&
event.data &&
typeof event.data === "string"
) {
if (event.data && typeof event.data === "string") {
try {
const message = event.data;

Expand Down

2 comments on commit 0eda7fa

@vercel
Copy link

@vercel vercel bot commented on 0eda7fa Dec 6, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

wallet-api – ./apps/docs

wallet-api-ledgerhq.vercel.app
wallet-api-git-main-ledgerhq.vercel.app
wallet.api.live.ledger.com

@vercel
Copy link

@vercel vercel bot commented on 0eda7fa Dec 6, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

wallet-api-wallet-api-tools – ./apps/wallet-api-tools

wallet-api-wallet-api-tools-git-main-ledgerhq.vercel.app
wallet-api-wallet-api-tools.vercel.app
wallet-api-wallet-api-tools-ledgerhq.vercel.app

Please sign in to comment.