shogun-core 5.2.0 → 5.2.2

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 (186) hide show
  1. package/README.md +145 -1143
  2. package/dist/browser/defaultVendors-node_modules_hpke_chacha20poly1305_esm_mod_js.shogun-core.js +1220 -0
  3. package/dist/browser/defaultVendors-node_modules_hpke_chacha20poly1305_esm_mod_js.shogun-core.js.map +1 -0
  4. package/dist/browser/defaultVendors-node_modules_hpke_hybridkem-x-wing_esm_mod_js.shogun-core.js +844 -0
  5. package/dist/browser/defaultVendors-node_modules_hpke_hybridkem-x-wing_esm_mod_js.shogun-core.js.map +1 -0
  6. package/dist/browser/defaultVendors-node_modules_mlkem_esm_mod_js.shogun-core.js +2335 -0
  7. package/dist/browser/defaultVendors-node_modules_mlkem_esm_mod_js.shogun-core.js.map +1 -0
  8. package/dist/browser/defaultVendors-node_modules_noble_ciphers_chacha_js.shogun-core.js +999 -0
  9. package/dist/browser/defaultVendors-node_modules_noble_ciphers_chacha_js.shogun-core.js.map +1 -0
  10. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js +1651 -0
  11. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js.map +1 -0
  12. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_edwards_js-node_modules_noble_curves_es-a82056.shogun-core.js +825 -0
  13. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_edwards_js-node_modules_noble_curves_es-a82056.shogun-core.js.map +1 -0
  14. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed25519_js.shogun-core.js +508 -0
  15. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed25519_js.shogun-core.js.map +1 -0
  16. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js +747 -0
  17. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js.map +1 -0
  18. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js +1608 -0
  19. package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js.map +1 -0
  20. package/dist/browser/defaultVendors-node_modules_noble_post-quantum_ml-dsa_js.shogun-core.js +2117 -0
  21. package/dist/browser/defaultVendors-node_modules_noble_post-quantum_ml-dsa_js.shogun-core.js.map +1 -0
  22. package/dist/browser/defaultVendors-node_modules_openpgp_dist_openpgp_min_mjs.shogun-core.js +86 -0
  23. package/dist/browser/defaultVendors-node_modules_openpgp_dist_openpgp_min_mjs.shogun-core.js.map +1 -0
  24. package/dist/browser/node_modules_hpke_ml-kem_esm_mod_js.shogun-core.js +539 -0
  25. package/dist/browser/node_modules_hpke_ml-kem_esm_mod_js.shogun-core.js.map +1 -0
  26. package/dist/browser/shogun-core.js +160386 -0
  27. package/dist/browser/shogun-core.js.map +1 -0
  28. package/dist/config/simplified-config.js +236 -0
  29. package/dist/core.js +329 -0
  30. package/dist/crypto/asymmetric.js +99 -0
  31. package/dist/crypto/double-ratchet.js +370 -0
  32. package/dist/crypto/file-encryption.js +213 -0
  33. package/dist/crypto/hashing.js +87 -0
  34. package/dist/crypto/index.js +34 -0
  35. package/dist/crypto/mls-codec.js +202 -0
  36. package/dist/crypto/mls.js +550 -0
  37. package/dist/crypto/pgp.js +390 -0
  38. package/dist/crypto/random-generation.js +341 -0
  39. package/dist/crypto/sframe.js +350 -0
  40. package/dist/crypto/signal-protocol.js +376 -0
  41. package/dist/crypto/symmetric.js +91 -0
  42. package/dist/crypto/types.js +2 -0
  43. package/dist/crypto/utils.js +140 -0
  44. package/dist/examples/auth-test.js +253 -0
  45. package/dist/examples/crypto-identity-example.js +151 -0
  46. package/dist/examples/crypto-working-test.js +83 -0
  47. package/dist/examples/double-ratchet-test.js +155 -0
  48. package/dist/examples/mls-advanced-example.js +294 -0
  49. package/dist/examples/mls-sframe-test.js +304 -0
  50. package/dist/examples/pgp-example.js +200 -0
  51. package/dist/examples/quick-auth-test.js +61 -0
  52. package/dist/examples/random-generation-test.js +151 -0
  53. package/dist/examples/signal-protocol-test.js +38 -0
  54. package/dist/examples/simple-api-test.js +114 -0
  55. package/dist/examples/simple-crypto-identity-example.js +84 -0
  56. package/dist/examples/timeout-test.js +227 -0
  57. package/dist/examples/zkproof-credentials-example.js +212 -0
  58. package/dist/examples/zkproof-example.js +201 -0
  59. package/dist/gundb/api.js +435 -0
  60. package/dist/gundb/crypto.js +283 -0
  61. package/dist/gundb/db.js +1946 -0
  62. package/dist/gundb/derive.js +232 -0
  63. package/dist/gundb/errors.js +76 -0
  64. package/dist/gundb/index.js +22 -0
  65. package/dist/gundb/rxjs.js +447 -0
  66. package/dist/gundb/types.js +5 -0
  67. package/dist/index.js +58 -0
  68. package/dist/interfaces/common.js +2 -0
  69. package/dist/interfaces/events.js +40 -0
  70. package/dist/interfaces/plugin.js +2 -0
  71. package/dist/interfaces/shogun.js +37 -0
  72. package/dist/managers/AuthManager.js +226 -0
  73. package/dist/managers/CoreInitializer.js +228 -0
  74. package/dist/managers/CryptoIdentityManager.js +366 -0
  75. package/dist/managers/EventManager.js +70 -0
  76. package/dist/managers/PluginManager.js +299 -0
  77. package/dist/plugins/base.js +50 -0
  78. package/dist/plugins/index.js +32 -0
  79. package/dist/plugins/nostr/index.js +20 -0
  80. package/dist/plugins/nostr/nostrConnector.js +419 -0
  81. package/dist/plugins/nostr/nostrConnectorPlugin.js +453 -0
  82. package/dist/plugins/nostr/nostrSigner.js +319 -0
  83. package/dist/plugins/nostr/types.js +2 -0
  84. package/dist/plugins/smartwallet/index.js +18 -0
  85. package/dist/plugins/smartwallet/smartWalletPlugin.js +511 -0
  86. package/dist/plugins/smartwallet/types.js +2 -0
  87. package/dist/plugins/web3/index.js +20 -0
  88. package/dist/plugins/web3/types.js +2 -0
  89. package/dist/plugins/web3/web3Connector.js +533 -0
  90. package/dist/plugins/web3/web3ConnectorPlugin.js +455 -0
  91. package/dist/plugins/web3/web3Signer.js +314 -0
  92. package/dist/plugins/webauthn/index.js +19 -0
  93. package/dist/plugins/webauthn/types.js +14 -0
  94. package/dist/plugins/webauthn/webauthn.js +496 -0
  95. package/dist/plugins/webauthn/webauthnPlugin.js +489 -0
  96. package/dist/plugins/webauthn/webauthnSigner.js +310 -0
  97. package/dist/plugins/zkproof/index.js +53 -0
  98. package/dist/plugins/zkproof/types.js +2 -0
  99. package/dist/plugins/zkproof/zkCredentials.js +213 -0
  100. package/dist/plugins/zkproof/zkProofConnector.js +198 -0
  101. package/dist/plugins/zkproof/zkProofPlugin.js +272 -0
  102. package/dist/storage/storage.js +145 -0
  103. package/dist/types/config/simplified-config.d.ts +114 -0
  104. package/dist/types/core.d.ts +305 -0
  105. package/dist/types/crypto/asymmetric.d.ts +6 -0
  106. package/dist/types/crypto/double-ratchet.d.ts +22 -0
  107. package/dist/types/crypto/file-encryption.d.ts +19 -0
  108. package/dist/types/crypto/hashing.d.ts +9 -0
  109. package/dist/types/crypto/index.d.ts +13 -0
  110. package/dist/types/crypto/mls-codec.d.ts +39 -0
  111. package/dist/types/crypto/mls.d.ts +130 -0
  112. package/dist/types/crypto/pgp.d.ts +95 -0
  113. package/dist/types/crypto/random-generation.d.ts +35 -0
  114. package/dist/types/crypto/sframe.d.ts +102 -0
  115. package/dist/types/crypto/signal-protocol.d.ts +26 -0
  116. package/dist/types/crypto/symmetric.d.ts +9 -0
  117. package/dist/types/crypto/types.d.ts +144 -0
  118. package/dist/types/crypto/utils.d.ts +22 -0
  119. package/dist/types/examples/auth-test.d.ts +8 -0
  120. package/dist/types/examples/crypto-identity-example.d.ts +5 -0
  121. package/dist/types/examples/crypto-working-test.d.ts +1 -0
  122. package/dist/types/examples/double-ratchet-test.d.ts +1 -0
  123. package/dist/types/examples/mls-advanced-example.d.ts +53 -0
  124. package/dist/types/examples/mls-sframe-test.d.ts +1 -0
  125. package/dist/types/examples/pgp-example.d.ts +75 -0
  126. package/dist/types/examples/quick-auth-test.d.ts +8 -0
  127. package/dist/types/examples/random-generation-test.d.ts +1 -0
  128. package/dist/types/examples/signal-protocol-test.d.ts +1 -0
  129. package/dist/types/examples/simple-api-test.d.ts +10 -0
  130. package/dist/types/examples/simple-crypto-identity-example.d.ts +6 -0
  131. package/dist/types/examples/timeout-test.d.ts +8 -0
  132. package/dist/types/examples/zkproof-credentials-example.d.ts +12 -0
  133. package/dist/types/examples/zkproof-example.d.ts +11 -0
  134. package/dist/types/gundb/api.d.ts +185 -0
  135. package/dist/types/gundb/crypto.d.ts +95 -0
  136. package/dist/types/gundb/db.d.ts +397 -0
  137. package/dist/types/gundb/derive.d.ts +21 -0
  138. package/dist/types/gundb/errors.d.ts +42 -0
  139. package/dist/types/gundb/index.d.ts +3 -0
  140. package/dist/types/gundb/rxjs.d.ts +110 -0
  141. package/dist/types/gundb/types.d.ts +255 -0
  142. package/dist/types/index.d.ts +16 -0
  143. package/dist/types/interfaces/common.d.ts +85 -0
  144. package/dist/types/interfaces/events.d.ts +131 -0
  145. package/dist/types/interfaces/plugin.d.ts +162 -0
  146. package/dist/types/interfaces/shogun.d.ts +208 -0
  147. package/dist/types/managers/AuthManager.d.ts +72 -0
  148. package/dist/types/managers/CoreInitializer.d.ts +40 -0
  149. package/dist/types/managers/CryptoIdentityManager.d.ts +102 -0
  150. package/dist/types/managers/EventManager.d.ts +49 -0
  151. package/dist/types/managers/PluginManager.d.ts +145 -0
  152. package/dist/types/plugins/base.d.ts +35 -0
  153. package/dist/types/plugins/index.d.ts +18 -0
  154. package/dist/types/plugins/nostr/index.d.ts +4 -0
  155. package/dist/types/plugins/nostr/nostrConnector.d.ts +119 -0
  156. package/dist/types/plugins/nostr/nostrConnectorPlugin.d.ts +163 -0
  157. package/dist/types/plugins/nostr/nostrSigner.d.ts +105 -0
  158. package/dist/types/plugins/nostr/types.d.ts +122 -0
  159. package/dist/types/plugins/smartwallet/index.d.ts +2 -0
  160. package/dist/types/plugins/smartwallet/smartWalletPlugin.d.ts +67 -0
  161. package/dist/types/plugins/smartwallet/types.d.ts +80 -0
  162. package/dist/types/plugins/web3/index.d.ts +4 -0
  163. package/dist/types/plugins/web3/types.d.ts +107 -0
  164. package/dist/types/plugins/web3/web3Connector.d.ts +129 -0
  165. package/dist/types/plugins/web3/web3ConnectorPlugin.d.ts +160 -0
  166. package/dist/types/plugins/web3/web3Signer.d.ts +114 -0
  167. package/dist/types/plugins/webauthn/index.d.ts +3 -0
  168. package/dist/types/plugins/webauthn/types.d.ts +183 -0
  169. package/dist/types/plugins/webauthn/webauthn.d.ts +129 -0
  170. package/dist/types/plugins/webauthn/webauthnPlugin.d.ts +179 -0
  171. package/dist/types/plugins/webauthn/webauthnSigner.d.ts +91 -0
  172. package/dist/types/plugins/zkproof/index.d.ts +48 -0
  173. package/dist/types/plugins/zkproof/types.d.ts +123 -0
  174. package/dist/types/plugins/zkproof/zkCredentials.d.ts +112 -0
  175. package/dist/types/plugins/zkproof/zkProofConnector.d.ts +46 -0
  176. package/dist/types/plugins/zkproof/zkProofPlugin.d.ts +76 -0
  177. package/dist/types/storage/storage.d.ts +51 -0
  178. package/dist/types/utils/errorHandler.d.ts +119 -0
  179. package/dist/types/utils/eventEmitter.d.ts +39 -0
  180. package/dist/types/utils/seedPhrase.d.ts +50 -0
  181. package/dist/types/utils/validation.d.ts +27 -0
  182. package/dist/utils/errorHandler.js +246 -0
  183. package/dist/utils/eventEmitter.js +79 -0
  184. package/dist/utils/seedPhrase.js +97 -0
  185. package/dist/utils/validation.js +81 -0
  186. package/package.json +10 -57
