shogun-core 4.2.4 → 4.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -132720,6 +132720,17 @@ class ShogunCore {
132720
132720
  }
132721
132721
  });
132722
132722
  }
132723
+ /**
132724
+ * Manually initialize the Shogun SDK (for testing or delayed initialization)
132725
+ * @returns Promise that resolves when initialization is complete
132726
+ */
132727
+ async initialize() {
132728
+ // If already initialized, just wait a bit for any pending initialization
132729
+ if (this._gun) {
132730
+ return Promise.resolve();
132731
+ }
132732
+ return this.coreInitializer.initialize(this.config);
132733
+ }
132723
132734
  /**
132724
132735
  * Access to the Gun instance
132725
132736
  * @returns The Gun instance
@@ -134710,7 +134721,15 @@ class DataBase {
134710
134721
  }
134711
134722
  console.log(`[POSTAUTH] Normalized username: ${normalizedUsername}`);
134712
134723
  console.log(`[POSTAUTH] Checking if user exists: ${userPub}`);
134713
- const existingUser = await this.gun.get(userPub).then();
134724
+ // Add timeout to prevent hanging
134725
+ const existingUser = await Promise.race([
134726
+ this.gun.get(userPub).then(),
134727
+ new Promise((_, reject) => setTimeout(() => reject(new Error("Timeout checking user existence")), 5000)),
134728
+ ]).catch((error) => {
134729
+ console.error(`[POSTAUTH] Error or timeout checking user existence:`, error);
134730
+ return null;
134731
+ });
134732
+ console.log(`[POSTAUTH] User existence check completed, existingUser:`, existingUser);
134714
134733
  const isNewUser = !existingUser || !existingUser.alias;
134715
134734
  console.log(`[POSTAUTH] User is ${isNewUser ? "NEW" : "EXISTING"}: ${userPub}`);
134716
134735
  // Get user's encryption public key (epub) for comprehensive tracking