Skip to content

Commit

Permalink
fix: prevent multiple iframes creation (#365)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohammed-Mamoun98 authored Dec 2, 2024
1 parent 507125c commit 069b245
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ export class IframeEnclave implements EnclaveProvider {
}

async #loadEnclave() {
const hasIframe = document.getElementById(this.iframe.id);
if (hasIframe) {
console.warn("An Iframe already exists in the container");
return Promise.resolve();
}

// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Permissions-Policy#directives
const permissionsPolicies = ["publickey-credentials-get", "storage-access"];

Expand Down
2 changes: 1 addition & 1 deletion packages/idos-sdk-js/src/lib/idos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ interface InitParams {

export class idOS {
static initializing = false;

static near = Grants.near;
static evm = Grants.evm;
static kwil = KwilWrapper.defaults;
Expand Down Expand Up @@ -109,6 +108,7 @@ export class idOS {

async reset({ enclave = false } = {}): Promise<void> {
this.store.reset();
idOS.initializing = false;
if (enclave) await this.enclave.reset();
}

Expand Down

0 comments on commit 069b245

Please sign in to comment.