shogun-core 1.2.4 → 1.2.6

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.
@@ -173,15 +173,6 @@ class NostrConnector extends eventEmitter_1.EventEmitter {
173
173
  throw error;
174
174
  }
175
175
  }
176
- /**
177
- * Check if Alby extension is available
178
- * @deprecated Alby support is deprecated, use Nostr instead
179
- */
180
- isAlbyAvailable() {
181
- (0, logger_1.logWarn)("Alby support is deprecated, use Nostr instead");
182
- // Return false to encourage using Nostr
183
- return false;
184
- }
185
176
  /**
186
177
  * Check if Nostr extension is available
187
178
  */
@@ -7,43 +7,43 @@ const logger_1 = require("../../utils/logger");
7
7
  const ethers_1 = require("ethers");
8
8
  const errorHandler_1 = require("../../utils/errorHandler");
9
9
  /**
10
- * Plugin per la gestione delle funzionalità MetaMask in ShogunCore
10
+ * Plugin per la gestione delle funzionalità Web3 in ShogunCore
11
11
  */
12
12
  class Web3ConnectorPlugin extends base_1.BasePlugin {
13
13
  name = "web3";
14
14
  version = "1.0.0";
15
15
  description = "Provides Ethereum wallet connection and authentication for ShogunCore";
16
- metamask = null;
16
+ Web3 = null;
17
17
  /**
18
18
  * @inheritdoc
19
19
  */
20
20
  initialize(core) {
21
21
  super.initialize(core);
22
- // Inizializziamo il modulo MetaMask
23
- this.metamask = new web3Connector_1.Web3Connector();
24
- (0, logger_1.log)("MetaMask plugin initialized");
22
+ // Inizializziamo il modulo Web3
23
+ this.Web3 = new web3Connector_1.Web3Connector();
24
+ (0, logger_1.log)("Web3 plugin initialized");
25
25
  }
26
26
  /**
27
27
  * @inheritdoc
28
28
  */
29
29
  destroy() {
30
- if (this.metamask) {
31
- this.metamask.cleanup();
30
+ if (this.Web3) {
31
+ this.Web3.cleanup();
32
32
  }
33
- this.metamask = null;
33
+ this.Web3 = null;
34
34
  super.destroy();
35
- (0, logger_1.log)("MetaMask plugin destroyed");
35
+ (0, logger_1.log)("Web3 plugin destroyed");
36
36
  }
37
37
  /**
38
- * Assicura che il modulo MetaMask sia inizializzato
38
+ * Assicura che il modulo Web3 sia inizializzato
39
39
  * @private
40
40
  */
41
41
  assertMetaMask() {
42
42
  this.assertInitialized();
43
- if (!this.metamask) {
44
- throw new Error("MetaMask module not initialized");
43
+ if (!this.Web3) {
44
+ throw new Error("Web3 module not initialized");
45
45
  }
46
- return this.metamask;
46
+ return this.Web3;
47
47
  }
48
48
  /**
49
49
  * @inheritdoc
@@ -101,59 +101,59 @@ class Web3ConnectorPlugin extends base_1.BasePlugin {
101
101
  return this.assertMetaMask().verifySignature(message, signature);
102
102
  }
103
103
  /**
104
- * Login con MetaMask
104
+ * Login con Web3
105
105
  * @param address - Indirizzo Ethereum
106
106
  * @returns {Promise<AuthResult>} Risultato dell'autenticazione
107
- * @description Autentica l'utente usando le credenziali del wallet MetaMask dopo la verifica della firma
107
+ * @description Autentica l'utente usando le credenziali del wallet Web3 dopo la verifica della firma
108
108
  */
109
109
  async login(address) {
110
- (0, logger_1.log)("Login with MetaMask");
110
+ (0, logger_1.log)("Login with Web3");
111
111
  try {
112
112
  const core = this.assertInitialized();
113
- (0, logger_1.log)(`MetaMask login attempt for address: ${address}`);
113
+ (0, logger_1.log)(`Web3 login attempt for address: ${address}`);
114
114
  if (!address) {
115
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.VALIDATION, "ADDRESS_REQUIRED", "Ethereum address required for MetaMask login");
115
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.VALIDATION, "ADDRESS_REQUIRED", "Ethereum address required for Web3 login");
116
116
  }
117
117
  if (!this.isAvailable()) {
118
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.ENVIRONMENT, "METAMASK_UNAVAILABLE", "MetaMask is not available in the browser");
118
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.ENVIRONMENT, "WEB3_UNAVAILABLE", "Web3 is not available in the browser");
119
119
  }
120
- (0, logger_1.log)("Generating credentials for MetaMask login...");
120
+ (0, logger_1.log)("Generating credentials for Web3 login...");
121
121
  const credentials = await this.generateCredentials(address);
122
122
  if (!credentials?.username ||
123
123
  !credentials?.password ||
124
124
  !credentials.signature ||
125
125
  !credentials.message) {
126
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "CREDENTIAL_GENERATION_FAILED", "MetaMask credentials not generated correctly or signature missing");
126
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "CREDENTIAL_GENERATION_FAILED", "Web3 credentials not generated correctly or signature missing");
127
127
  }
