shogun-core 1.3.2 → 1.3.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.
@@ -1045,16 +1045,19 @@ class GunInstance {
1045
1045
  async forgotPassword(username, securityAnswers) {
1046
1046
  (0, logger_1.log)("Attempting password recovery for:", username);
1047
1047
  try {
1048
- // Find the user's public key
1049
- const userPub = await this.checkUsernameExists(username);
1050
- if (!userPub) {
1048
+ // Find the user's data
1049
+ const userData = await this.checkUsernameExists(username);
1050
+ if (!userData || !userData.pub) {
1051
1051
  return { success: false, error: "User not found" };
1052
1052
  }
1053
- // Access the user's data using their public key
1054
- const user = this.gun.user(userPub);
1055
- // Retrieve security questions and encrypted hint from the user's graph
1053
+ // Extract the public key from user data
1054
+ const userPub = userData.pub;
1055
+ (0, logger_1.log)(`Found user public key for password recovery: ${userPub}`);
1056
+ // Access the user's security data directly from their public key node
1057
+ // Security data is stored in the user's private space, so we need to access it via their public key
1056
1058
  const securityData = await new Promise((resolve) => {
1057
- user.get("security").once((data) => {
1059
+ this.gun.get(userPub).get("security").once((data) => {
1060
+ (0, logger_1.log)(`Retrieved security data for user ${username}:`, data ? "found" : "not found");
1058
1061
  resolve(data);
1059
1062
  });
1060
1063
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shogun-core",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "SHOGUN SDK - Core library for Shogun SDK",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",