Skip to content

Commit

Permalink
Merge pull request #19 from openfort-xyz/fix/logout-dispose
Browse files Browse the repository at this point in the history
Fix/logout dispose
  • Loading branch information
gllm-dev authored Mar 15, 2024
2 parents 7ac7834 + 6aea688 commit 5957939
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openfort/openfort-js",
"version": "0.5.16",
"version": "0.5.17",
"description": "",
"author": "Openfort",
"repository": {
Expand Down
31 changes: 13 additions & 18 deletions src/clients/iframe-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export class IframeClient {
throw new Error("must be run in a browser");
}

const actualIframeURL = document.getElementById("openfort-iframe");
const actualIframeURL = document.getElementById("openfort-iframe") as HTMLIFrameElement;
if (actualIframeURL) {
actualIframeURL.setAttribute("src", "https://iframe.openfort.xyz/iframe?accessToken=" + accessToken + "&publishableKey=" + publishableKey);
this._iframe = actualIframeURL as HTMLIFrameElement;
actualIframeURL.src = "https://iframe.openfort.xyz/iframe?accessToken=" + accessToken + "&publishableKey=" + publishableKey;
this._iframe = actualIframeURL;
return;
}

Expand All @@ -21,13 +21,6 @@ export class IframeClient {
document.body.appendChild(this._iframe);
}

public dispose(): void {
const iframe = document.getElementById("openfort-iframe");
if (iframe) {
iframe.remove();
}
}

public isLoaded(): boolean {
return this._iframe.contentWindow !== null;
}
Expand Down Expand Up @@ -57,14 +50,16 @@ export class IframeClient {

window.addEventListener("message", handleMessage);

this._iframe.contentWindow?.postMessage(
{
action: "generateKey",
password: password,
chainId: chainId,
},
"*",
);
setTimeout(() => {
this._iframe.contentWindow?.postMessage(
{
action: "generateKey",
password: password,
chainId: chainId,
},
"*",
);
}, 1000);
});
}

Expand Down
1 change: 0 additions & 1 deletion src/signer/embedded.signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class EmbeddedSigner implements ISigner {
async logout(): Promise<void> {
await this._iframeClient.logout();
this._instanceManager.removeDeviceID();
this._iframeClient.dispose();
}
useCredentials(): boolean {
return true;
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const VERSION = "0.5.16";
export const VERSION = "0.5.17";
export const PACKAGE = "@openfort/openfort-js";

0 comments on commit 5957939

Please sign in to comment.