128
128
  (0, logger_1.log)(`Credentials generated successfully. Username: ${credentials.username}`);
129
- (0, logger_1.log)("Verifying MetaMask signature...");
129
+ (0, logger_1.log)("Verifying Web3 signature...");
130
130
  const recoveredAddress = ethers_1.ethers.verifyMessage(credentials.message, credentials.signature);
131
131
  if (recoveredAddress.toLowerCase() !== address.toLowerCase()) {
132
132
  (0, logger_1.logError)(`Signature verification failed. Expected: ${address}, Got: ${recoveredAddress}`);
133
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.SECURITY, "SIGNATURE_VERIFICATION_FAILED", "MetaMask signature verification failed. Address mismatch.");
133
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.SECURITY, "SIGNATURE_VERIFICATION_FAILED", "Web3 signature verification failed. Address mismatch.");
134
134
  }
135
- (0, logger_1.log)("MetaMask signature verified successfully.");
135
+ (0, logger_1.log)("Web3 signature verified successfully.");
136
136
  // Set authentication method to web3 before login
137
137
  core.setAuthMethod("web3");
138
138
  // Use core's login method with direct GunDB authentication
139
139
  (0, logger_1.log)("Logging in using core login method...");
140
140
  const loginResult = await core.login(credentials.username, credentials.password);
141
141
  if (!loginResult.success) {
142
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "METAMASK_LOGIN_FAILED", loginResult.error || "Failed to log in with MetaMask credentials");
142
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "WEB3_LOGIN_FAILED", loginResult.error || "Failed to log in with Web3 credentials");
143
143
  }
144
144
  // Emit login event
145
145
  core.emit("auth:login", {
146
146
  userPub: loginResult.userPub,
147
147
  username: credentials.username,
148
- method: "metamask",
148
+ method: "web3",
149
149
  });
150
150
  return loginResult;
151
151
  }
