From 7a386f6e1d2814dd7bc36c1a34db4cb06c5340a5 Mon Sep 17 00:00:00 2001 From: frankie Date: Tue, 5 Dec 2023 13:46:28 -0800 Subject: [PATCH 1/2] i#258 ready return true --- src/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 0be9cb4f..288205db 100644 --- a/src/index.ts +++ b/src/index.ts @@ -56,7 +56,7 @@ export default class Entropy { #programReadOnly: boolean #allReadOnly: boolean /** A promise that resolves once chacha20poly1305 cryptoLib has been loaded */ - ready: Promise + ready: Promise public sigRequestPublicKey?: string public programModPublicKey?: string registrationManager: RegistrationManager @@ -103,7 +103,7 @@ export default class Entropy { signer: programModKeyPair as Signer || this.account.sigRequestKey, }) if (this.#programReadOnly || this.#allReadOnly) this.programs.set = async () => { throw new Error('Programs is in a read only state: Must pass a valid key pair in initialization.') } - this.#ready() + this.#ready(true) this.isRegistered = this.registrationManager.checkRegistrationStatus.bind( this.registrationManager ) From b02525369f4a8ad9b5f5d5952be894fb0c23cf0d Mon Sep 17 00:00:00 2001 From: frankie Date: Tue, 5 Dec 2023 14:11:17 -0800 Subject: [PATCH 2/2] try to address #236 with globalThis --- src/utils/crypto.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/crypto.ts b/src/utils/crypto.ts index 05c01b63..15d30674 100644 --- a/src/utils/crypto.ts +++ b/src/utils/crypto.ts @@ -98,7 +98,7 @@ async function verifySignature (message: string, signature: string, address: str export async function loadCryptoLib () { if (isImported) return cryptoLib - if (typeof window === 'undefined') { + if (!globalThis.window) { cryptoLib = await import('@entropyxyz/x25519-chacha20poly1305-nodejs') } else { cryptoLib = await import('@entropyxyz/x25519-chacha20poly1305-web')