@passkeyme/auth 1.1.2 → 1.1.3
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 +37 -6
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +37 -6
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +37 -6
- package/dist/index.umd.js.map +1 -1
- package/dist/src/passkeyme-auth.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts +8 -0
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -17,6 +17,19 @@
|
|
|
17
17
|
...config,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Update logger configuration
|
|
22
|
+
*/
|
|
23
|
+
setConfig(config) {
|
|
24
|
+
this.config = { ...this.config, ...config };
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Enable debug logging
|
|
28
|
+
*/
|
|
29
|
+
enableDebug() {
|
|
30
|
+
this.config.enabled = true;
|
|
31
|
+
this.config.level = "debug";
|
|
32
|
+
}
|
|
20
33
|
shouldLog(level) {
|
|
21
34
|
if (!this.config.enabled)
|
|
22
35
|
return false;
|
|
@@ -821,6 +834,10 @@
|
|
|
821
834
|
this.tokenStorage = new TokenStorage(storage);
|
|
822
835
|
// Use provided passkey SDK or create default one
|
|
823
836
|
this.passkeySDK = config.passkeySDK || this.createDefaultPasskeySDK();
|
|
837
|
+
// Configure logger with debug setting from config
|
|
838
|
+
if (this.config.debug) {
|
|
839
|
+
logger.enableDebug();
|
|
840
|
+
}
|
|
824
841
|
logger.debug("Initialized with config:", this.config);
|
|
825
842
|
}
|
|
826
843
|
/**
|
|
@@ -1485,11 +1502,22 @@
|
|
|
1485
1502
|
}
|
|
1486
1503
|
try {
|
|
1487
1504
|
// Get app configuration to check discoverable credentials support
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1505
|
+
let appConfig;
|
|
1506
|
+
try {
|
|
1507
|
+
appConfig = await this.getAppConfig();
|
|
1508
|
+
logger.debug("App config loaded:", {
|
|
1509
|
+
discoverableCredentialsEnabled: appConfig.discoverableCredentialsEnabled,
|
|
1510
|
+
passkeyEnabled: appConfig.passkeyEnabled,
|
|
1511
|
+
});
|
|
1512
|
+
}
|
|
1513
|
+
catch (configError) {
|
|
1514
|
+
logger.debug("Failed to load app config, assuming passkeys enabled:", configError);
|
|
1515
|
+
// If we can't load config, assume passkeys are enabled and no discoverable credentials
|
|
1516
|
+
appConfig = {
|
|
1517
|
+
passkeyEnabled: true,
|
|
1518
|
+
discoverableCredentialsEnabled: false,
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1493
1521
|
// If passkeys are disabled at the app level, fallback to hosted auth
|
|
1494
1522
|
if (!appConfig.passkeyEnabled) {
|
|
1495
1523
|
logger.debug("Passkeys disabled for this app, falling back to hosted auth");
|
|
@@ -1513,7 +1541,10 @@
|
|
|
1513
1541
|
}
|
|
1514
1542
|
}
|
|
1515
1543
|
// Try to get stored username for fallback
|
|
1516
|
-
const
|
|
1544
|
+
const storageKey = `last_username_${this.config.appId}`;
|
|
1545
|
+
logger.debug("Looking for stored username with key:", storageKey);
|
|
1546
|
+
const storedUsername = await this.storage.getItem(storageKey);
|
|
1547
|
+
logger.debug("Found stored username:", storedUsername);
|
|
1517
1548
|
if (storedUsername) {
|
|
1518
1549
|
logger.debug("Using stored username for targeted authentication:", storedUsername);
|
|
1519
1550
|
authUsername = storedUsername;
|