152
152
  catch (error) {
153
153
  // Handle both ShogunError and generic errors
154
154
  const errorType = error?.type || errorHandler_1.ErrorType.AUTHENTICATION;
155
- const errorCode = error?.code || "METAMASK_LOGIN_ERROR";
156
- const errorMessage = error?.message || "Unknown error during MetaMask login";
155
+ const errorCode = error?.code || "WEB3_LOGIN_ERROR";
156
+ const errorMessage = error?.message || "Unknown error during Web3 login";
157
157
  const handledError = errorHandler_1.ErrorHandler.handle(errorType, errorCode, errorMessage, error);
158
158
  return {
159
159
  success: false,
@@ -162,59 +162,59 @@ class Web3ConnectorPlugin extends base_1.BasePlugin {
162
162
  }
163
163
  }
164
164
  /**
165
- * Registra un nuovo utente con MetaMask
165
+ * Registra un nuovo utente con Web3
166
166
  * @param address - Indirizzo Ethereum
167
167
  * @returns {Promise<AuthResult>} Risultato della registrazione
168
- * @description Crea un nuovo account utente usando le credenziali del wallet MetaMask dopo la verifica della firma
168
+ * @description Crea un nuovo account utente usando le credenziali del wallet Web3 dopo la verifica della firma
169
169
  */
170
170
  async signUp(address) {
171
- (0, logger_1.log)("Sign up with MetaMask");
171
+ (0, logger_1.log)("Sign up with Web3");
172
172
  try {
173
173
  const core = this.assertInitialized();
174
- (0, logger_1.log)(`MetaMask registration attempt for address: ${address}`);
174
+ (0, logger_1.log)(`Web3 registration attempt for address: ${address}`);
175
175
  if (!address) {
176
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.VALIDATION, "ADDRESS_REQUIRED", "Ethereum address required for MetaMask registration");
176
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.VALIDATION, "ADDRESS_REQUIRED", "Ethereum address required for Web3 registration");
177
177
  }
178
178
  if (!this.isAvailable()) {
179
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.ENVIRONMENT, "METAMASK_UNAVAILABLE", "MetaMask is not available in the browser");
179
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.ENVIRONMENT, "WEB3_UNAVAILABLE", "Web3 is not available in the browser");
180
180
  }
181
- (0, logger_1.log)("Generating credentials for MetaMask registration...");
181
+ (0, logger_1.log)("Generating credentials for Web3 registration...");
182
182
  const credentials = await this.generateCredentials(address);
183
183
  if (!credentials?.username ||
184
184
  !credentials?.password ||
185
185
  !credentials.signature ||
186
186
  !credentials.message) {
187
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "CREDENTIAL_GENERATION_FAILED", "MetaMask credentials not generated correctly or signature missing");
187
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "CREDENTIAL_GENERATION_FAILED", "Web3 credentials not generated correctly or signature missing");
188
188
  }
189
189
  (0, logger_1.log)(`Credentials generated successfully. Username: ${credentials.username}`);
190
- (0, logger_1.log)("Verifying MetaMask signature...");
190
+ (0, logger_1.log)("Verifying Web3 signature...");
191
191
  const recoveredAddress = ethers_1.ethers.verifyMessage(credentials.message, credentials.signature);
192
192
  if (recoveredAddress.toLowerCase() !== address.toLowerCase()) {
193
193
  (0, logger_1.logError)(`Signature verification failed. Expected: ${address}, Got: ${recoveredAddress}`);
194
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.SECURITY, "SIGNATURE_VERIFICATION_FAILED", "MetaMask signature verification failed. Address mismatch.");
194
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.SECURITY, "SIGNATURE_VERIFICATION_FAILED", "Web3 signature verification failed. Address mismatch.");
195
195
  }
196
- (0, logger_1.log)("MetaMask signature verified successfully.");
196
+ (0, logger_1.log)("Web3 signature verified successfully.");
197
197
  // Set authentication method to web3 before signup
198
198
  core.setAuthMethod("web3");
199
199
  // Use core's signUp method with direct GunDB authentication
200
200
  (0, logger_1.log)("Signing up using core signUp method...");
201
201
  const signUpResult = await core.signUp(credentials.username, credentials.password);
202
202
  if (!signUpResult.success) {
203
- throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "METAMASK_SIGNUP_FAILED", signUpResult.error || "Failed to sign up with MetaMask credentials");
203
+ throw (0, errorHandler_1.createError)(errorHandler_1.ErrorType.AUTHENTICATION, "WEB3_SIGNUP_FAILED", signUpResult.error || "Failed to sign up with Web3 credentials");
204
204
  }
205
205
  // Emit signup event
206
206
  core.emit("auth:signup", {
207
207
  userPub: signUpResult.userPub,
208
208
  username: credentials.username,
209
- method: "metamask",
209
+ method: "web3",
210
210
  });
211
211
  return signUpResult;
212
212
  }
