@passkeyme/auth 1.1.6 → 1.1.8

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.
package/dist/index.esm.js CHANGED
@@ -25,7 +25,7 @@ class Logger {
25
25
  this.config.level = "debug";
26
26
  }
27
27
  /**
28
- * Get current logger configuration (for debugging)
28
+ * Get current logger configuration (for debugging).
29
29
  */
30
30
  getConfig() {
31
31
  return { ...this.config };
@@ -837,12 +837,12 @@ class PasskeymeAuth {
837
837
  // Configure logger with debug setting from config
838
838
  if (this.config.debug) {
839
839
  logger.enableDebug();
840
- console.log("[DEBUG] Logger debug mode enabled, testing logger...");
841
- console.log("[DEBUG] Logger config after enableDebug:", logger.getConfig());
840
+ logger.debug("[DEBUG] Logger debug mode enabled, testing logger...");
841
+ logger.debug("[DEBUG] Logger config after enableDebug:", logger.getConfig());
842
842
  logger.debug("Logger test message - if you see this, logger is working");
843
843
  }
844
844
  logger.debug("Initialized with config:", this.config);
845
- console.log("[DEBUG] Constructor completed, config.debug:", this.config.debug);
845
+ logger.debug("[DEBUG] Constructor completed, config.debug:", this.config.debug);
846
846
  }
847
847
  /**
848
848
  * Create default passkey SDK based on environment
@@ -1490,23 +1490,17 @@ class PasskeymeAuth {
1490
1490
  * 4. Fallback to hosted auth if all passkey attempts fail
1491
1491
  */
1492
1492
  async smartLogin(username, apiKey) {
1493
- console.log("[DEBUG] smartLogin called with:", {
1494
- username,
1495
- hasApiKey: !!apiKey,
1496
- });
1497
- logger.debug("smartLogin called with:", {
1493
+ logger.debug("[DEBUG] smartLogin called with:", {
1498
1494
  username,
1499
1495
  hasApiKey: !!apiKey,
1500
1496
  });
1501
1497
  // Use provided API key or fall back to config
1502
1498
  const effectiveApiKey = apiKey || this.getPasskeyApiKey();
1503
- console.log("[DEBUG] effectiveApiKey:", !!effectiveApiKey);
1499
+ logger.debug("[INFO] effectiveApiKey:", !!effectiveApiKey);
1504
1500
  // Check if passkeys are supported and we have an API key
1505
1501
  const isSupported = this.isPasskeySupported();
1506
- console.log("[DEBUG] Passkey support check:", isSupported);
1507
- logger.debug("Passkey support check:", isSupported);
1502
+ logger.debug("[DEBUG] Passkey support check:", isSupported);
1508
1503
  if (!isSupported || !effectiveApiKey) {
1509
- console.log("[DEBUG] Conditions not met, redirecting to hosted auth. isSupported:", isSupported, "hasApiKey:", !!effectiveApiKey);
1510
1504
  logger.debug("Conditions not met, redirecting to hosted auth. isSupported:", isSupported, "hasApiKey:", !!effectiveApiKey);
1511
1505
  this.redirectToLogin();
1512
1506
  return { method: "redirect" };
@@ -1516,13 +1510,13 @@ class PasskeymeAuth {
1516
1510
  let appConfig;
1517
1511
  try {
1518
1512
  appConfig = await this.getAppConfig();
1519
- console.log("App config loaded:", {
1513
+ logger.debug("App config loaded:", {
1520
1514
  discoverableCredentialsEnabled: appConfig.discoverableCredentialsEnabled,
1521
1515
  passkeyEnabled: appConfig.passkeyEnabled,
1522
1516
  });
1523
1517
  }
1524
1518
  catch (configError) {
1525
- console.log("[DEBUG] Failed to load app config, assuming passkeys enabled:", configError);
1519
+ logger.debug("[DEBUG] Failed to load app config, assuming passkeys enabled:", configError);
1526
1520
  // If we can't load config, assume passkeys are enabled and no discoverable credentials
1527
1521
  appConfig = {
1528
1522
  passkeyEnabled: true,
@@ -1531,7 +1525,7 @@ class PasskeymeAuth {
1531
1525
  }
1532
1526
  // If passkeys are disabled at the app level, fallback to hosted auth
1533
1527
  if (!appConfig.passkeyEnabled) {
1534
- console.log("Passkeys disabled for this app, falling back to hosted auth");
1528
+ logger.debug("Passkeys disabled for this app, falling back to hosted auth");
1535
1529
  this.redirectToLogin();
1536
1530
  return { method: "redirect" };
1537
1531
  }
@@ -1553,11 +1547,11 @@ class PasskeymeAuth {
1553
1547
  }
1554
1548
  // Try to get stored username for fallback
1555
1549
  const storageKey = `last_username_${this.config.appId}`;
1556
- console.log("Looking for stored username with key:", storageKey);
1550
+ logger.debug("Looking for stored username with key:", storageKey);
1557
1551
  const storedUsername = await this.storage.getItem(storageKey);
1558
- console.log("Found stored username:", storedUsername);
1552
+ logger.debug("Found stored username:", storedUsername);
1559
1553
  if (storedUsername) {
1560
- console.log("Using stored username for targeted authentication:", storedUsername);
1554
+ logger.debug("Using stored username for targeted authentication:", storedUsername);
1561
1555
  authUsername = storedUsername;
1562
1556
  }
1563
1557
  else {