shogun-core 6.0.1 → 6.0.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.
|
@@ -145013,10 +145013,9 @@ class DataBase {
|
|
|
145013
145013
|
};
|
|
145014
145014
|
}
|
|
145015
145015
|
console.log(`[POSTAUTH] User tracking setup completed successfully for: ${normalizedUsername}`);
|
|
145016
|
-
// Setup crypto identities for the user
|
|
145017
|
-
|
|
145018
|
-
|
|
145019
|
-
!process.env.SKIP_CRYPTO_GENERATION) {
|
|
145016
|
+
// Setup crypto identities for the user based on config (default: enabled)
|
|
145017
|
+
const shouldAutoGenerateCrypto = (this.core?.config?.crypto?.autoGenerateOnAuth ?? true) === true;
|
|
145018
|
+
if (this._cryptoIdentityManager && userSea && shouldAutoGenerateCrypto) {
|
|
145020
145019
|
console.log(`[POSTAUTH] Setting up crypto identities for: ${normalizedUsername}`);
|
|
145021
145020
|
try {
|
|
145022
145021
|
const cryptoSetupResult = await this._cryptoIdentityManager.setupCryptoIdentities(normalizedUsername, userSea, false);
|
|
@@ -145034,8 +145033,8 @@ class DataBase {
|
|
|
145034
145033
|
}
|
|
145035
145034
|
}
|
|
145036
145035
|
else {
|
|
145037
|
-
if (
|
|
145038
|
-
console.log(`ℹ️ [POSTAUTH] Skipping crypto identities setup -
|
|
145036
|
+
if (!shouldAutoGenerateCrypto) {
|
|
145037
|
+
console.log(`ℹ️ [POSTAUTH] Skipping crypto identities setup - config.crypto.autoGenerateOnAuth is false`);
|
|
145039
145038
|
}
|
|
145040
145039
|
else {
|
|
145041
145040
|
console.log(`ℹ️ [POSTAUTH] Skipping crypto identities setup - manager not available or no SEA pair`);
|
|
@@ -145141,6 +145140,11 @@ class DataBase {
|
|
|
145141
145140
|
*/
|
|
145142
145141
|
async createAliasIndex(username, userPub) {
|
|
145143
145142
|
try {
|
|
145143
|
+
// Ensure node is initialized
|
|
145144
|
+
if (!this.node) {
|
|
145145
|
+
console.error(`Error creating alias index: node not initialized`);
|
|
145146
|
+
return false;
|
|
145147
|
+
}
|
|
145144
145148
|
// Create a simple alias mapping without using GunDB's complex alias system
|
|
145145
145149
|
// Store username -> userPub mapping in a simple way
|
|
145146
145150
|
const aliasData = {
|
|
@@ -152886,11 +152890,12 @@ class WebauthnPlugin extends base_1.BasePlugin {
|
|
|
152886
152890
|
if (!credentials?.success) {
|
|
152887
152891
|
throw new Error(credentials?.error || "Unable to generate WebAuthn credentials");
|
|
152888
152892
|
}
|
|
152889
|
-
|
|
152890
|
-
|
|
152893
|
+
// Use the key directly from credentials instead of calling generatePairFromCredentials
|
|
152894
|
+
// since generateCredentials already returns the derived key pair
|
|
152895
|
+
if (!credentials.key) {
|
|
152891
152896
|
throw new Error("Failed to generate SEA pair from WebAuthn credentials");
|
|
152892
152897
|
}
|
|
152893
|
-
pair =
|
|
152898
|
+
pair = credentials.key;
|
|
152894
152899
|
}
|
|
152895
152900
|
core.setAuthMethod("webauthn");
|
|
152896
152901
|
// Register user with Gun (using email parameter slot for pair)
|