213
213
  catch (error) {
214
214
  // Handle both ShogunError and generic errors
215
215
  const errorType = error?.type || errorHandler_1.ErrorType.AUTHENTICATION;
216
- const errorCode = error?.code || "METAMASK_SIGNUP_ERROR";
217
- const errorMessage = error?.message || "Unknown error during MetaMask registration";
216
+ const errorCode = error?.code || "WEB3_SIGNUP_ERROR";
217
+ const errorMessage = error?.message || "Unknown error during Web3 registration";
218
218
  const handledError = errorHandler_1.ErrorHandler.handle(errorType, errorCode, errorMessage, error);
219
219
  return {
220
220
  success: false,
@@ -222,19 +222,5 @@ class Web3ConnectorPlugin extends base_1.BasePlugin {
222
222
  };
223
223
  }
224
224
  }
225
- /**
226
- * Legacy method for MetaMask login - use login() instead
227
- * @deprecated Use login(address) instead
228
- */
229
- async loginWithMetaMask(address) {
230
- return this.login(address);
231
- }
232
- /**
233
- * Legacy method for MetaMask signup - use signUp() instead
234
- * @deprecated Use signUp(address) instead
235
- */
236
- async signUpWithMetaMask(address) {
237
- return this.signUp(address);
238
- }
239
225
  }
240
226
  exports.Web3ConnectorPlugin = Web3ConnectorPlugin;
@@ -408,24 +408,6 @@ class Webauthn extends eventEmitter_1.EventEmitter {
408
408
  };
409
409
  }
410
410
  }
411
- /**
412
- * Saves credential to GunDB
413
- */
414
- async saveToGun(username, credential) {
415
- if (this.gunInstance) {
416
- try {
417
- await this.gunInstance.get(`webauthn_${username}`).put({
418
- credentialId: credential.id,
419
- type: credential.type,
420
- timestamp: Date.now(),
421
- });
422
- }
423
- catch (error) {
424
- (0, logger_1.logError)("Error saving credentials to Gun:", error);
425
- }
426
- }
427
- // No action if gunInstance is not available
428
- }
429
411
  /**
430
412
  * Removes device credentials
431
413
  */
@@ -109,8 +109,6 @@ class WebauthnPlugin extends base_1.BasePlugin {
109
109
  (0, logger_1.log)(`WebAuthn login completed successfully for user: ${username}`);
110
110
  return {
111
111
  ...loginResult,
112
- username,
113
- credentialId: assertionResult.credentialId,
114
112
  };
115
113
  }
116
114
  else {
@@ -168,8 +166,6 @@ class WebauthnPlugin extends base_1.BasePlugin {
168
166
  });
169
167
  return {
170
168
  ...signupResult,
171
- username,
172
- credentialId: attestationResult.credentialId,
173
169
  };
174
170
  }
175
171
  else {
@@ -185,19 +181,5 @@ class WebauthnPlugin extends base_1.BasePlugin {
185
181
  };
186
182
  }
187
183
  }
188
- /**
189
- * Legacy method for WebAuthn login - use login() instead
190
- * @deprecated Use login(username) instead
191
- */
192
- async loginWithWebAuthn(username) {
193
- return this.login(username);
194
- }
195
- /**
196
- * Legacy method for WebAuthn signup - use signUp() instead
197
- * @deprecated Use signUp(username) instead
198
- */
199
- async signUpWithWebAuthn(username) {
200
- return this.signUp(username);
201
- }
202
184
  }
203
185
  exports.WebauthnPlugin = WebauthnPlugin;
@@ -1,4 +1,4 @@
1
- import { GunDB } from "./gundb/gun";
1
+ import { GunDB } from "./gundb";
2
2
  import { GunRxJS } from "./gundb/rxjs-integration";
3
3
  import { ShogunError } from "./utils/errorHandler";
4
4
  import { ShogunStorage } from "./storage/storage";
@@ -23,7 +23,9 @@ export type * from "./contracts/utils";
23
23
  export type * from "./types/plugin";
24
24
  export type * from "./utils/errorHandler";