@@ -0,0 +1,299 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginManager = void 0;
4
+ /**
5
+ * Manages plugin registration, validation, and lifecycle
6
+ */
7
+ class PluginManager {
8
+ constructor(core) {
9
+ this.plugins = new Map();
10
+ this.core = core;
11
+ }
12
+ /**
13
+ * Register a plugin with the Shogun SDK
14
+ * @param plugin Plugin instance to register
15
+ * @throws Error if a plugin with the same name is already registered
16
+ */
17
+ register(plugin) {
18
+ try {
19
+ if (!plugin.name) {
20
+ if (typeof console !== "undefined" && console.error) {
21
+ console.error("Plugin registration failed: Plugin must have a name");
22
+ }
23
+ return;
24
+ }
25
+ if (this.plugins.has(plugin.name)) {
26
+ if (typeof console !== "undefined" && console.warn) {
27
+ console.warn(`Plugin "${plugin.name}" is already registered. Skipping.`);
28
+ }
29
+ return;
30
+ }
31
+ // Initialize plugin with core instance
32
+ plugin.initialize(this.core);
33
+ this.plugins.set(plugin.name, plugin);
34
+ this.core.emit("plugin:registered", {
35
+ name: plugin.name,
36
+ version: plugin.version || "unknown",
37
+ category: plugin._category || "unknown",
38
+ });
39
+ }
40
+ catch (error) {
41
+ if (typeof console !== "undefined" && console.error) {
42
+ console.error(`Error registering plugin "${plugin.name}":`, error);
43
+ }
44
+ }
45
+ }
46
+ /**
47
+ * Unregister a plugin from the Shogun SDK
48
+ * @param name Name of the plugin to unregister
49
+ */
50
+ unregister(name) {
51
+ try {
52
+ const plugin = this.plugins.get(name);
53
+ if (!plugin) {
54
+ if (typeof console !== "undefined" && console.warn) {
55
+ console.warn(`Plugin "${name}" not found for unregistration`);
56
+ }
57
+ return false;
58
+ }
59
+ // Destroy plugin if it has a destroy method
60
+ if (typeof plugin.destroy === "function") {
61
+ try {
62
+ plugin.destroy();
63
+ }
64
+ catch (destroyError) {
65
+ if (typeof console !== "undefined" && console.error) {
66
+ console.error(`Error destroying plugin "${name}":`, destroyError);
67
+ }
68
+ }
69
+ }
70
+ this.plugins.delete(name);
71
+ this.core.emit("plugin:unregistered", {
72
+ name: plugin.name,
73
+ });
74
+ return true;
75
+ }
76
+ catch (error) {
77
+ if (typeof console !== "undefined" && console.error) {
78
+ console.error(`Error unregistering plugin "${name}":`, error);
79
+ }
80
+ return false;
81
+ }
82
+ }
83
+ /**
84
+ * Retrieve a registered plugin by name
85
+ * @param name Name of the plugin
86
+ * @returns The requested plugin or undefined if not found
87
+ * @template T Type of the plugin or its public interface
88
+ */
89
+ getPlugin(name) {
90
+ if (!name || typeof name !== "string") {
91
+ if (typeof console !== "undefined" && console.warn) {
92
+ console.warn("Invalid plugin name provided to getPlugin");
93
+ }
94
+ return undefined;
95
+ }
96
+ const plugin = this.plugins.get(name);
97
+ if (!plugin) {
98
+ if (typeof console !== "undefined" && console.warn) {
99
+ console.warn(`Plugin "${name}" not found`);
100
+ }
101
+ return undefined;
102
+ }
103
+ return plugin;
104
+ }
105
+ /**
106
+ * Get information about all registered plugins
107
+ * @returns Array of plugin information objects
108
+ */
109
+ getPluginsInfo() {
110
+ const pluginsInfo = [];
111
+ this.plugins.forEach((plugin) => {
112
+ pluginsInfo.push({
113
+ name: plugin.name,
114
+ version: plugin.version || "unknown",
115
+ category: plugin._category,
116
+ description: plugin.description,
117
+ });
118
+ });
119
+ return pluginsInfo;
120
+ }
121
+ /**
122
+ * Get the total number of registered plugins
123
+ * @returns Number of registered plugins
124
+ */
125
+ getPluginCount() {
126
+ return this.plugins.size;
127
+ }
128
+ /**
129
+ * Check if all plugins are properly initialized
130
+ * @returns Object with initialization status for each plugin
131
+ */
132
+ getPluginsInitializationStatus() {
133
+ const status = {};
134
+ this.plugins.forEach((plugin, name) => {
135
+ try {
136
+ // Verifica se il plugin ha un metodo per controllare l'inizializzazione
137
+ if (typeof plugin.assertInitialized === "function") {
138
+ plugin.assertInitialized();
139
+ status[name] = { initialized: true };
140
+ }
141
+ else {
142
+ // Fallback: verifica se il plugin ha un riferimento al core
143
+ status[name] = {
144
+ initialized: !!plugin.core,
145
+ error: !plugin.core
146
+ ? "No core reference found"
147
+ : undefined,
148
+ };
149
+ }
150
+ }
151
+ catch (error) {
152
+ status[name] = {
153
+ initialized: false,
154
+ error: error instanceof Error ? error.message : String(error),
155
+ };
156
+ }
157
+ });
158
+ return status;
159
+ }
160
+ /**
161
+ * Validate plugin system integrity
162
+ * @returns Object with validation results
163
+ */
164
+ validatePluginSystem() {
165
+ const status = this.getPluginsInitializationStatus();
166
+ const totalPlugins = Object.keys(status).length;
167
+ const initializedPlugins = Object.values(status).filter((s) => s.initialized).length;
168
+ const failedPlugins = Object.entries(status)
169
+ .filter(([_, s]) => !s.initialized)
170
+ .map(([name, _]) => name);
171
+ const warnings = [];
172
+ if (totalPlugins === 0) {
173
+ warnings.push("No plugins registered");
174
+ }
175
+ if (failedPlugins.length > 0) {
176
+ warnings.push(`Failed plugins: ${failedPlugins.join(", ")}`);
177
+ }
178
+ return {
179
+ totalPlugins,
180
+ initializedPlugins,
181
+ failedPlugins,
182
+ warnings,
183
+ };
184
+ }
185
+ /**
186
+ * Attempt to reinitialize failed plugins
187
+ * @returns Object with reinitialization results
188
+ */
189
+ reinitializeFailedPlugins() {
190
+ const status = this.getPluginsInitializationStatus();
191
+ const failedPlugins = Object.entries(status)
192
+ .filter(([_, s]) => !s.initialized)
193
+ .map(([name, _]) => name);
194
+ const success = [];
195
+ const failed = [];
196
+ failedPlugins.forEach((pluginName) => {
197
+ try {
198
+ const plugin = this.plugins.get(pluginName);
199
+ if (!plugin) {
200
+ failed.push({ name: pluginName, error: "Plugin not found" });
201
+ return;
202
+ }
203
+ // Reinizializza il plugin
204
+ plugin.initialize(this.core);
205
+ success.push(pluginName);
206
+ }
207
+ catch (error) {
208
+ const errorMessage = error instanceof Error ? error.message : String(error);
209
+ failed.push({ name: pluginName, error: errorMessage });
210
+ if (typeof console !== "undefined" && console.error) {
211
+ console.error(`[PluginManager] Failed to reinitialize plugin ${pluginName}:`, error);
212
+ }
213
+ }
214
+ });
215
+ return { success, failed };
216
+ }
217
+ /**
218
+ * Check plugin compatibility with current ShogunCore version
219
+ * @returns Object with compatibility information
220
+ */
221
+ checkPluginCompatibility() {
222
+ const compatible = [];
223
+ const incompatible = [];
224
+ const unknown = [];
225
+ this.plugins.forEach((plugin) => {
226
+ const pluginInfo = {
227
+ name: plugin.name,
228
+ version: plugin.version || "unknown",
229
+ };
230
+ // Verifica se il plugin ha informazioni di compatibilità
231
+ if (typeof plugin.getCompatibilityInfo === "function") {
232
+ try {
233
+ const compatibilityInfo = plugin.getCompatibilityInfo();
234
+ if (compatibilityInfo && compatibilityInfo.compatible) {
235
+ compatible.push(pluginInfo);
236
+ }
237
+ else {
238
+ incompatible.push({
239
+ ...pluginInfo,
240
+ reason: compatibilityInfo?.reason || "Unknown compatibility issue",
241
+ });
242
+ }
243
+ }
244
+ catch (error) {
245
+ unknown.push(pluginInfo);
246
+ }
247
+ }
248
+ else {
249
+ // Se non ha informazioni di compatibilità, considera sconosciuto
250
+ unknown.push(pluginInfo);
251
+ }
252
+ });
253
+ return { compatible, incompatible, unknown };
254
+ }
255
+ /**
256
+ * Get comprehensive debug information about the plugin system
257
+ * @returns Complete plugin system debug information
258
+ */
259
+ getPluginSystemDebugInfo() {
260
+ const pluginsInfo = this.getPluginsInfo();
261
+ const initializationStatus = this.getPluginsInitializationStatus();
262
+ const plugins = pluginsInfo.map((info) => ({
263
+ ...info,
264
+ initialized: initializationStatus[info.name]?.initialized || false,
265
+ error: initializationStatus[info.name]?.error,
266
+ }));
267
+ return {
268
+ shogunCoreVersion: "^1.6.6",
269
+ totalPlugins: this.getPluginCount(),
270
+ plugins,
271
+ initializationStatus,
272
+ validation: this.validatePluginSystem(),
273
+ compatibility: this.checkPluginCompatibility(),
274
+ };
275
+ }
276
+ /**
277
+ * Check if a plugin is registered
278
+ * @param name Name of the plugin to check
279
+ * @returns true if the plugin is registered, false otherwise
280
+ */
281
+ hasPlugin(name) {
282
+ return this.plugins.has(name);
283
+ }
284
+ /**
285
+ * Get all plugins of a specific category
286
+ * @param category Category of plugins to filter
287
+ * @returns Array of plugins in the specified category
288
+ */
289
+ getPluginsByCategory(category) {
290
+ const result = [];
291
+ this.plugins.forEach((plugin) => {
292
+ if (plugin._category === category) {
293
+ result.push(plugin);
294
+ }
295
+ });
296
+ return result;
297
+ }
298
+ }
299
+ exports.PluginManager = PluginManager;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BasePlugin = void 0;
4
+ const eventEmitter_1 = require("../utils/eventEmitter");
5
+ /**
6
+ * Classe base per tutti i plugin di ShogunCore
7
+ * Fornisce funzionalità comuni e implementazione base dell'interfaccia ShogunPlugin
8
+ */
9
+ class BasePlugin extends eventEmitter_1.EventEmitter {
10
+ constructor() {
11
+ super(...arguments);
12
+ /** Riferimento all'istanza di ShogunCore */
13
+ this.core = null;
14
+ }
15
+ /**
16
+ * Inizializza il plugin con un'istanza di ShogunCore
17
+ * @param core Istanza di ShogunCore
18
+ */
19
+ initialize(core) {
20
+ this.core = core;
21
+ }
22
+ /**
23
+ * Distrugge il plugin e libera le risorse
24
+ */
25
+ destroy() {
26
+ try {
27
+ // Emetti evento di distruzione
28
+ this.emit("destroyed", {
29
+ name: this.name,
30
+ version: this.version,
31
+ });
32
+ this.core = null;
33
+ }
34
+ catch (error) {
35
+ console.error(`[${this.name}] Error during plugin destruction:`, error);
36
+ }
37
+ }
38
+ /**
39
+ * Verifica che il plugin sia stato inizializzato prima di usare il core
40
+ * @throws Error se il plugin non è stato inizializzato
41
+ * @returns L'istanza di ShogunCore non null
42
+ */
43
+ assertInitialized() {
44
+ if (!this.core) {
45
+ throw new Error(`Plugin ${this.name} not initialized`);
46
+ }
47
+ return this.core;
48
+ }
49
+ }
50
+ exports.BasePlugin = BasePlugin;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SmartWalletPlugin = exports.CredentialType = exports.ZkCredentials = exports.ZkProofPlugin = exports.ZkProofConnector = exports.NostrConnectorPlugin = exports.NostrConnector = exports.Web3ConnectorPlugin = exports.Web3Connector = exports.WebauthnPlugin = exports.Webauthn = exports.BasePlugin = void 0;
4
+ // Base plugin interface and types
5
+ var base_1 = require("./base");
6
+ Object.defineProperty(exports, "BasePlugin", { enumerable: true, get: function () { return base_1.BasePlugin; } });
7
+ // WebAuthn plugin exports
8
+ var webauthn_1 = require("./webauthn/webauthn");
9
+ Object.defineProperty(exports, "Webauthn", { enumerable: true, get: function () { return webauthn_1.Webauthn; } });
10
+ var webauthnPlugin_1 = require("./webauthn/webauthnPlugin");
11
+ Object.defineProperty(exports, "WebauthnPlugin", { enumerable: true, get: function () { return webauthnPlugin_1.WebauthnPlugin; } });
12
+ // Ethereum plugin exports
13
+ var web3Connector_1 = require("./web3/web3Connector");
14
+ Object.defineProperty(exports, "Web3Connector", { enumerable: true, get: function () { return web3Connector_1.Web3Connector; } });
15
+ var web3ConnectorPlugin_1 = require("./web3/web3ConnectorPlugin");
16
+ Object.defineProperty(exports, "Web3ConnectorPlugin", { enumerable: true, get: function () { return web3ConnectorPlugin_1.Web3ConnectorPlugin; } });
17
+ // Bitcoin plugin exports
18
+ var nostrConnector_1 = require("./nostr/nostrConnector");
19
+ Object.defineProperty(exports, "NostrConnector", { enumerable: true, get: function () { return nostrConnector_1.NostrConnector; } });
20
+ var nostrConnectorPlugin_1 = require("./nostr/nostrConnectorPlugin");
21
+ Object.defineProperty(exports, "NostrConnectorPlugin", { enumerable: true, get: function () { return nostrConnectorPlugin_1.NostrConnectorPlugin; } });
22
+ // ZK-Proof plugin exports
23
+ var zkProofConnector_1 = require("./zkproof/zkProofConnector");
24
+ Object.defineProperty(exports, "ZkProofConnector", { enumerable: true, get: function () { return zkProofConnector_1.ZkProofConnector; } });
25
+ var zkProofPlugin_1 = require("./zkproof/zkProofPlugin");
26
+ Object.defineProperty(exports, "ZkProofPlugin", { enumerable: true, get: function () { return zkProofPlugin_1.ZkProofPlugin; } });
27
+ var zkCredentials_1 = require("./zkproof/zkCredentials");
28
+ Object.defineProperty(exports, "ZkCredentials", { enumerable: true, get: function () { return zkCredentials_1.ZkCredentials; } });
29
+ Object.defineProperty(exports, "CredentialType", { enumerable: true, get: function () { return zkCredentials_1.CredentialType; } });
30
+ // Smart Wallet plugin exports
31
+ var smartWalletPlugin_1 = require("./smartwallet/smartWalletPlugin");
32
+ Object.defineProperty(exports, "SmartWalletPlugin", { enumerable: true, get: function () { return smartWalletPlugin_1.SmartWalletPlugin; } });
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./nostrConnectorPlugin"), exports);
18
+ __exportStar(require("./nostrConnector"), exports);
19
+ __exportStar(require("./nostrSigner"), exports);
20
+ __exportStar(require("./types"), exports);