Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent multiple iframes creation #365

Merged
merged 8 commits into from
Dec 2, 2024
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
Loading