25
25
  export * from "./types/shogun";
26
- export { GunDB } from "./gundb/gun";
26
+ export { GunDB } from "./gundb";
27
+ export { derive } from "./gundb";
28
+ export type { DeriveOptions } from "./gundb";
27
29
  export { Web3Connector } from "./plugins/web3/web3Connector";
28
30
  export { Webauthn } from "./plugins/webauthn/webauthn";
29
31
  export { ShogunStorage } from "./storage/storage";
@@ -0,0 +1,6 @@
1
+ export interface DeriveOptions {
2
+ includeSecp256k1Bitcoin?: boolean;
3
+ includeSecp256k1Ethereum?: boolean;
4
+ includeP256?: boolean;
5
+ }
6
+ export default function (pwd: any, extra: any, options?: DeriveOptions): Promise<any>;
@@ -0,0 +1,8 @@
1
+ import { Gun, SEA } from "./min";
2
+ import "gun/lib/then";
3
+ import "gun/lib/radix";
4
+ import "gun/lib/radisk";
5
+ import "gun/lib/store";
6
+ import "gun/lib/rindexed";
7
+ import "gun/lib/webrtc";
8
+ export { Gun, SEA };
@@ -0,0 +1,3 @@
1
+ import Gun from "gun/gun";
2
+ import { default as SEA } from "gun/sea.js";
3
+ export { Gun, SEA };
@@ -1 +1,5 @@
1
- export { GunDB } from "./gun";
1
+ export { GunDB } from "./instance";
2
+ export { Gun, SEA } from "./gun-es/gun-es";
3
+ export { default as derive } from "./derive";
4
+ export type { DeriveOptions } from "./derive";
5
+ export { getId, getPub, getTargetPub, getUUID, getSet, qs, getIndexedObjectFromArray, getArrayFromIndexedObject, app_scoped, } from "./utils";
@@ -9,7 +9,7 @@ import { GunRxJS } from "./rxjs-integration";
9
9
  import * as GunErrors from "./errors";
10
10
  import * as crypto from "./crypto";
11
11
  import * as utils from "./utils";
