shogun-core 6.2.4 → 6.3.0
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.
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js +93 -341
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_ed448_js.shogun-core.js.map +1 -1
- package/dist/browser/shogun-core.js +138979 -146789
- package/dist/browser/shogun-core.js.map +1 -1
- package/dist/{core.js → src/core.js} +167 -107
- package/dist/src/crypto/asymmetric.js +168 -0
- package/dist/src/crypto/double-ratchet.js +908 -0
- package/dist/src/crypto/file-encryption.js +352 -0
- package/dist/src/crypto/hashing.js +160 -0
- package/dist/src/crypto/index.js +18 -0
- package/dist/{crypto → src/crypto}/mls-codec.js +24 -34
- package/dist/src/crypto/mls.js +734 -0
- package/dist/src/crypto/pgp.js +619 -0
- package/dist/{crypto → src/crypto}/random-generation.js +125 -103
- package/dist/src/crypto/sframe.js +466 -0
- package/dist/src/crypto/signal-protocol.js +943 -0
- package/dist/src/crypto/symmetric.js +165 -0
- package/dist/src/crypto/utils.js +220 -0
- package/dist/src/examples/auth-test.js +535 -0
- package/dist/src/examples/crypto-identity-example.js +294 -0
- package/dist/src/examples/crypto-working-test.js +149 -0
- package/dist/src/examples/double-ratchet-test.js +240 -0
- package/dist/src/examples/mls-3-member-test.js +183 -0
- package/dist/src/examples/mls-multi-member.js +439 -0
- package/dist/src/examples/mls-sframe-test.js +491 -0
- package/dist/src/examples/mls-simple-test.js +122 -0
- package/dist/src/examples/pgp-example.js +354 -0
- package/dist/src/examples/random-generation-test.js +191 -0
- package/dist/src/examples/shogun-core-example.js +204 -0
- package/dist/src/examples/signal-protocol-test.js +82 -0
- package/dist/src/examples/zkproof-credentials-example.js +357 -0
- package/dist/src/examples/zkproof-example.js +357 -0
- package/dist/src/gundb/crypto.js +420 -0
- package/dist/src/gundb/db.js +728 -0
- package/dist/src/gundb/derive.js +327 -0
- package/dist/src/gundb/errors.js +115 -0
- package/dist/src/gundb/gun-es.js +8 -0
- package/dist/src/gundb/index.js +5 -0
- package/dist/{gundb → src/gundb}/rxjs.js +147 -111
- package/dist/{gundb → src/gundb}/types.js +1 -2
- package/dist/src/index.js +19 -0
- package/dist/src/interfaces/events.js +57 -0
- package/dist/{interfaces → src/interfaces}/shogun.js +4 -7
- package/dist/src/managers/AuthManager.js +301 -0
- package/dist/src/managers/CoreInitializer.js +304 -0
- package/dist/src/managers/CryptoIdentityManager.js +230 -0
- package/dist/{managers → src/managers}/EventManager.js +19 -21
- package/dist/{managers → src/managers}/PluginManager.js +123 -89
- package/dist/src/plugins/base.js +90 -0
- package/dist/src/plugins/index.js +17 -0
- package/dist/src/plugins/nostr/index.js +4 -0
- package/dist/src/plugins/nostr/nostrConnector.js +539 -0
- package/dist/src/plugins/nostr/nostrConnectorPlugin.js +663 -0
- package/dist/src/plugins/nostr/nostrSigner.js +414 -0
- package/dist/src/plugins/smartwallet/index.js +2 -0
- package/dist/src/plugins/smartwallet/smartWalletPlugin.js +824 -0
- package/dist/src/plugins/web3/index.js +4 -0
- package/dist/src/plugins/web3/types.js +1 -0
- package/dist/src/plugins/web3/web3Connector.js +738 -0
- package/dist/src/plugins/web3/web3ConnectorPlugin.js +639 -0
- package/dist/src/plugins/web3/web3Signer.js +432 -0
- package/dist/src/plugins/webauthn/index.js +3 -0
- package/dist/{plugins → src/plugins}/webauthn/types.js +2 -5
- package/dist/src/plugins/webauthn/webauthn.js +647 -0
- package/dist/src/plugins/webauthn/webauthnPlugin.js +689 -0
- package/dist/src/plugins/webauthn/webauthnSigner.js +419 -0
- package/dist/{plugins → src/plugins}/zkproof/index.js +3 -10
- package/dist/src/plugins/zkproof/types.js +1 -0
- package/dist/src/plugins/zkproof/zkCredentials.js +287 -0
- package/dist/src/plugins/zkproof/zkProofConnector.js +267 -0
- package/dist/src/plugins/zkproof/zkProofPlugin.js +405 -0
- package/dist/src/storage/storage.js +189 -0
- package/dist/src/utils/errorHandler.js +339 -0
- package/dist/{utils → src/utils}/eventEmitter.js +26 -26
- package/dist/{utils → src/utils}/seedPhrase.js +23 -32
- package/dist/{utils → src/utils}/validation.js +14 -21
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/{crypto → src/crypto}/double-ratchet.d.ts +1 -1
- package/dist/types/{crypto → src/crypto}/signal-protocol.d.ts +25 -0
- package/dist/types/{crypto → src/crypto}/types.d.ts +3 -1
- package/dist/types/src/examples/crypto-working-test.d.ts +1 -0
- package/dist/types/src/examples/double-ratchet-test.d.ts +1 -0
- package/dist/types/src/examples/mls-sframe-test.d.ts +1 -0
- package/dist/types/src/examples/random-generation-test.d.ts +1 -0
- package/dist/types/src/examples/signal-protocol-test.d.ts +1 -0
- package/dist/types/{gundb → src/gundb}/db.d.ts +14 -1
- package/dist/types/src/gundb/gun-es.d.ts +8 -0
- package/dist/types/src/gundb/min.d.ts +3 -0
- package/dist/types/{index.d.ts → src/index.d.ts} +1 -0
- package/package.json +14 -11
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js +0 -1651
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_abstract_curve_js-node_modules_noble_curves_esm_-1ce4ed.shogun-core.js.map +0 -1
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js +0 -1608
- package/dist/browser/defaultVendors-node_modules_noble_curves_esm_nist_js.shogun-core.js.map +0 -1
- package/dist/crypto/asymmetric.js +0 -99
- package/dist/crypto/double-ratchet.js +0 -392
- package/dist/crypto/file-encryption.js +0 -213
- package/dist/crypto/hashing.js +0 -87
- package/dist/crypto/index.js +0 -34
- package/dist/crypto/mls.js +0 -569
- package/dist/crypto/pgp.js +0 -390
- package/dist/crypto/sframe.js +0 -352
- package/dist/crypto/signal-protocol.js +0 -456
- package/dist/crypto/symmetric.js +0 -91
- package/dist/crypto/types.js +0 -2
- package/dist/crypto/utils.js +0 -140
- package/dist/examples/auth-test.js +0 -453
- package/dist/examples/crypto-identity-example.js +0 -196
- package/dist/examples/crypto-working-test.js +0 -83
- package/dist/examples/double-ratchet-test.js +0 -155
- package/dist/examples/mls-3-member-test.js +0 -97
- package/dist/examples/mls-multi-member.js +0 -153
- package/dist/examples/mls-sframe-test.js +0 -307
- package/dist/examples/mls-simple-test.js +0 -58
- package/dist/examples/pgp-example.js +0 -200
- package/dist/examples/random-generation-test.js +0 -151
- package/dist/examples/shogun-core-example.js +0 -150
- package/dist/examples/signal-protocol-test.js +0 -38
- package/dist/examples/zkproof-credentials-example.js +0 -217
- package/dist/examples/zkproof-example.js +0 -242
- package/dist/gundb/crypto.js +0 -306
- package/dist/gundb/db.js +0 -485
- package/dist/gundb/derive.js +0 -232
- package/dist/gundb/errors.js +0 -76
- package/dist/gundb/gun-es.js +0 -12
- package/dist/gundb/index.js +0 -21
- package/dist/gundb/min.js +0 -10
- package/dist/index.esm.js +0 -22
- package/dist/index.js +0 -47
- package/dist/interfaces/common.js +0 -2
- package/dist/interfaces/events.js +0 -40
- package/dist/interfaces/plugin.js +0 -2
- package/dist/managers/AuthManager.js +0 -226
- package/dist/managers/CoreInitializer.js +0 -250
- package/dist/managers/CryptoIdentityManager.js +0 -138
- package/dist/plugins/base.js +0 -50
- package/dist/plugins/index.js +0 -32
- package/dist/plugins/nostr/index.js +0 -20
- package/dist/plugins/nostr/nostrConnector.js +0 -419
- package/dist/plugins/nostr/nostrConnectorPlugin.js +0 -453
- package/dist/plugins/nostr/nostrSigner.js +0 -319
- package/dist/plugins/nostr/types.js +0 -2
- package/dist/plugins/smartwallet/index.js +0 -18
- package/dist/plugins/smartwallet/smartWalletPlugin.js +0 -511
- package/dist/plugins/smartwallet/types.js +0 -2
- package/dist/plugins/web3/index.js +0 -20
- package/dist/plugins/web3/types.js +0 -2
- package/dist/plugins/web3/web3Connector.js +0 -533
- package/dist/plugins/web3/web3ConnectorPlugin.js +0 -455
- package/dist/plugins/web3/web3Signer.js +0 -314
- package/dist/plugins/webauthn/index.js +0 -19
- package/dist/plugins/webauthn/webauthn.js +0 -496
- package/dist/plugins/webauthn/webauthnPlugin.js +0 -490
- package/dist/plugins/webauthn/webauthnSigner.js +0 -310
- package/dist/plugins/zkproof/types.js +0 -2
- package/dist/plugins/zkproof/zkCredentials.js +0 -216
- package/dist/plugins/zkproof/zkProofConnector.js +0 -198
- package/dist/plugins/zkproof/zkProofPlugin.js +0 -272
- package/dist/storage/storage.js +0 -145
- package/dist/types/gundb/gun-es.d.ts +0 -8
- package/dist/utils/errorHandler.js +0 -246
- /package/dist/{types/examples/crypto-working-test.d.ts → src/crypto/types.js} +0 -0
- /package/dist/{types/gundb/min.d.ts → src/gundb/min.js} +0 -0
- /package/dist/{types/examples/double-ratchet-test.d.ts → src/interfaces/common.js} +0 -0
- /package/dist/{types/examples/mls-sframe-test.d.ts → src/interfaces/plugin.js} +0 -0
- /package/dist/{types/examples/random-generation-test.d.ts → src/plugins/nostr/types.js} +0 -0
- /package/dist/{types/examples/signal-protocol-test.d.ts → src/plugins/smartwallet/types.js} +0 -0
- /package/dist/types/{core.d.ts → src/core.d.ts} +0 -0
- /package/dist/types/{crypto → src/crypto}/asymmetric.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/file-encryption.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/hashing.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/index.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/mls-codec.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/mls.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/pgp.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/random-generation.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/sframe.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/symmetric.d.ts +0 -0
- /package/dist/types/{crypto → src/crypto}/utils.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/auth-test.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/crypto-identity-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/mls-3-member-test.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/mls-multi-member.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/mls-simple-test.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/pgp-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/shogun-core-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/zkproof-credentials-example.d.ts +0 -0
- /package/dist/types/{examples → src/examples}/zkproof-example.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/crypto.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/derive.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/errors.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/index.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/rxjs.d.ts +0 -0
- /package/dist/types/{gundb → src/gundb}/types.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/common.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/events.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/plugin.d.ts +0 -0
- /package/dist/types/{interfaces → src/interfaces}/shogun.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/AuthManager.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/CoreInitializer.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/CryptoIdentityManager.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/EventManager.d.ts +0 -0
- /package/dist/types/{managers → src/managers}/PluginManager.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/base.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/nostrConnector.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/nostrConnectorPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/nostrSigner.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/nostr/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/smartwallet/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/smartwallet/smartWalletPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/smartwallet/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/web3Connector.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/web3ConnectorPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/web3/web3Signer.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/webauthn.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/webauthnPlugin.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/webauthn/webauthnSigner.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/index.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/types.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/zkCredentials.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/zkProofConnector.d.ts +0 -0
- /package/dist/types/{plugins → src/plugins}/zkproof/zkProofPlugin.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/storage.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/errorHandler.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/eventEmitter.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/seedPhrase.d.ts +0 -0
- /package/dist/types/{utils → src/utils}/validation.d.ts +0 -0
|
@@ -1,11 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
Object.
|
|
3
|
-
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
13
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
14
|
+
if (!m) return o;
|
|
15
|
+
var i = m.call(o), r, ar = [], e;
|
|
16
|
+
try {
|
|
17
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
18
|
+
}
|
|
19
|
+
catch (error) { e = { error: error }; }
|
|
20
|
+
finally {
|
|
21
|
+
try {
|
|
22
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
23
|
+
}
|
|
24
|
+
finally { if (e) throw e.error; }
|
|
25
|
+
}
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
4
28
|
/**
|
|
5
29
|
* Manages plugin registration, validation, and lifecycle
|
|
6
30
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
31
|
+
var PluginManager = /** @class */ (function () {
|
|
32
|
+
function PluginManager(core) {
|
|
9
33
|
this.plugins = new Map();
|
|
10
34
|
this.core = core;
|
|
11
35
|
}
|
|
@@ -14,7 +38,7 @@ class PluginManager {
|
|
|
14
38
|
* @param plugin Plugin instance to register
|
|
15
39
|
* @throws Error if a plugin with the same name is already registered
|
|
16
40
|
*/
|
|
17
|
-
register(plugin) {
|
|
41
|
+
PluginManager.prototype.register = function (plugin) {
|
|
18
42
|
try {
|
|
19
43
|
if (!plugin.name) {
|
|
20
44
|
if (typeof console !== "undefined" && console.error) {
|
|
@@ -24,7 +48,7 @@ class PluginManager {
|
|
|
24
48
|
}
|
|
25
49
|
if (this.plugins.has(plugin.name)) {
|
|
26
50
|
if (typeof console !== "undefined" && console.warn) {
|
|
27
|
-
console.warn(
|
|
51
|
+
console.warn("Plugin \"".concat(plugin.name, "\" is already registered. Skipping."));
|
|
28
52
|
}
|
|
29
53
|
return;
|
|
30
54
|
}
|
|
@@ -39,20 +63,20 @@ class PluginManager {
|
|
|
39
63
|
}
|
|
40
64
|
catch (error) {
|
|
41
65
|
if (typeof console !== "undefined" && console.error) {
|
|
42
|
-
console.error(
|
|
66
|
+
console.error("Error registering plugin \"".concat(plugin.name, "\":"), error);
|
|
43
67
|
}
|
|
44
68
|
}
|
|
45
|
-
}
|
|
69
|
+
};
|
|
46
70
|
/**
|
|
47
71
|
* Unregister a plugin from the Shogun SDK
|
|
48
72
|
* @param name Name of the plugin to unregister
|
|
49
73
|
*/
|
|
50
|
-
unregister(name) {
|
|
74
|
+
PluginManager.prototype.unregister = function (name) {
|
|
51
75
|
try {
|
|
52
|
-
|
|
76
|
+
var plugin = this.plugins.get(name);
|
|
53
77
|
if (!plugin) {
|
|
54
78
|
if (typeof console !== "undefined" && console.warn) {
|
|
55
|
-
console.warn(
|
|
79
|
+
console.warn("Plugin \"".concat(name, "\" not found for unregistration"));
|
|
56
80
|
}
|
|
57
81
|
return false;
|
|
58
82
|
}
|
|
@@ -63,7 +87,7 @@ class PluginManager {
|
|
|
63
87
|
}
|
|
64
88
|
catch (destroyError) {
|
|
65
89
|
if (typeof console !== "undefined" && console.error) {
|
|
66
|
-
console.error(
|
|
90
|
+
console.error("Error destroying plugin \"".concat(name, "\":"), destroyError);
|
|
67
91
|
}
|
|
68
92
|
}
|
|
69
93
|
}
|
|
@@ -75,40 +99,40 @@ class PluginManager {
|
|
|
75
99
|
}
|
|
76
100
|
catch (error) {
|
|
77
101
|
if (typeof console !== "undefined" && console.error) {
|
|
78
|
-
console.error(
|
|
102
|
+
console.error("Error unregistering plugin \"".concat(name, "\":"), error);
|
|
79
103
|
}
|
|
80
104
|
return false;
|
|
81
105
|
}
|
|
82
|
-
}
|
|
106
|
+
};
|
|
83
107
|
/**
|
|
84
108
|
* Retrieve a registered plugin by name
|
|
85
109
|
* @param name Name of the plugin
|
|
86
110
|
* @returns The requested plugin or undefined if not found
|
|
87
111
|
* @template T Type of the plugin or its public interface
|
|
88
112
|
*/
|
|
89
|
-
getPlugin(name) {
|
|
113
|
+
PluginManager.prototype.getPlugin = function (name) {
|
|
90
114
|
if (!name || typeof name !== "string") {
|
|
91
115
|
if (typeof console !== "undefined" && console.warn) {
|
|
92
116
|
console.warn("Invalid plugin name provided to getPlugin");
|
|
93
117
|
}
|
|
94
118
|
return undefined;
|
|
95
119
|
}
|
|
96
|
-
|
|
120
|
+
var plugin = this.plugins.get(name);
|
|
97
121
|
if (!plugin) {
|
|
98
122
|
if (typeof console !== "undefined" && console.warn) {
|
|
99
|
-
console.warn(
|
|
123
|
+
console.warn("Plugin \"".concat(name, "\" not found"));
|
|
100
124
|
}
|
|
101
125
|
return undefined;
|
|
102
126
|
}
|
|
103
127
|
return plugin;
|
|
104
|
-
}
|
|
128
|
+
};
|
|
105
129
|
/**
|
|
106
130
|
* Get information about all registered plugins
|
|
107
131
|
* @returns Array of plugin information objects
|
|
108
132
|
*/
|
|
109
|
-
getPluginsInfo() {
|
|
110
|
-
|
|
111
|
-
this.plugins.forEach((plugin)
|
|
133
|
+
PluginManager.prototype.getPluginsInfo = function () {
|
|
134
|
+
var pluginsInfo = [];
|
|
135
|
+
this.plugins.forEach(function (plugin) {
|
|
112
136
|
pluginsInfo.push({
|
|
113
137
|
name: plugin.name,
|
|
114
138
|
version: plugin.version || "unknown",
|
|
@@ -117,21 +141,21 @@ class PluginManager {
|
|
|
117
141
|
});
|
|
118
142
|
});
|
|
119
143
|
return pluginsInfo;
|
|
120
|
-
}
|
|
144
|
+
};
|
|
121
145
|
/**
|
|
122
146
|
* Get the total number of registered plugins
|
|
123
147
|
* @returns Number of registered plugins
|
|
124
148
|
*/
|
|
125
|
-
getPluginCount() {
|
|
149
|
+
PluginManager.prototype.getPluginCount = function () {
|
|
126
150
|
return this.plugins.size;
|
|
127
|
-
}
|
|
151
|
+
};
|
|
128
152
|
/**
|
|
129
153
|
* Check if all plugins are properly initialized
|
|
130
154
|
* @returns Object with initialization status for each plugin
|
|
131
155
|
*/
|
|
132
|
-
getPluginsInitializationStatus() {
|
|
133
|
-
|
|
134
|
-
this.plugins.forEach((plugin, name)
|
|
156
|
+
PluginManager.prototype.getPluginsInitializationStatus = function () {
|
|
157
|
+
var status = {};
|
|
158
|
+
this.plugins.forEach(function (plugin, name) {
|
|
135
159
|
try {
|
|
136
160
|
// Verifica se il plugin ha un metodo per controllare l'inizializzazione
|
|
137
161
|
if (typeof plugin.assertInitialized === "function") {
|
|
@@ -156,89 +180,99 @@ class PluginManager {
|
|
|
156
180
|
}
|
|
157
181
|
});
|
|
158
182
|
return status;
|
|
159
|
-
}
|
|
183
|
+
};
|
|
160
184
|
/**
|
|
161
185
|
* Validate plugin system integrity
|
|
162
186
|
* @returns Object with validation results
|
|
163
187
|
*/
|
|
164
|
-
validatePluginSystem() {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
.filter((
|
|
170
|
-
|
|
171
|
-
|
|
188
|
+
PluginManager.prototype.validatePluginSystem = function () {
|
|
189
|
+
var status = this.getPluginsInitializationStatus();
|
|
190
|
+
var totalPlugins = Object.keys(status).length;
|
|
191
|
+
var initializedPlugins = Object.values(status).filter(function (s) { return s.initialized; }).length;
|
|
192
|
+
var failedPlugins = Object.entries(status)
|
|
193
|
+
.filter(function (_a) {
|
|
194
|
+
var _b = __read(_a, 2), _ = _b[0], s = _b[1];
|
|
195
|
+
return !s.initialized;
|
|
196
|
+
})
|
|
197
|
+
.map(function (_a) {
|
|
198
|
+
var _b = __read(_a, 2), name = _b[0], _ = _b[1];
|
|
199
|
+
return name;
|
|
200
|
+
});
|
|
201
|
+
var warnings = [];
|
|
172
202
|
if (totalPlugins === 0) {
|
|
173
203
|
warnings.push("No plugins registered");
|
|
174
204
|
}
|
|
175
205
|
if (failedPlugins.length > 0) {
|
|
176
|
-
warnings.push(
|
|
206
|
+
warnings.push("Failed plugins: ".concat(failedPlugins.join(", ")));
|
|
177
207
|
}
|
|
178
208
|
return {
|
|
179
|
-
totalPlugins,
|
|
180
|
-
initializedPlugins,
|
|
181
|
-
failedPlugins,
|
|
182
|
-
warnings,
|
|
209
|
+
totalPlugins: totalPlugins,
|
|
210
|
+
initializedPlugins: initializedPlugins,
|
|
211
|
+
failedPlugins: failedPlugins,
|
|
212
|
+
warnings: warnings,
|
|
183
213
|
};
|
|
184
|
-
}
|
|
214
|
+
};
|
|
185
215
|
/**
|
|
186
216
|
* Attempt to reinitialize failed plugins
|
|
187
217
|
* @returns Object with reinitialization results
|
|
188
218
|
*/
|
|
189
|
-
reinitializeFailedPlugins() {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
219
|
+
PluginManager.prototype.reinitializeFailedPlugins = function () {
|
|
220
|
+
var _this = this;
|
|
221
|
+
var status = this.getPluginsInitializationStatus();
|
|
222
|
+
var failedPlugins = Object.entries(status)
|
|
223
|
+
.filter(function (_a) {
|
|
224
|
+
var _b = __read(_a, 2), _ = _b[0], s = _b[1];
|
|
225
|
+
return !s.initialized;
|
|
226
|
+
})
|
|
227
|
+
.map(function (_a) {
|
|
228
|
+
var _b = __read(_a, 2), name = _b[0], _ = _b[1];
|
|
229
|
+
return name;
|
|
230
|
+
});
|
|
231
|
+
var success = [];
|
|
232
|
+
var failed = [];
|
|
233
|
+
failedPlugins.forEach(function (pluginName) {
|
|
197
234
|
try {
|
|
198
|
-
|
|
235
|
+
var plugin = _this.plugins.get(pluginName);
|
|
199
236
|
if (!plugin) {
|
|
200
237
|
failed.push({ name: pluginName, error: "Plugin not found" });
|
|
201
238
|
return;
|
|
202
239
|
}
|
|
203
240
|
// Reinizializza il plugin
|
|
204
|
-
plugin.initialize(
|
|
241
|
+
plugin.initialize(_this.core);
|
|
205
242
|
success.push(pluginName);
|
|
206
243
|
}
|
|
207
244
|
catch (error) {
|
|
208
|
-
|
|
245
|
+
var errorMessage = error instanceof Error ? error.message : String(error);
|
|
209
246
|
failed.push({ name: pluginName, error: errorMessage });
|
|
210
247
|
if (typeof console !== "undefined" && console.error) {
|
|
211
|
-
console.error(
|
|
248
|
+
console.error("[PluginManager] Failed to reinitialize plugin ".concat(pluginName, ":"), error);
|
|
212
249
|
}
|
|
213
250
|
}
|
|
214
251
|
});
|
|
215
|
-
return { success, failed };
|
|
216
|
-
}
|
|
252
|
+
return { success: success, failed: failed };
|
|
253
|
+
};
|
|
217
254
|
/**
|
|
218
255
|
* Check plugin compatibility with current ShogunCore version
|
|
219
256
|
* @returns Object with compatibility information
|
|
220
257
|
*/
|
|
221
|
-
checkPluginCompatibility() {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
this.plugins.forEach((plugin)
|
|
226
|
-
|
|
258
|
+
PluginManager.prototype.checkPluginCompatibility = function () {
|
|
259
|
+
var compatible = [];
|
|
260
|
+
var incompatible = [];
|
|
261
|
+
var unknown = [];
|
|
262
|
+
this.plugins.forEach(function (plugin) {
|
|
263
|
+
var pluginInfo = {
|
|
227
264
|
name: plugin.name,
|
|
228
265
|
version: plugin.version || "unknown",
|
|
229
266
|
};
|
|
230
267
|
// Verifica se il plugin ha informazioni di compatibilità
|
|
231
268
|
if (typeof plugin.getCompatibilityInfo === "function") {
|
|
232
269
|
try {
|
|
233
|
-
|
|
270
|
+
var compatibilityInfo = plugin.getCompatibilityInfo();
|
|
234
271
|
if (compatibilityInfo && compatibilityInfo.compatible) {
|
|
235
272
|
compatible.push(pluginInfo);
|
|
236
273
|
}
|
|
237
274
|
else {
|
|
238
|
-
incompatible.push({
|
|
239
|
-
...pluginInfo,
|
|
240
|
-
reason: compatibilityInfo?.reason || "Unknown compatibility issue",
|
|
241
|
-
});
|
|
275
|
+
incompatible.push(__assign(__assign({}, pluginInfo), { reason: (compatibilityInfo === null || compatibilityInfo === void 0 ? void 0 : compatibilityInfo.reason) || "Unknown compatibility issue" }));
|
|
242
276
|
}
|
|
243
277
|
}
|
|
244
278
|
catch (error) {
|
|
@@ -250,50 +284,50 @@ class PluginManager {
|
|
|
250
284
|
unknown.push(pluginInfo);
|
|
251
285
|
}
|
|
252
286
|
});
|
|
253
|
-
return { compatible, incompatible, unknown };
|
|
254
|
-
}
|
|
287
|
+
return { compatible: compatible, incompatible: incompatible, unknown: unknown };
|
|
288
|
+
};
|
|
255
289
|
/**
|
|
256
290
|
* Get comprehensive debug information about the plugin system
|
|
257
291
|
* @returns Complete plugin system debug information
|
|
258
292
|
*/
|
|
259
|
-
getPluginSystemDebugInfo() {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
initialized: initializationStatus[info.name]
|
|
265
|
-
|
|
266
|
-
}));
|
|
293
|
+
PluginManager.prototype.getPluginSystemDebugInfo = function () {
|
|
294
|
+
var pluginsInfo = this.getPluginsInfo();
|
|
295
|
+
var initializationStatus = this.getPluginsInitializationStatus();
|
|
296
|
+
var plugins = pluginsInfo.map(function (info) {
|
|
297
|
+
var _a, _b;
|
|
298
|
+
return (__assign(__assign({}, info), { initialized: ((_a = initializationStatus[info.name]) === null || _a === void 0 ? void 0 : _a.initialized) || false, error: (_b = initializationStatus[info.name]) === null || _b === void 0 ? void 0 : _b.error }));
|
|
299
|
+
});
|
|
267
300
|
return {
|
|
268
301
|
shogunCoreVersion: "^1.6.6",
|
|
269
302
|
totalPlugins: this.getPluginCount(),
|
|
270
|
-
plugins,
|
|
271
|
-
initializationStatus,
|
|
303
|
+
plugins: plugins,
|
|
304
|
+
initializationStatus: initializationStatus,
|
|
272
305
|
validation: this.validatePluginSystem(),
|
|
273
306
|
compatibility: this.checkPluginCompatibility(),
|
|
274
307
|
};
|
|
275
|
-
}
|
|
308
|
+
};
|
|
276
309
|
/**
|
|
277
310
|
* Check if a plugin is registered
|
|
278
311
|
* @param name Name of the plugin to check
|
|
279
312
|
* @returns true if the plugin is registered, false otherwise
|
|
280
313
|
*/
|
|
281
|
-
hasPlugin(name) {
|
|
314
|
+
PluginManager.prototype.hasPlugin = function (name) {
|
|
282
315
|
return this.plugins.has(name);
|
|
283
|
-
}
|
|
316
|
+
};
|
|
284
317
|
/**
|
|
285
318
|
* Get all plugins of a specific category
|
|
286
319
|
* @param category Category of plugins to filter
|
|
287
320
|
* @returns Array of plugins in the specified category
|
|
288
321
|
*/
|
|
289
|
-
getPluginsByCategory(category) {
|
|
290
|
-
|
|
291
|
-
this.plugins.forEach((plugin)
|
|
322
|
+
PluginManager.prototype.getPluginsByCategory = function (category) {
|
|
323
|
+
var result = [];
|
|
324
|
+
this.plugins.forEach(function (plugin) {
|
|
292
325
|
if (plugin._category === category) {
|
|
293
326
|
result.push(plugin);
|
|
294
327
|
}
|
|
295
328
|
});
|
|
296
329
|
return result;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
|
|
330
|
+
};
|
|
331
|
+
return PluginManager;
|
|
332
|
+
}());
|
|
333
|
+
export { PluginManager };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
17
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
18
|
+
if (!m) return o;
|
|
19
|
+
var i = m.call(o), r, ar = [], e;
|
|
20
|
+
try {
|
|
21
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
22
|
+
}
|
|
23
|
+
catch (error) { e = { error: error }; }
|
|
24
|
+
finally {
|
|
25
|
+
try {
|
|
26
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
27
|
+
}
|
|
28
|
+
finally { if (e) throw e.error; }
|
|
29
|
+
}
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
33
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
34
|
+
if (ar || !(i in from)) {
|
|
35
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
36
|
+
ar[i] = from[i];
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
40
|
+
};
|
|
41
|
+
import { EventEmitter } from "../utils/eventEmitter.js";
|
|
42
|
+
/**
|
|
43
|
+
* Classe base per tutti i plugin di ShogunCore
|
|
44
|
+
* Fornisce funzionalità comuni e implementazione base dell'interfaccia ShogunPlugin
|
|
45
|
+
*/
|
|
46
|
+
var BasePlugin = /** @class */ (function (_super) {
|
|
47
|
+
__extends(BasePlugin, _super);
|
|
48
|
+
function BasePlugin() {
|
|
49
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
50
|
+
/** Riferimento all'istanza di ShogunCore */
|
|
51
|
+
_this.core = null;
|
|
52
|
+
return _this;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Inizializza il plugin con un'istanza di ShogunCore
|
|
56
|
+
* @param core Istanza di ShogunCore
|
|
57
|
+
*/
|
|
58
|
+
BasePlugin.prototype.initialize = function (core) {
|
|
59
|
+
this.core = core;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Distrugge il plugin e libera le risorse
|
|
63
|
+
*/
|
|
64
|
+
BasePlugin.prototype.destroy = function () {
|
|
65
|
+
try {
|
|
66
|
+
// Emetti evento di distruzione
|
|
67
|
+
this.emit("destroyed", {
|
|
68
|
+
name: this.name,
|
|
69
|
+
version: this.version,
|
|
70
|
+
});
|
|
71
|
+
this.core = null;
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.error("[".concat(this.name, "] Error during plugin destruction:"), error);
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Verifica che il plugin sia stato inizializzato prima di usare il core
|
|
79
|
+
* @throws Error se il plugin non è stato inizializzato
|
|
80
|
+
* @returns L'istanza di ShogunCore non null
|
|
81
|
+
*/
|
|
82
|
+
BasePlugin.prototype.assertInitialized = function () {
|
|
83
|
+
if (!this.core) {
|
|
84
|
+
throw new Error("Plugin ".concat(this.name, " not initialized"));
|
|
85
|
+
}
|
|
86
|
+
return this.core;
|
|
87
|
+
};
|
|
88
|
+
return BasePlugin;
|
|
89
|
+
}(EventEmitter));
|
|
90
|
+
export { BasePlugin };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Base plugin interface and types
|
|
2
|
+
export { BasePlugin } from "./base.js";
|
|
3
|
+
// WebAuthn plugin exports
|
|
4
|
+
export { Webauthn } from "./webauthn/webauthn.js";
|
|
5
|
+
export { WebauthnPlugin } from "./webauthn/webauthnPlugin.js";
|
|
6
|
+
// Ethereum plugin exports
|
|
7
|
+
export { Web3Connector } from "./web3/web3Connector.js";
|
|
8
|
+
export { Web3ConnectorPlugin } from "./web3/web3ConnectorPlugin.js";
|
|
9
|
+
// Bitcoin plugin exports
|
|
10
|
+
export { NostrConnector } from "./nostr/nostrConnector.js";
|
|
11
|
+
export { NostrConnectorPlugin } from "./nostr/nostrConnectorPlugin.js";
|
|
12
|
+
// ZK-Proof plugin exports
|
|
13
|
+
export { ZkProofConnector } from "./zkproof/zkProofConnector.js";
|
|
14
|
+
export { ZkProofPlugin } from "./zkproof/zkProofPlugin.js";
|
|
15
|
+
export { ZkCredentials, CredentialType } from "./zkproof/zkCredentials.js";
|
|
16
|
+
// Smart Wallet plugin exports
|
|
17
|
+
export { SmartWalletPlugin } from "./smartwallet/smartWalletPlugin.js";
|