shogun-core 3.2.3 → 3.3.1

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.
Files changed (110) hide show
  1. package/README.md +12 -0
  2. package/dist/browser/shogun-core.js +909 -1804
  3. package/dist/browser/shogun-core.js.map +1 -1
  4. package/dist/{src/gundb → gundb}/db.js +55 -11
  5. package/dist/{src/index.js → index.js} +1 -7
  6. package/dist/{src/managers → managers}/CoreInitializer.js +41 -13
  7. package/dist/{src/storage → storage}/storage.js +22 -9
  8. package/dist/types/{src/gundb → gundb}/db.d.ts +10 -3
  9. package/dist/types/{src/index.d.ts → index.d.ts} +0 -3
  10. package/dist/types/{src/interfaces → interfaces}/shogun.d.ts +2 -0
  11. package/dist/types/{src/storage → storage}/storage.d.ts +2 -1
  12. package/dist/types/{src/types → types}/shogun.d.ts +2 -0
  13. package/package.json +22 -9
  14. package/dist/browser/_e6ae.shogun-core.js +0 -14
  15. package/dist/browser/_e6ae.shogun-core.js.map +0 -1
  16. package/dist/ship/examples/messenger-cli.js +0 -629
  17. package/dist/ship/implementation/SHIP_01.js +0 -650
  18. package/dist/ship/interfaces/ISHIP_01.js +0 -71
  19. package/dist/types/ship/examples/messenger-cli.d.ts +0 -31
  20. package/dist/types/ship/implementation/SHIP_01.d.ts +0 -113
  21. package/dist/types/ship/interfaces/ISHIP_01.d.ts +0 -305
  22. /package/dist/{src/config → config}/simplified-config.js +0 -0
  23. /package/dist/{src/core.js → core.js} +0 -0
  24. /package/dist/{src/examples → examples}/api-test.js +0 -0
  25. /package/dist/{src/examples → examples}/simple-api-test.js +0 -0
  26. /package/dist/{src/gundb → gundb}/api.js +0 -0
  27. /package/dist/{src/gundb → gundb}/crypto.js +0 -0
  28. /package/dist/{src/gundb → gundb}/derive.js +0 -0
  29. /package/dist/{src/gundb → gundb}/errors.js +0 -0
  30. /package/dist/{src/gundb → gundb}/index.js +0 -0
  31. /package/dist/{src/gundb → gundb}/rxjs.js +0 -0
  32. /package/dist/{src/gundb → gundb}/types.js +0 -0
  33. /package/dist/{src/interfaces → interfaces}/common.js +0 -0
  34. /package/dist/{src/interfaces → interfaces}/events.js +0 -0
  35. /package/dist/{src/interfaces → interfaces}/plugin.js +0 -0
  36. /package/dist/{src/interfaces → interfaces}/shogun.js +0 -0
  37. /package/dist/{src/managers → managers}/AuthManager.js +0 -0
  38. /package/dist/{src/managers → managers}/EventManager.js +0 -0
  39. /package/dist/{src/managers → managers}/PluginManager.js +0 -0
  40. /package/dist/{src/migration-test.js → migration-test.js} +0 -0
  41. /package/dist/{src/plugins → plugins}/base.js +0 -0
  42. /package/dist/{src/plugins → plugins}/index.js +0 -0
  43. /package/dist/{src/plugins → plugins}/nostr/index.js +0 -0
  44. /package/dist/{src/plugins → plugins}/nostr/nostrConnector.js +0 -0
  45. /package/dist/{src/plugins → plugins}/nostr/nostrConnectorPlugin.js +0 -0
  46. /package/dist/{src/plugins → plugins}/nostr/nostrSigner.js +0 -0
  47. /package/dist/{src/plugins → plugins}/nostr/types.js +0 -0
  48. /package/dist/{src/plugins → plugins}/oauth/index.js +0 -0
  49. /package/dist/{src/plugins → plugins}/oauth/oauthConnector.js +0 -0
  50. /package/dist/{src/plugins → plugins}/oauth/oauthPlugin.js +0 -0
  51. /package/dist/{src/plugins → plugins}/oauth/types.js +0 -0
  52. /package/dist/{src/plugins → plugins}/web3/index.js +0 -0
  53. /package/dist/{src/plugins → plugins}/web3/types.js +0 -0
  54. /package/dist/{src/plugins → plugins}/web3/web3Connector.js +0 -0
  55. /package/dist/{src/plugins → plugins}/web3/web3ConnectorPlugin.js +0 -0
  56. /package/dist/{src/plugins → plugins}/web3/web3Signer.js +0 -0
  57. /package/dist/{src/plugins → plugins}/webauthn/index.js +0 -0
  58. /package/dist/{src/plugins → plugins}/webauthn/types.js +0 -0
  59. /package/dist/{src/plugins → plugins}/webauthn/webauthn.js +0 -0
  60. /package/dist/{src/plugins → plugins}/webauthn/webauthnPlugin.js +0 -0
  61. /package/dist/{src/plugins → plugins}/webauthn/webauthnSigner.js +0 -0
  62. /package/dist/types/{src/config → config}/simplified-config.d.ts +0 -0
  63. /package/dist/types/{src/core.d.ts → core.d.ts} +0 -0
  64. /package/dist/{src/types → types}/events.js +0 -0
  65. /package/dist/types/{src/examples → examples}/api-test.d.ts +0 -0
  66. /package/dist/types/{src/examples → examples}/simple-api-test.d.ts +0 -0
  67. /package/dist/types/{src/gundb → gundb}/api.d.ts +0 -0
  68. /package/dist/types/{src/gundb → gundb}/crypto.d.ts +0 -0
  69. /package/dist/types/{src/gundb → gundb}/derive.d.ts +0 -0
  70. /package/dist/types/{src/gundb → gundb}/errors.d.ts +0 -0
  71. /package/dist/types/{src/gundb → gundb}/index.d.ts +0 -0
  72. /package/dist/types/{src/gundb → gundb}/rxjs.d.ts +0 -0
  73. /package/dist/types/{src/gundb → gundb}/types.d.ts +0 -0
  74. /package/dist/types/{src/interfaces → interfaces}/common.d.ts +0 -0
  75. /package/dist/types/{src/interfaces → interfaces}/events.d.ts +0 -0
  76. /package/dist/types/{src/interfaces → interfaces}/plugin.d.ts +0 -0
  77. /package/dist/types/{src/managers → managers}/AuthManager.d.ts +0 -0
  78. /package/dist/types/{src/managers → managers}/CoreInitializer.d.ts +0 -0
  79. /package/dist/types/{src/managers → managers}/EventManager.d.ts +0 -0
  80. /package/dist/types/{src/managers → managers}/PluginManager.d.ts +0 -0
  81. /package/dist/types/{src/migration-test.d.ts → migration-test.d.ts} +0 -0
  82. /package/dist/types/{src/plugins → plugins}/base.d.ts +0 -0
  83. /package/dist/types/{src/plugins → plugins}/index.d.ts +0 -0
  84. /package/dist/types/{src/plugins → plugins}/nostr/index.d.ts +0 -0
  85. /package/dist/types/{src/plugins → plugins}/nostr/nostrConnector.d.ts +0 -0
  86. /package/dist/types/{src/plugins → plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
  87. /package/dist/types/{src/plugins → plugins}/nostr/nostrSigner.d.ts +0 -0
  88. /package/dist/types/{src/plugins → plugins}/nostr/types.d.ts +0 -0
  89. /package/dist/types/{src/plugins → plugins}/oauth/index.d.ts +0 -0
  90. /package/dist/types/{src/plugins → plugins}/oauth/oauthConnector.d.ts +0 -0
  91. /package/dist/types/{src/plugins → plugins}/oauth/oauthPlugin.d.ts +0 -0
  92. /package/dist/types/{src/plugins → plugins}/oauth/types.d.ts +0 -0
  93. /package/dist/types/{src/plugins → plugins}/web3/index.d.ts +0 -0
  94. /package/dist/types/{src/plugins → plugins}/web3/types.d.ts +0 -0
  95. /package/dist/types/{src/plugins → plugins}/web3/web3Connector.d.ts +0 -0
  96. /package/dist/types/{src/plugins → plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
  97. /package/dist/types/{src/plugins → plugins}/web3/web3Signer.d.ts +0 -0
  98. /package/dist/types/{src/plugins → plugins}/webauthn/index.d.ts +0 -0
  99. /package/dist/types/{src/plugins → plugins}/webauthn/types.d.ts +0 -0
  100. /package/dist/types/{src/plugins → plugins}/webauthn/webauthn.d.ts +0 -0
  101. /package/dist/types/{src/plugins → plugins}/webauthn/webauthnPlugin.d.ts +0 -0
  102. /package/dist/types/{src/plugins → plugins}/webauthn/webauthnSigner.d.ts +0 -0
  103. /package/dist/{src/types → types}/shogun.js +0 -0
  104. /package/dist/types/{src/types → types}/events.d.ts +0 -0
  105. /package/dist/types/{src/utils → utils}/errorHandler.d.ts +0 -0
  106. /package/dist/types/{src/utils → utils}/eventEmitter.d.ts +0 -0
  107. /package/dist/types/{src/utils → utils}/validation.d.ts +0 -0
  108. /package/dist/{src/utils → utils}/errorHandler.js +0 -0
  109. /package/dist/{src/utils → utils}/eventEmitter.js +0 -0
  110. /package/dist/{src/utils → utils}/validation.js +0 -0
@@ -79,11 +79,16 @@ const CONFIG = {
79
79
  },
80
80
  };
81
81
  class DataBase {
82
- constructor(gun, appScope = "shogun") {
82
+ constructor(gun, appScope = "shogun", options) {
83
83
  this.user = null;
84
84
  this.onAuthCallbacks = [];
85
+ this.disableAutoRecall = false;
86
+ this.silent = false;
85
87
  // Initialize event emitter
86
88
  this.eventEmitter = new eventEmitter_1.EventEmitter();
89
+ // Set options
90
+ this.disableAutoRecall = options?.disableAutoRecall || false;
91
+ this.silent = options?.silent || false;
87
92
  // Validate Gun instance
88
93
  if (!gun) {
89
94
  throw new Error("Gun instance is required but was not provided");
@@ -101,7 +106,18 @@ class DataBase {
101
106
  throw new Error(`Gun instance is invalid: gun.on is not a function. Received gun.on type: ${typeof gun.on}`);
102
107
  }
103
108
  this.gun = gun;
104
- this.user = this.gun.user().recall({ sessionStorage: true });
109
+ // Recall only if NOT disabled and there's a "pair" in sessionStorage
110
+ if (!this.disableAutoRecall &&
111
+ typeof sessionStorage !== "undefined" &&
112
+ sessionStorage.getItem("pair")) {
113
+ this.user = this.gun.user().recall({ sessionStorage: true });
114
+ }
115
+ else {
116
+ if (!this.silent && !this.disableAutoRecall) {
117
+ console.log("No pair found in sessionStorage, using gun.user()");
118
+ }
119
+ this.user = this.gun.user();
120
+ }
105
121
  this.subscribeToAuthEvents();
106
122
  this.crypto = crypto;
107
123
  this.sea = sea_1.default;
@@ -508,7 +524,13 @@ class DataBase {
508
524
  }
509
525
  // Attempt to recall user session
510
526
  try {
511
- const recallResult = userInstance.recall({ sessionStorage: true });
527
+ if (typeof sessionStorage !== "undefined" &&
528
+ sessionStorage.getItem("pair")) {
529
+ const recallResult = userInstance.recall({ sessionStorage: true });
530
+ }
531
+ else {
532
+ const recallResult = userInstance;
533
+ }
512
534
  // console.log("recallResult", recallResult);
513
535
  }
514
536
  catch (recallError) {
@@ -1704,9 +1726,15 @@ class DataBase {
1704
1726
  /**
1705
1727
  * Recall user session
1706
1728
  */
1707
- recall() {
1729
+ recall(options) {
1708
1730
  if (this.user) {
1709
- this.user.recall({ sessionStorage: true });
1731
+ if (typeof sessionStorage !== "undefined" &&
1732
+ sessionStorage.getItem("pair")) {
1733
+ this.user.recall({ sessionStorage: true });
1734
+ }
1735
+ else {
1736
+ this.user;
1737
+ }
1710
1738
  }
1711
1739
  }
1712
1740
  /**
@@ -1754,7 +1782,13 @@ class DataBase {
1754
1782
  */
1755
1783
  saveSession(session) {
1756
1784
  if (this.user) {
1757
- this.user.recall({ sessionStorage: true });
1785
+ if (typeof sessionStorage !== "undefined" &&
1786
+ sessionStorage.getItem("pair")) {
1787
+ this.user.recall({ sessionStorage: true });
1788
+ }
1789
+ else {
1790
+ this.user;
1791
+ }
1758
1792
  }
1759
1793
  }
1760
1794
  /**
@@ -1762,7 +1796,13 @@ class DataBase {
1762
1796
  */
1763
1797
  loadSession() {
1764
1798
  if (this.user) {
1765
- return this.user.recall({ sessionStorage: true });
1799
+ if (typeof sessionStorage !== "undefined" &&
1800
+ sessionStorage.getItem("pair")) {
1801
+ return this.user.recall({ sessionStorage: true });
1802
+ }
1803
+ else {
1804
+ return this.user;
1805
+ }
1766
1806
  }
1767
1807
  return null;
1768
1808
  }
@@ -1799,11 +1839,15 @@ class DataBase {
1799
1839
  exports.DataBase = DataBase;
1800
1840
  // Errors
1801
1841
  DataBase.Errors = GunErrors;
1802
- const createGun = (config) => {
1803
- console.log("Creating Gun instance with config:", config);
1804
- console.log("Config peers:", config?.peers);
1842
+ const createGun = (config, silent) => {
1843
+ if (!silent) {
1844
+ console.log("Creating Gun instance with config:", config);
1845
+ console.log("Config peers:", config?.peers);
1846
+ }
1805
1847
  const gunInstance = (0, gun_1.default)(config);
1806
- console.log("Created Gun instance:", gunInstance);
1848
+ if (!silent) {
1849
+ console.log("Created Gun instance:", gunInstance);
1850
+ }
1807
1851
  return gunInstance;
1808
1852
  };
1809
1853
  exports.createGun = createGun;
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.autoQuickStart = exports.AutoQuickStart = exports.createSimpleAPI = exports.quickStart = exports.QuickStart = exports.SimpleGunAPI = exports.DataBase = exports.GunErrors = exports.derive = exports.crypto = exports.RxJS = exports.SEA = exports.ShogunCore = exports.Gun = exports.MessengerCLI = exports.SHIP_01 = void 0;
20
+ exports.autoQuickStart = exports.AutoQuickStart = exports.createSimpleAPI = exports.quickStart = exports.QuickStart = exports.SimpleGunAPI = exports.DataBase = exports.GunErrors = exports.derive = exports.crypto = exports.RxJS = exports.SEA = exports.ShogunCore = exports.Gun = void 0;
21
21
  const core_1 = require("./core");
22
22
  Object.defineProperty(exports, "ShogunCore", { enumerable: true, get: function () { return core_1.ShogunCore; } });
23
23
  const db_1 = require("./gundb/db");
@@ -42,9 +42,3 @@ __exportStar(require("./utils/errorHandler"), exports);
42
42
  __exportStar(require("./plugins"), exports);
43
43
  __exportStar(require("./interfaces/shogun"), exports);
44
44
  __exportStar(require("./config/simplified-config"), exports);
45
- var SHIP_01_1 = require("../ship/implementation/SHIP_01");
46
- Object.defineProperty(exports, "SHIP_01", { enumerable: true, get: function () { return SHIP_01_1.SHIP_01; } });
47
- // Export MessengerCLI only in Node.js environment (not browser)
48
- // This prevents "readline is not a function" errors in browser builds
49
- var messenger_cli_1 = require("../ship/examples/messenger-cli");
50
- Object.defineProperty(exports, "MessengerCLI", { enumerable: true, get: function () { return messenger_cli_1.MessengerCLI; } });
@@ -34,7 +34,7 @@ class CoreInitializer {
34
34
  };
35
35
  }
36
36
  // Initialize storage
37
- this.core.storage = new storage_1.ShogunStorage();
37
+ this.core.storage = new storage_1.ShogunStorage(config.silent);
38
38
  // Setup error handler
39
39
  errorHandler_1.ErrorHandler.addListener((error) => {
40
40
  this.core.emit("error", {
@@ -62,25 +62,35 @@ class CoreInitializer {
62
62
  * Initialize Gun instance
63
63
  */
64
64
  async initializeGun(config) {
65
- console.log("Initialize Gun instance", config);
65
+ if (!config.silent) {
66
+ console.log("Initialize Gun instance", config);
67
+ }
66
68
  try {
67
69
  if (config.gunInstance && config.gunOptions === undefined) {
68
- console.log("Using provided Gun instance");
70
+ if (!config.silent) {
71
+ console.log("Using provided Gun instance");
72
+ }
69
73
  this.core._gun = config.gunInstance;
70
74
  }
71
75
  else if (config.gunOptions && config.gunInstance === undefined) {
72
- console.log("Creating new Gun instance");
73
- this.core._gun = (0, gundb_1.createGun)(config.gunOptions);
76
+ if (!config.silent) {
77
+ console.log("Creating new Gun instance");
78
+ }
79
+ this.core._gun = (0, gundb_1.createGun)(config.gunOptions, config.silent);
74
80
  }
75
81
  else if (config.gunInstance && config.gunOptions) {
76
82
  // Both provided, prefer gunInstance
77
- console.log("Both gunInstance and gunOptions provided, using gunInstance");
83
+ if (!config.silent) {
84
+ console.log("Both gunInstance and gunOptions provided, using gunInstance");
85
+ }
78
86
  this.core._gun = config.gunInstance;
79
87
  }
80
88
  else {
81
89
  // Neither provided, create a default Gun instance for testing
82
- console.log("No Gun instance or options provided, creating default instance");
83
- this.core._gun = (0, gundb_1.createGun)({ peers: config.gunOptions?.peers || [] });
90
+ if (!config.silent) {
91
+ console.log("No Gun instance or options provided, creating default instance");
92
+ }
93
+ this.core._gun = (0, gundb_1.createGun)({ peers: config.gunOptions?.peers || [] }, config.silent);
84
94
  }
85
95
  }
86
96
  catch (error) {
@@ -90,8 +100,10 @@ class CoreInitializer {
90
100
  throw new Error(`Failed to create Gun instance: ${error}`);
91
101
  }
92
102
  try {
93
- console.log("Initialize Gun instance", this.core.gun);
94
- this.core.db = new gundb_1.DataBase(this.core._gun, config.gunOptions?.scope || "");
103
+ if (!config.silent) {
104
+ console.log("Initialize Gun instance", this.core.gun);
105
+ }
106
+ this.core.db = new gundb_1.DataBase(this.core._gun, config.gunOptions?.scope || "", { disableAutoRecall: config.disableAutoRecall, silent: config.silent });
95
107
  // Note: user is a getter that returns _user, so we don't need to assign it
96
108
  }
97
109
  catch (error) {
@@ -106,7 +118,15 @@ class CoreInitializer {
106
118
  */
107
119
  async initializeGunUser() {
108
120
  try {
109
- this.core._user = this.core.gun.user().recall({ sessionStorage: true });
121
+ // Skip recall if disabled in config
122
+ if (!this.core.config.disableAutoRecall &&
123
+ typeof sessionStorage !== "undefined" &&
124
+ sessionStorage.getItem("pair")) {
125
+ this.core._user = this.core.gun.user().recall({ sessionStorage: true });
126
+ }
127
+ else {
128
+ this.core._user = this.core.gun.user();
129
+ }
110
130
  }
111
131
  catch (error) {
112
132
  if (typeof console !== "undefined" && console.error) {
@@ -115,7 +135,15 @@ class CoreInitializer {
115
135
  throw new Error(`Failed to initialize Gun user: ${error}`);
116
136
  }
117
137
  this.core.gun.on("auth", (user) => {
118
- this.core._user = this.core.gun.user().recall({ sessionStorage: true });
138
+ // Skip recall if disabled in config
139
+ if (!this.core.config.disableAutoRecall &&
140
+ typeof sessionStorage !== "undefined" &&
141
+ sessionStorage.getItem("pair")) {
142
+ this.core._user = this.core.gun.user().recall({ sessionStorage: true });
143
+ }
144
+ else {
145
+ this.core._user = this.core.gun.user();
146
+ }
119
147
  this.core.emit("auth:login", {
120
148
  userPub: user.pub,
121
149
  method: "password",
@@ -149,7 +177,7 @@ class CoreInitializer {
149
177
  */
150
178
  setupWalletDerivation() {
151
179
  this.core.gun.on("auth", async (user) => {
152
- if (!user)
180
+ if (!user.is)
153
181
  return;
154
182
  const priv = user._?.sea?.epriv;
155
183
  const pub = user._?.sea?.epub;
@@ -10,28 +10,37 @@ class ShogunStorage {
10
10
  /**
11
11
  * Initializes storage and loads any existing keypair from localStorage if available
12
12
  */
13
- constructor() {
13
+ constructor(silent = false) {
14
14
  this.store = new Map();
15
+ this.silent = silent;
15
16
  this.isTestMode = process.env.NODE_ENV === "test";
16
17
  this.useLocalStorage = false;
17
- // Debug: log the environment
18
- console.log("ShogunStorage: NODE_ENV =", process.env.NODE_ENV);
19
- console.log("ShogunStorage: isTestMode =", this.isTestMode);
18
+ // Debug: log the environment (only if not silent)
19
+ if (!this.silent) {
20
+ console.log("ShogunStorage: NODE_ENV =", process.env.NODE_ENV);
21
+ console.log("ShogunStorage: isTestMode =", this.isTestMode);
22
+ }
20
23
  // In test mode, don't use localStorage to avoid test pollution
21
24
  if (this.isTestMode) {
22
25
  this.useLocalStorage = false;
23
- console.log("ShogunStorage: Test mode detected, localStorage disabled");
26
+ if (!this.silent) {
27
+ console.log("ShogunStorage: Test mode detected, localStorage disabled");
28
+ }
24
29
  return;
25
30
  }
26
31
  if (typeof localStorage !== "undefined") {
27
- console.log("ShogunStorage: localStorage is defined");
32
+ if (!this.silent) {
33
+ console.log("ShogunStorage: localStorage is defined");
34
+ }
28
35
  try {
29
36
  // Probe localStorage without polluting expectations in tests
30
37
  const testKey = "_shogun_test";
31
38
  localStorage.setItem(testKey, testKey);
32
39
  localStorage.removeItem(testKey);
33
40
  this.useLocalStorage = true;
34
- console.log("ShogunStorage: localStorage enabled");
41
+ if (!this.silent) {
42
+ console.log("ShogunStorage: localStorage enabled");
43
+ }
35
44
  const storedPair = localStorage.getItem("shogun_keypair");
36
45
  if (storedPair) {
37
46
  this.store.set("keypair", JSON.parse(storedPair));
@@ -40,11 +49,15 @@ class ShogunStorage {
40
49
  catch (error) {
41
50
  this.useLocalStorage = false;
42
51
  // Silence logs in tests; tests expect no console.error during constructor
43
- console.log("ShogunStorage: localStorage error:", error.message);
52
+ if (!this.silent) {
53
+ console.log("ShogunStorage: localStorage error:", error.message);
54
+ }
44
55
  }
45
56
  }
46
57
  else {
47
- console.log("ShogunStorage: localStorage is undefined");
58
+ if (!this.silent) {
59
+ console.log("ShogunStorage: localStorage is undefined");
60
+ }
48
61
  }
49
62
  }
50
63
  /**
@@ -29,7 +29,12 @@ declare class DataBase {
29
29
  private readonly onAuthCallbacks;
30
30
  private readonly eventEmitter;
31
31
  private _rxjs?;
32
- constructor(gun: IGunInstance, appScope?: string);
32
+ private disableAutoRecall;
33
+ private silent;
34
+ constructor(gun: IGunInstance, appScope?: string, options?: {
35
+ disableAutoRecall?: boolean;
36
+ silent?: boolean;
37
+ });
33
38
  /**
34
39
  * Initialize the GunInstance asynchronously
35
40
  * This method should be called after construction to perform async operations
@@ -329,7 +334,9 @@ declare class DataBase {
329
334
  /**
330
335
  * Recall user session
331
336
  */
332
- recall(): void;
337
+ recall(options?: {
338
+ sessionStorage?: boolean;
339
+ }): void;
333
340
  /**
334
341
  * Leave user session
335
342
  */
@@ -371,7 +378,7 @@ declare class DataBase {
371
378
  */
372
379
  isAuthenticated(): boolean;
373
380
  }
374
- declare const createGun: (config: any) => IGunInstance<any>;
381
+ declare const createGun: (config: any, silent?: boolean) => IGunInstance<any>;
375
382
  export { Gun, DataBase, SEA, RxJS, crypto, GunErrors, derive, createGun };
376
383
  export default Gun;
377
384
  export type { IGunUserInstance, IGunInstance, IGunChain } from "gun/types";
@@ -9,8 +9,5 @@ export * from "./plugins";
9
9
  export * from "./interfaces/shogun";
10
10
  export * from "./config/simplified-config";
11
11
  export type * from "./interfaces/plugin";
12
- export { SHIP_01 } from "../ship/implementation/SHIP_01";
13
- export type { ISHIP_01 } from "../ship/interfaces/ISHIP_01";
14
- export { MessengerCLI } from "../ship/examples/messenger-cli";
15
12
  export type { IGunUserInstance, IGunInstance, GunDataEventData, GunPeerEventData, DeriveOptions, TypedGunOperationResult, TypedAuthResult, };
16
13
  export { Gun, ShogunCore, SEA, RxJS, crypto, derive, GunErrors, DataBase, SimpleGunAPI, QuickStart, quickStart, createSimpleAPI, AutoQuickStart, autoQuickStart, };
@@ -185,6 +185,8 @@ export interface ShogunCoreConfig {
185
185
  plugins?: {
186
186
  autoRegister?: ShogunPlugin[];
187
187
  };
188
+ disableAutoRecall?: boolean;
189
+ silent?: boolean;
188
190
  }
189
191
  export interface ShogunEvents {
190
192
  error: (data: {
@@ -7,10 +7,11 @@ export declare class ShogunStorage {
7
7
  private store;
8
8
  private isTestMode;
9
9
  private useLocalStorage;
10
+ private silent;
10
11
  /**
11
12
  * Initializes storage and loads any existing keypair from localStorage if available
12
13
  */
13
- constructor();
14
+ constructor(silent?: boolean);
14
15
  /**
15
16
  * Gets the stored keypair asynchronously
16
17
  * @returns Promise resolving to the keypair or null if not found
@@ -126,6 +126,8 @@ export interface ShogunSDKConfig {
126
126
  plugins?: PluginsConfig;
127
127
  appToken?: string;
128
128
  gunOptions?: any;
129
+ disableAutoRecall?: boolean;
130
+ silent?: boolean;
129
131
  }
130
132
  export interface ShogunEvents {
131
133
  error: (data: any) => void;
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "shogun-core",
3
- "version": "3.2.3",
3
+ "version": "3.3.1",
4
4
  "description": "SHOGUN CORE - Core library for Shogun Ecosystem",
5
- "main": "./dist/index.js",
6
- "module": "./dist/index.js",
7
- "types": "./dist/types/index.d.ts",
5
+ "main": "./dist/src/index.js",
6
+ "module": "./dist/src/index.js",
7
+ "types": "./dist/types/src/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "types": "./dist/types/index.d.ts",
11
- "import": "./dist/index.js",
12
- "require": "./dist/index.js",
10
+ "types": "./dist/types/src/index.d.ts",
11
+ "import": "./dist/src/index.js",
12
+ "require": "./dist/src/index.js",
13
13
  "browser": "./dist/browser/shogun-core.js",
14
- "default": "./dist/index.js",
15
- "node": "./dist/index.js"
14
+ "default": "./dist/src/index.js",
15
+ "node": "./dist/src/index.js"
16
16
  }
17
17
  },
18
18
  "files": [
@@ -23,7 +23,13 @@
23
23
  "build:cjs": "tsc",
24
24
  "build:browser": "webpack --config webpack.config.cjs",
25
25
  "dev": "tsc --watch",
26
+ "identity": "tsx ship/examples/identity-cli.ts",
26
27
  "messenger": "tsx ship/examples/messenger-cli.ts",
28
+ "wallet": "tsx ship/examples/wallet-cli.ts",
29
+ "stealth": "tsx ship/examples/stealth-cli.ts",
30
+ "storage": "tsx ship/examples/storage-cli.ts",
31
+ "ephemeral": "tsx ship/examples/ephemeral-cli.ts",
32
+ "vault": "tsx ship/examples/vault-cli.ts",
27
33
  "format": "prettier --write \"src/**/*.ts\"",
28
34
  "docs": "yarn typedoc --options typedoc.json",
29
35
  "prebuild": "rimraf dist",
@@ -45,22 +51,29 @@
45
51
  "author": "Scobru",
46
52
  "license": "MIT",
47
53
  "dependencies": {
54
+ "@fluidkey/stealth-account-kit": "^1.1.0",
48
55
  "@noble/curves": "^1.9.1",
56
+ "@scure/bip32": "^2.0.1",
49
57
  "assert": "^2.1.0",
50
58
  "base64url": "^3.0.1",
51
59
  "buffer": "^6.0.3",
60
+ "bugoff": "^0.0.9",
52
61
  "constants-browserify": "^1.0.0",
53
62
  "crypto-browserify": "^3.12.0",
54
63
  "ethers": "^6.13.5",
64
+ "form-data": "^4.0.4",
55
65
  "gun": "git+https://github.com/amark/gun.git",
56
66
  "keccak256": "^1.0.6",
57
67
  "nostr-tools": "^2.15.0",
58
68
  "qs": "^6.14.0",
59
69
  "rxjs": "^7.8.2",
70
+ "shogun-ipfs": "file:../shogun-ipfs",
60
71
  "ts-node": "^10.9.2",
61
72
  "url": "^0.11.4",
62
73
  "uuid": "^11.1.0",
63
74
  "vm-browserify": "^1.1.2",
75
+ "webtorrent": "^1.9.7",
76
+ "wrtc": "^0.4.7",
64
77
  "ws": "^8.18.3"
65
78
  },
66
79
  "devDependencies": {
@@ -1,14 +0,0 @@
1
- (this["webpackChunkShogunCore"] = this["webpackChunkShogunCore"] || []).push([["_e6ae"],{
2
-
3
- /***/ "?e6ae":
4
- /*!********************!*\
5
- !*** fs (ignored) ***!
6
- \********************/
7
- /***/ (() => {
8
-
9
- /* (ignored) */
10
-
11
- /***/ })
12
-
13
- }]);
14
- //# sourceMappingURL=_e6ae.shogun-core.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_e6ae.shogun-core.js","mappings":";;;;;;;;AAAA,e","sources":["webpack://ShogunCore/ignored|D:\\shogun-2\\shogun-core\\ship\\examples|fs"],"sourcesContent":["/* (ignored) */"],"names":[],"sourceRoot":""}