12
- import "gun/sea";
12
+ import { DeriveOptions } from "./derive";
13
13
  declare class GunDB {
14
14
  gun: IGunInstance<any>;
15
15
  user: IGunUserInstance<any> | null;
@@ -67,6 +67,13 @@ declare class GunDB {
67
67
  * @returns Function to unsubscribe the callback
68
68
  */
69
69
  onAuth(callback: (user: any) => void): () => void;
70
+ /**
71
+ * Helper method to navigate to a nested path by splitting and chaining .get() calls
72
+ * @param node Starting Gun node
73
+ * @param path Path string (e.g., "test/data/marco")
74
+ * @returns Gun node at the specified path
75
+ */
76
+ private navigateToPath;
70
77
  /**
71
78
  * Gets the Gun instance
72
79
  * @returns Gun instance
@@ -110,6 +117,12 @@ declare class GunDB {
110
117
  * @returns Promise resolving to signup result
111
118
  */
112
119
  signUp(username: string, password: string): Promise<any>;
120
+ /**
121
+ * Check if a username already exists in the system
122
+ * @param username Username to check
123
+ * @returns Promise resolving to user data if exists, null otherwise
124
+ */
125
+ private checkUsernameExists;
113
126
  /**
114
127
  * Logs in a user using direct Gun authentication
115
128
  * @param username Username
@@ -119,6 +132,15 @@ declare class GunDB {
119
132
  */
120
133
  login(username: string, password: string, callback?: (result: any) => void): Promise<any>;
121
134
  private _savePair;
135
+ /**
136
+ * Attempts to restore user session from local storage
137
+ * @returns Promise resolving to session restoration result
138
+ */
139
+ restoreSession(): Promise<{
140
+ success: boolean;
141
+ userPub?: string;
142
+ error?: string;
143
+ }>;
122
144
  /**
123
145
  * Logs out the current user using direct Gun authentication
124
146
  */
@@ -184,17 +206,54 @@ declare class GunDB {
184
206
  decrypt(encryptedData: string, key: string): Promise<string | any>;
185
207
  /**
186
208
  * Saves user data at the specified path
187
- * @param path Path to save the data
209
+ * @param path Path to save the data (supports nested paths like "test/data/marco")
188
210
  * @param data Data to save
189
211
  * @returns Promise that resolves when the data is saved
190
212
  */
191
213
  saveUserData(path: string, data: any): Promise<void>;
192
214
  /**
193
215
  * Gets user data from the specified path
194
- * @param path Path to get the data from
216
+ * @param path Path to get the data from (supports nested paths like "test/data/marco")
195
217
  * @returns Promise that resolves with the data
196
218
  */
197
219
  getUserData(path: string): Promise<any>;
220
+ /**
221
+ * Derive cryptographic keys from password and optional extras
222
+ * Supports multiple key derivation algorithms: P-256, secp256k1 (Bitcoin), secp256k1 (Ethereum)
223
+ * @param password - Password or seed for key derivation
224
+ * @param extra - Additional entropy (string or array of strings)
225
+ * @param options - Derivation options to specify which key types to generate
226
+ * @returns Promise resolving to derived keys object
227
+ */
228
+ derive(password: any, extra?: any, options?: DeriveOptions): Promise<any>;
229
+ /**
230
+ * Derive P-256 keys (default Gun.SEA behavior)
231
+ * @param password - Password for key derivation
232
+ * @param extra - Additional entropy
233
+ * @returns Promise resolving to P-256 keys
234
+ */
235
+ deriveP256(password: any, extra?: any): Promise<any>;
236
+ /**
237
+ * Derive Bitcoin secp256k1 keys with P2PKH address
238
+ * @param password - Password for key derivation
239
+ * @param extra - Additional entropy
240
+ * @returns Promise resolving to Bitcoin keys and address
241
+ */
242
+ deriveBitcoin(password: any, extra?: any): Promise<any>;
243
+ /**
244
+ * Derive Ethereum secp256k1 keys with Keccak256 address
245
+ * @param password - Password for key derivation
246
+ * @param extra - Additional entropy
247
+ * @returns Promise resolving to Ethereum keys and address
248
+ */
249
+ deriveEthereum(password: any, extra?: any): Promise<any>;
250
+ /**
251
+ * Derive all supported key types
252
+ * @param password - Password for key derivation
253
+ * @param extra - Additional entropy
254
+ * @returns Promise resolving to all key types
255
+ */
256
+ deriveAll(password: any, extra?: any): Promise<any>;
198
257
  static Errors: typeof GunErrors;
199
258
  }
200
259
  export { GunDB };
@@ -43,11 +43,6 @@ export declare class NostrConnector extends EventEmitter {
43
43
  * Validates that the address is valid
44
44
  */
45
45
  private validateAddress;
46
- /**
47
- * Check if Alby extension is available
48
- * @deprecated Alby support is deprecated, use Nostr instead
49
- */
50
- isAlbyAvailable(): boolean;
51
46
  /**
52
47
  * Check if Nostr extension is available
53
48
  */
@@ -4,13 +4,13 @@ import { Web3ConnectorCredentials, ConnectionResult, Web3ConectorPluginInterface
4
4
  import { ethers } from "ethers";
5
5
  import { AuthResult } from "../../types/shogun";
6
6
  /**
7
- * Plugin per la gestione delle funzionalità MetaMask in ShogunCore
7
+ * Plugin per la gestione delle funzionalità Web3 in ShogunCore
8
8
  */
9
9
  export declare class Web3ConnectorPlugin extends BasePlugin implements Web3ConectorPluginInterface {
10
10
  name: string;
11
11
  version: string;
12
12
  description: string;
13
- private metamask;
13
+ private Web3;
14
14
  /**
15
15
  * @inheritdoc
16
16
  */
@@ -20,7 +20,7 @@ export declare class Web3ConnectorPlugin extends BasePlugin implements Web3Conec
20
20
  */
21
21
  destroy(): void;
22
22
  /**
23
- * Assicura che il modulo MetaMask sia inizializzato
23
+ * Assicura che il modulo Web3 sia inizializzato
24
24
  * @private
25
25
  */
26
26
  private assertMetaMask;
@@ -61,28 +61,18 @@ export declare class Web3ConnectorPlugin extends BasePlugin implements Web3Conec
61
61
  */
62
62
  verifySignature(message: string, signature: string): Promise<string>;
63
63
  /**
64
- * Login con MetaMask
64
+ * Login con Web3
65
65
  * @param address - Indirizzo Ethereum
66
66
  * @returns {Promise<AuthResult>} Risultato dell'autenticazione
67
- * @description Autentica l'utente usando le credenziali del wallet MetaMask dopo la verifica della firma
67
+ * @description Autentica l'utente usando le credenziali del wallet Web3 dopo la verifica della firma
68
68
  */
69
69
  login(address: string): Promise<AuthResult>;
70
70
  /**
71
- * Registra un nuovo utente con MetaMask
71
+ * Registra un nuovo utente con Web3
72
72
  * @param address - Indirizzo Ethereum
73
73
  * @returns {Promise<AuthResult>} Risultato della registrazione
74
- * @description Crea un nuovo account utente usando le credenziali del wallet MetaMask dopo la verifica della firma
74
+ * @description Crea un nuovo account utente usando le credenziali del wallet Web3 dopo la verifica della firma
75
75
  */
76
76
  signUp(address: string): Promise<AuthResult>;
77
- /**
78
- * Legacy method for MetaMask login - use login() instead
79
- * @deprecated Use login(address) instead
80
- */
81
- loginWithMetaMask(address: string): Promise<AuthResult>;
82
- /**
83
- * Legacy method for MetaMask signup - use signUp() instead
84
- * @deprecated Use signUp(address) instead
85
- */
86
- signUpWithMetaMask(address: string): Promise<AuthResult>;
87
77
  }
88
78
  export type { Web3ConectorPluginInterface } from "./types";
@@ -91,10 +91,6 @@ export declare class Webauthn extends EventEmitter {
91
91
  * Verifies a credential
92
92
  */
93
93
  private verifyCredential;
94
- /**
95
- * Saves credential to GunDB
96
- */
97
- private saveToGun;
98
94
  /**
99
95
  * Removes device credentials
100
96
  */
@@ -69,15 +69,5 @@ export declare class WebauthnPlugin extends BasePlugin implements WebauthnPlugin
69
69
  * Requires browser support for WebAuthn.
70
70
  */
71
71
  signUp(username: string): Promise<AuthResult>;
72
- /**
73
- * Legacy method for WebAuthn login - use login() instead
74
- * @deprecated Use login(username) instead
75
- */
76
- loginWithWebAuthn(username: string): Promise<AuthResult>;
77
- /**
78
- * Legacy method for WebAuthn signup - use signUp() instead
79
- * @deprecated Use signUp(username) instead
80
- */
81
- signUpWithWebAuthn(username: string): Promise<AuthResult>;
82
72
  }
83
73
  export type { WebauthnPluginInterface } from "./types";
@@ -1,7 +1,7 @@
1
1
  import { IGunInstance } from "gun/types";
2
2
  import { ethers } from "ethers";
3
3
  import { ShogunError } from "../utils/errorHandler";
4
- import { GunDB } from "../gundb/gun";
4
+ import { GunDB } from "../gundb/instance";
5
5
  import { GunRxJS } from "../gundb/rxjs-integration";
6
6
  import { ShogunPlugin, PluginManager } from "./plugin";
7
7
  import { ShogunStorage } from "../storage/storage";
@@ -37,9 +37,6 @@ export interface AuthResult {
37
37
  error?: string;
38
38
  userPub?: string;
39
39
  username?: string;
40
- password?: string;
41
- credentialId?: string;
42
- wallet?: any;
43
40
  authMethod?: AuthMethod;
44
41
  }
45
42
  /**