shogun-core 6.9.2 → 6.9.4

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.
@@ -59131,42 +59131,41 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
59131
59131
  }
59132
59132
  };
59133
59133
 
59134
+ var seaCache = null;
59134
59135
  // Helper function to get SEA safely from various sources
59135
59136
  function getSEA() {
59136
- try {
59137
- (__webpack_require__(/*! fs */ "?3d1a").appendFileSync)('debug_crypto.log', '[DEBUG] getSEA called\n');
59138
- }
59139
- catch (_a) { }
59140
- console.error('[DEBUG] getSEA called');
59137
+ if (seaCache)
59138
+ return seaCache;
59141
59139
  // Try global.SEA directly (matches setup.ts)
59142
59140
  if (__webpack_require__.g.SEA) {
59143
- try {
59144
- (__webpack_require__(/*! fs */ "?3d1a").appendFileSync)('debug_crypto.log', '[DEBUG] Found global.SEA\n');
59145
- }
59146
- catch (_b) { }
59147
- console.error('[DEBUG] Found global.SEA');
59148
- return __webpack_require__.g.SEA;
59141
+ seaCache = __webpack_require__.g.SEA;
59142
+ return seaCache;
59149
59143
  }
59150
59144
  // Try globalThis first (works in both browser and Node)
59151
59145
  if (globalThis.Gun && globalThis.Gun.SEA) {
59152
- return globalThis.Gun.SEA;
59146
+ seaCache = globalThis.Gun.SEA;
59147
+ return seaCache;
59153
59148
  }
59154
59149
  // Try window (browser)
59155
59150
  if ( true &&
59156
59151
  window.Gun &&
59157
59152
  window.Gun.SEA) {
59158
- return window.Gun.SEA;
59153
+ seaCache = window.Gun.SEA;
59154
+ return seaCache;
59159
59155
  }
59160
59156
  // Try global (Node.js)
59161
59157
  if (__webpack_require__.g.Gun && __webpack_require__.g.Gun.SEA) {
59162
- return __webpack_require__.g.Gun.SEA;
59158
+ seaCache = __webpack_require__.g.Gun.SEA;
59159
+ return seaCache;
59163
59160
  }
59164
59161
  // Try direct SEA global
59165
59162
  if (globalThis.SEA) {
59166
- return globalThis.SEA;
59163
+ seaCache = globalThis.SEA;
59164
+ return seaCache;
59167
59165
  }
59168
59166
  if ( true && window.SEA) {
59169
- return window.SEA;
59167
+ seaCache = window.SEA;
59168
+ return seaCache;
59170
59169
  }
59171
59170
  // console.error('[DEBUG] SEA not found in any location');
59172
59171
  return null;
@@ -59537,15 +59536,7 @@ function generatePairFromSeed(seed) {
59537
59536
  switch (_b.label) {
59538
59537
  case 0:
59539
59538
  sea = getSEA();
59540
- try {
59541
- (__webpack_require__(/*! fs */ "?3d1a").appendFileSync)('debug_crypto.log', "[DEBUG] generatePairFromSeed sea: ".concat(!!sea, " pair: ").concat(!!(sea === null || sea === void 0 ? void 0 : sea.pair), " keys: ").concat(sea ? Object.keys(sea).join(',') : 'null', "\n"));
59542
- }
59543
- catch (_c) { }
59544
59539
  if (!sea || !sea.pair) {
59545
- try {
59546
- (__webpack_require__(/*! fs */ "?3d1a").appendFileSync)('debug_crypto.log', "[DEBUG] SEA global state details: global.SEA=".concat(!!__webpack_require__.g.SEA, "\n"));
59547
- }
59548
- catch (_d) { }
59549
59540
  throw new Error('SEA not available');
59550
59541
  }
59551
59542
  _b.label = 1;
@@ -59554,14 +59545,12 @@ function generatePairFromSeed(seed) {
59554
59545
  return [4 /*yield*/, sea.pair(null, { seed: seed })];
59555
59546
  case 2:
59556
59547
  pair = _b.sent();
59557
- console.error('[DEBUG] native pair result:', pair);
59558
59548
  if (pair && pair.pub && pair.priv) {
59559
59549
  return [2 /*return*/, pair];
59560
59550
  }
59561
59551
  return [3 /*break*/, 4];
59562
59552
  case 3:
59563
59553
  err_1 = _b.sent();
59564
- console.error('[DEBUG] native pair failed:', err_1);
59565
59554
  return [3 /*break*/, 4];
59566
59555
  case 4: return [4 /*yield*/, sea.work(seed, 'shogun-seed-salt', // Constant salt for consistent derivation
59567
59556
  null, { name: 'SHA-256' })];
@@ -59618,16 +59607,6 @@ function generatePairFromMnemonic(mnemonic, username) {
59618
59607
 
59619
59608
  /***/ }),
59620
59609
 
59621
- /***/ "?3d1a":
59622
- /*!********************!*\
59623
- !*** fs (ignored) ***!
59624
- \********************/
59625
- /***/ (() => {
59626
-
59627
- /* (ignored) */
59628
-
59629
- /***/ }),
59630
-
59631
59610
  /***/ "?3e83":
59632
59611
  /*!**********************!*\
59633
59612
  !*** util (ignored) ***!
@@ -71143,7 +71122,7 @@ var Webauthn = /** @class */ (function (_super) {
71143
71122
  switch (_c.label) {
71144
71123
  case 0:
71145
71124
  _c.trys.push([0, 2, , 5]);
71146
- return [4 /*yield*/, this_1.generateCredentials(username, credentials, isNewDevice)];
71125
+ return [4 /*yield*/, this_1.generateCredentials(username, credentials, false)];
71147
71126
  case 1:
71148
71127
  result = _c.sent();
71149
71128
  if (result.success) {
@@ -71390,7 +71369,8 @@ var Webauthn = /** @class */ (function (_super) {
71390
71369
  userId = new TextEncoder().encode(username);
71391
71370
  publicKeyCredentialCreationOptions = {
71392
71371
  challenge: challenge,
71393
- rp: __assign({ name: 'Shogun Wallet' }, (this.config.rpId !== 'localhost' && { id: this.config.rpId })),
71372
+ rp: __assign({ name: this.config.rpName || 'Shogun Wallet' }, (this.config.rpId &&
71373
+ this.config.rpId !== 'localhost' && { id: this.config.rpId })),
71394
71374
  user: {
71395
71375
  id: userId,
71396
71376
  name: username,
@@ -122983,25 +122963,31 @@ var AuthManager = /** @class */ (function () {
122983
122963
  return this.core.getPlugin('nostr');
122984
122964
  case 'password':
122985
122965
  default:
122966
+ // Mock a plugin for password-based authentication to provide a consistent interface
122986
122967
  return {
122968
+ name: 'password',
122969
+ version: '1.0.0',
122970
+ initialize: function () { },
122987
122971
  login: function (username, password) { return AuthManager_awaiter(_this, void 0, void 0, function () {
122988
122972
  return AuthManager_generator(this, function (_a) {
122989
122973
  switch (_a.label) {
122990
- case 0: return [4 /*yield*/, this.login(username, password)];
122974
+ case 0: return [4 /*yield*/, this.login(username, password || '')];
122991
122975
  case 1: return [2 /*return*/, _a.sent()];
122992
122976
  }
122993
122977
  });
122994
122978
  }); },
122995
- signUp: function (username, password, confirm) { return AuthManager_awaiter(_this, void 0, void 0, function () {
122996
- return AuthManager_generator(this, function (_a) {
122997
- switch (_a.label) {
122979
+ signUp: function (username, options) { return AuthManager_awaiter(_this, void 0, void 0, function () {
122980
+ var _a, password, confirm;
122981
+ return AuthManager_generator(this, function (_b) {
122982
+ switch (_b.label) {
122998
122983
  case 0:
122984
+ _a = options || {}, password = _a.password, confirm = _a.confirm;
122999
122985
  // For password-based signup, validate password confirmation
123000
122986
  if (confirm && password !== confirm) {
123001
122987
  throw new Error('Password and confirm password do not match');
123002
122988
  }
123003
- return [4 /*yield*/, this.signUp(username, password)];
123004
- case 1: return [2 /*return*/, _a.sent()];
122989
+ return [4 /*yield*/, this.signUp(username, password || '')];
122990
+ case 1: return [2 /*return*/, _b.sent()];
123005
122991
  }
123006
122992
  });
123007
122993
  }); },