shogun-button-react 5.0.0 → 6.0.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.
@@ -1,6 +1,14 @@
1
1
  import React, { useContext, useState, createContext, useEffect, useRef, } from "react";
2
2
  import { Observable } from "rxjs";
3
3
  import "../styles/index.css";
4
+ // Helper type to check if core is ShogunCore
5
+ function isShogunCore(core) {
6
+ return core && typeof core.isLoggedIn === 'function' && typeof core.gun !== 'undefined';
7
+ }
8
+ // Helper type to check if core is QuickStart
9
+ function isQuickStart(core) {
10
+ return core && typeof core.api !== 'undefined' && typeof core.database !== 'undefined';
11
+ }
4
12
  // Default context
5
13
  const defaultShogunContext = {
6
14
  core: null,
@@ -38,14 +46,29 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
38
46
  if (!core)
39
47
  return;
40
48
  // Verifichiamo se l'utente è già loggato all'inizializzazione
41
- if (core.isLoggedIn()) {
42
- const pub = (_b = (_a = core.gun.user()) === null || _a === void 0 ? void 0 : _a.is) === null || _b === void 0 ? void 0 : _b.pub;
43
- if (pub) {
44
- setIsLoggedIn(true);
45
- setUserPub(pub);
46
- setUsername(pub.slice(0, 8) + "...");
49
+ let isLoggedIn = false;
50
+ let pub = null;
51
+ if (isShogunCore(core)) {
52
+ isLoggedIn = core.isLoggedIn();
53
+ if (isLoggedIn) {
54
+ pub = (_b = (_a = core.gun.user()) === null || _a === void 0 ? void 0 : _a.is) === null || _b === void 0 ? void 0 : _b.pub;
55
+ }
56
+ }
57
+ else if (isQuickStart(core)) {
58
+ // QuickStart doesn't have built-in login state, so we check sessionStorage
59
+ const pair = sessionStorage.getItem("gun/pair") || sessionStorage.getItem("pair");
60
+ isLoggedIn = !!pair;
61
+ if (isLoggedIn) {
62
+ // Try to get user info from the database
63
+ const userData = core.database.getCurrentUser();
64
+ pub = (userData === null || userData === void 0 ? void 0 : userData.pub) || null;
47
65
  }
48
66
  }
67
+ if (isLoggedIn && pub) {
68
+ setIsLoggedIn(true);
69
+ setUserPub(pub);
70
+ setUsername(pub.slice(0, 8) + "...");
71
+ }
49
72
  // Poiché il metodo 'on' non esiste su ShogunCore,
50
73
  // gestiamo gli stati direttamente nei metodi di login/logout
51
74
  }, [core, onLoginSuccess]);
@@ -76,7 +99,16 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
76
99
  case "password":
77
100
  username = args[0];
78
101
  console.log(`[DEBUG] ShogunButton: Calling core.login for username: ${username}`);
79
- result = await core.login(args[0], args[1]);
102
+ if (isShogunCore(core)) {
103
+ result = await core.login(args[0], args[1]);
104
+ }
105
+ else if (isQuickStart(core)) {
106
+ // Use QuickStart database directly
107
+ result = await core.database.login(args[0], args[1]);
108
+ }
109
+ else {
110
+ throw new Error("Unsupported core type");
111
+ }
80
112
  console.log(`[DEBUG] ShogunButton: core.login result:`, result);
81
113
  break;
82
114
  case "pair":
@@ -85,75 +117,103 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
85
117
  if (!pair || typeof pair !== "object") {
86
118
  throw new Error("Invalid pair data provided");
87
119
  }
88
- result = await new Promise((resolve, reject) => {
89
- core.gun.user().auth(pair, (ack) => {
90
- if (ack.err) {
91
- reject(new Error(`Pair authentication failed: ${ack.err}`));
92
- return;
93
- }
94
- const pub = ack.pub || pair.pub;
95
- const alias = ack.alias || `user_${pub === null || pub === void 0 ? void 0 : pub.substring(0, 8)}`;
96
- resolve({
97
- success: true,
98
- userPub: pub,
99
- alias: alias,
100
- method: "pair",
120
+ if (isShogunCore(core)) {
121
+ result = await new Promise((resolve, reject) => {
122
+ core.gun.user().auth(pair, (ack) => {
123
+ if (ack.err) {
124
+ reject(new Error(`Pair authentication failed: ${ack.err}`));
125
+ return;
126
+ }
127
+ const pub = ack.pub || pair.pub;
128
+ const alias = ack.alias || `user_${pub === null || pub === void 0 ? void 0 : pub.substring(0, 8)}`;
129
+ resolve({
130
+ success: true,
131
+ userPub: pub,
132
+ alias: alias,
133
+ method: "pair",
134
+ });
101
135
  });
102
136
  });
103
- });
137
+ }
138
+ else {
139
+ throw new Error("Pair authentication not supported with QuickStart");
140
+ }
104
141
  username = result.alias;
105
142
  authMethod = "pair";
106
143
  break;
107
144
  case "webauthn":
108
145
  username = args[0];
109
- const webauthn = core.getPlugin("webauthn");
110
- if (!webauthn)
111
- throw new Error("WebAuthn plugin not available");
112
- result = await webauthn.login(username);
146
+ if (isShogunCore(core)) {
147
+ const webauthn = core.getPlugin("webauthn");
148
+ if (!webauthn)
149
+ throw new Error("WebAuthn plugin not available");
150
+ result = await webauthn.login(username);
151
+ }
152
+ else {
153
+ throw new Error("WebAuthn not supported with QuickStart");
154
+ }
113
155
  break;
114
156
  case "web3":
115
- const web3 = core.getPlugin("web3");
116
- if (!web3)
117
- throw new Error("Web3 plugin not available");
118
- const connectionResult = await web3.connectMetaMask();
119
- if (!connectionResult.success || !connectionResult.address) {
120
- throw new Error(connectionResult.error || "Failed to connect wallet.");
157
+ if (isShogunCore(core)) {
158
+ const web3 = core.getPlugin("web3");
159
+ if (!web3)
160
+ throw new Error("Web3 plugin not available");
161
+ const connectionResult = await web3.connectMetaMask();
162
+ if (!connectionResult.success || !connectionResult.address) {
163
+ throw new Error(connectionResult.error || "Failed to connect wallet.");
164
+ }
165
+ username = connectionResult.address;
166
+ result = await web3.login(connectionResult.address);
167
+ }
168
+ else {
169
+ throw new Error("Web3 not supported with QuickStart");
121
170
  }
122
- username = connectionResult.address;
123
- result = await web3.login(connectionResult.address);
124
171
  break;
125
172
  case "nostr":
126
- const nostr = core.getPlugin("nostr");
127
- if (!nostr)
128
- throw new Error("Nostr plugin not available");
129
- const nostrResult = await nostr.connectBitcoinWallet();
130
- if (!nostrResult || !nostrResult.success) {
131
- throw new Error((nostrResult === null || nostrResult === void 0 ? void 0 : nostrResult.error) || "Connessione al wallet Bitcoin fallita");
173
+ if (isShogunCore(core)) {
174
+ const nostr = core.getPlugin("nostr");
175
+ if (!nostr)
176
+ throw new Error("Nostr plugin not available");
177
+ const nostrResult = await nostr.connectBitcoinWallet();
178
+ if (!nostrResult || !nostrResult.success) {
179
+ throw new Error((nostrResult === null || nostrResult === void 0 ? void 0 : nostrResult.error) || "Connessione al wallet Bitcoin fallita");
180
+ }
181
+ const pubkey = nostrResult.address;
182
+ if (!pubkey)
183
+ throw new Error("Nessuna chiave pubblica ottenuta");
184
+ username = pubkey;
185
+ result = await nostr.login(pubkey);
186
+ }
187
+ else {
188
+ throw new Error("Nostr not supported with QuickStart");
132
189
  }
133
- const pubkey = nostrResult.address;
134
- if (!pubkey)
135
- throw new Error("Nessuna chiave pubblica ottenuta");
136
- username = pubkey;
137
- result = await nostr.login(pubkey);
138
190
  break;
139
191
  case "zkproof":
140
192
  const trapdoor = args[0];
141
193
  if (!trapdoor || typeof trapdoor !== "string") {
142
194
  throw new Error("Invalid trapdoor provided");
143
195
  }
144
- const zkproof = core.getPlugin("zkproof");
145
- if (!zkproof)
146
- throw new Error("ZK-Proof plugin not available");
147
- const zkLoginResult = await zkproof.login(trapdoor);
148
- result = zkLoginResult;
149
- username = zkLoginResult.username || zkLoginResult.alias || `zk_${(zkLoginResult.userPub || "").slice(0, 16)}`;
150
- authMethod = "zkproof";
196
+ if (isShogunCore(core)) {
197
+ const zkproof = core.getPlugin("zkproof");
198
+ if (!zkproof)
199
+ throw new Error("ZK-Proof plugin not available");
200
+ const zkLoginResult = await zkproof.login(trapdoor);
201
+ result = zkLoginResult;
202
+ username = zkLoginResult.username || zkLoginResult.alias || `zk_${(zkLoginResult.userPub || "").slice(0, 16)}`;
203
+ authMethod = "zkproof";
204
+ }
205
+ else {
206
+ throw new Error("ZK-Proof not supported with QuickStart");
207
+ }
151
208
  break;
152
209
  default:
153
210
  throw new Error("Unsupported login method");
154
211
  }
155
212
  if (result.success) {
156
- const userPub = result.userPub || ((_b = (_a = core.gun.user()) === null || _a === void 0 ? void 0 : _a.is) === null || _b === void 0 ? void 0 : _b.pub) || "";
213
+ let userPub = result.userPub || "";
214
+ if (!userPub && isShogunCore(core)) {
215
+ userPub = ((_b = (_a = core.gun.user()) === null || _a === void 0 ? void 0 : _a.is) === null || _b === void 0 ? void 0 : _b.pub) || "";
216
+ }
157
217
  const displayName = result.alias || username || userPub.slice(0, 8) + "...";
158
218
  setIsLoggedIn(true);
159
219
  setUserPub(userPub);
@@ -192,10 +252,17 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
192
252
  }
193
253
  console.log(`[DEBUG] ShogunButton: Calling core.signUp for username: ${username}`);
194
254
  console.log(`[DEBUG] ShogunButton: core object:`, core);
195
- console.log(`[DEBUG] ShogunButton: core.signUp exists:`, typeof (core === null || core === void 0 ? void 0 : core.signUp));
196
255
  try {
197
256
  console.log(`[DEBUG] ShogunButton: About to call core.signUp...`);
198
- result = await core.signUp(args[0], args[1]);
257
+ if (isShogunCore(core)) {
258
+ result = await core.signUp(args[0], args[1]);
259
+ }
260
+ else if (isQuickStart(core)) {
261
+ result = await core.database.signUp(args[0], args[1]);
262
+ }
263
+ else {
264
+ throw new Error("Unsupported core type");
265
+ }
199
266
  console.log(`[DEBUG] ShogunButton: core.signUp completed successfully`);
200
267
  console.log(`[DEBUG] ShogunButton: core.signUp result:`, result);
201
268
  }
@@ -206,51 +273,74 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
206
273
  break;
207
274
  case "webauthn":
208
275
  username = args[0];
209
- const webauthn = core.getPlugin("webauthn");
210
- if (!webauthn)
211
- throw new Error("WebAuthn plugin not available");
212
- result = await webauthn.signUp(username, { generateSeedPhrase: true });
276
+ if (isShogunCore(core)) {
277
+ const webauthn = core.getPlugin("webauthn");
278
+ if (!webauthn)
279
+ throw new Error("WebAuthn plugin not available");
280
+ result = await webauthn.signUp(username, { generateSeedPhrase: true });
281
+ }
282
+ else {
283
+ throw new Error("WebAuthn not supported with QuickStart");
284
+ }
213
285
  break;
214
286
  case "web3":
215
- const web3 = core.getPlugin("web3");
216
- if (!web3)
217
- throw new Error("Web3 plugin not available");
218
- const connectionResult = await web3.connectMetaMask();
219
- if (!connectionResult.success || !connectionResult.address) {
220
- throw new Error(connectionResult.error || "Failed to connect wallet.");
287
+ if (isShogunCore(core)) {
288
+ const web3 = core.getPlugin("web3");
289
+ if (!web3)
290
+ throw new Error("Web3 plugin not available");
291
+ const connectionResult = await web3.connectMetaMask();
292
+ if (!connectionResult.success || !connectionResult.address) {
293
+ throw new Error(connectionResult.error || "Failed to connect wallet.");
294
+ }
295
+ username = connectionResult.address;
296
+ result = await web3.signUp(connectionResult.address);
297
+ }
298
+ else {
299
+ throw new Error("Web3 not supported with QuickStart");
221
300
  }
222
- username = connectionResult.address;
223
- result = await web3.signUp(connectionResult.address);
224
301
  break;
225
302
  case "nostr":
226
- const nostr = core.getPlugin("nostr");
227
- if (!nostr)
228
- throw new Error("Nostr plugin not available");
229
- const nostrResult = await nostr.connectBitcoinWallet();
230
- if (!nostrResult || !nostrResult.success) {
231
- throw new Error((nostrResult === null || nostrResult === void 0 ? void 0 : nostrResult.error) || "Connessione al wallet Bitcoin fallita");
303
+ if (isShogunCore(core)) {
304
+ const nostr = core.getPlugin("nostr");
305
+ if (!nostr)
306
+ throw new Error("Nostr plugin not available");
307
+ const nostrResult = await nostr.connectBitcoinWallet();
308
+ if (!nostrResult || !nostrResult.success) {
309
+ throw new Error((nostrResult === null || nostrResult === void 0 ? void 0 : nostrResult.error) || "Connessione al wallet Bitcoin fallita");
310
+ }
311
+ const pubkey = nostrResult.address;
312
+ if (!pubkey)
313
+ throw new Error("Nessuna chiave pubblica ottenuta");
314
+ username = pubkey;
315
+ result = await nostr.signUp(pubkey);
316
+ }
317
+ else {
318
+ throw new Error("Nostr not supported with QuickStart");
232
319
  }
233
- const pubkey = nostrResult.address;
234
- if (!pubkey)
235
- throw new Error("Nessuna chiave pubblica ottenuta");
236
- username = pubkey;
237
- result = await nostr.signUp(pubkey);
238
320
  break;
239
321
  case "zkproof":
240
- const zkproofPlugin = core.getPlugin("zkproof");
241
- if (!zkproofPlugin)
242
- throw new Error("ZK-Proof plugin not available");
243
- const seed = args[0]; // Optional seed
244
- const zkSignupResult = await zkproofPlugin.signUp(seed);
245
- result = zkSignupResult;
246
- username = zkSignupResult.username || zkSignupResult.alias || `zk_${(zkSignupResult.userPub || "").slice(0, 16)}`;
247
- authMethod = "zkproof";
322
+ if (isShogunCore(core)) {
323
+ const zkproofPlugin = core.getPlugin("zkproof");
324
+ if (!zkproofPlugin)
325
+ throw new Error("ZK-Proof plugin not available");
326
+ const seed = args[0]; // Optional seed
327
+ const zkSignupResult = await zkproofPlugin.signUp(seed);
328
+ result = zkSignupResult;
329
+ username = zkSignupResult.username || zkSignupResult.alias || `zk_${(zkSignupResult.userPub || "").slice(0, 16)}`;
330
+ authMethod = "zkproof";
331
+ }
332
+ else {
333
+ throw new Error("ZK-Proof not supported with QuickStart");
334
+ }
248
335
  break;
249
336
  default:
250
337
  throw new Error("Unsupported signup method");
251
338
  }
252
339
  if (result.success) {
253
- const userPub = result.userPub || ((_b = (_a = core.gun.user()) === null || _a === void 0 ? void 0 : _a.is) === null || _b === void 0 ? void 0 : _b.pub) || "";
340
+ let userPub = result.userPub || "";
341
+ if (!userPub && isShogunCore(core)) {
342
+ userPub = ((_b = (_a = core.gun.user()) === null || _a === void 0 ? void 0 : _a.is) === null || _b === void 0 ? void 0 : _b.pub) || "";
343
+ }
254
344
  const displayName = result.alias || username || userPub.slice(0, 8) + "...";
255
345
  setIsLoggedIn(true);
256
346
  setUserPub(userPub);
@@ -274,13 +364,18 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
274
364
  };
275
365
  // Logout
276
366
  const logout = () => {
277
- core.logout();
367
+ if (isShogunCore(core)) {
368
+ core.logout();
369
+ }
370
+ else if (isQuickStart(core)) {
371
+ // QuickStart doesn't have built-in logout, so we clear session storage
372
+ sessionStorage.removeItem("gun/pair");
373
+ sessionStorage.removeItem("gun/session");
374
+ sessionStorage.removeItem("pair");
375
+ }
278
376
  setIsLoggedIn(false);
279
377
  setUserPub(null);
280
378
  setUsername(null);
281
- sessionStorage.removeItem("gun/pair");
282
- sessionStorage.removeItem("gun/session");
283
- sessionStorage.removeItem("pair");
284
379
  };
285
380
  // Implementazione del metodo setProvider
286
381
  const setProvider = (provider) => {
@@ -317,10 +412,24 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
317
412
  }
318
413
  };
319
414
  const hasPlugin = (name) => {
320
- return core ? core.hasPlugin(name) : false;
415
+ if (isShogunCore(core)) {
416
+ return core.hasPlugin(name);
417
+ }
418
+ else if (isQuickStart(core)) {
419
+ // QuickStart doesn't have plugins
420
+ return false;
421
+ }
422
+ return false;
321
423
  };
322
424
  const getPlugin = (name) => {
323
- return core ? core.getPlugin(name) : undefined;
425
+ if (isShogunCore(core)) {
426
+ return core.getPlugin(name);
427
+ }
428
+ else if (isQuickStart(core)) {
429
+ // QuickStart doesn't have plugins
430
+ return undefined;
431
+ }
432
+ return undefined;
324
433
  };
325
434
  // Export Gun pair functionality
326
435
  const exportGunPair = async (password) => {
@@ -406,33 +515,75 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
406
515
  setProvider,
407
516
  gunPlugin,
408
517
  put: async (path, data) => {
409
- if (!(core === null || core === void 0 ? void 0 : core.gun))
410
- throw new Error('Gun instance not available');
411
- return new Promise((resolve, reject) => {
412
- core.gun.get(path).put(data, (ack) => {
413
- if (ack.err)
414
- reject(new Error(ack.err));
415
- else
416
- resolve();
518
+ if (isShogunCore(core)) {
519
+ if (!core.gun)
520
+ throw new Error('Gun instance not available');
521
+ return new Promise((resolve, reject) => {
522
+ core.gun.get(path).put(data, (ack) => {
523
+ if (ack.err)
524
+ reject(new Error(ack.err));
525
+ else
526
+ resolve();
527
+ });
528
+ });
529
+ }
530
+ else if (isQuickStart(core)) {
531
+ if (!core.database.gun)
532
+ throw new Error('Gun instance not available');
533
+ return new Promise((resolve, reject) => {
534
+ core.database.gun.get(path).put(data, (ack) => {
535
+ if (ack.err)
536
+ reject(new Error(ack.err));
537
+ else
538
+ resolve();
539
+ });
417
540
  });
418
- });
541
+ }
542
+ else {
543
+ throw new Error('Core not available');
544
+ }
419
545
  },
420
546
  get: (path) => {
421
- if (!(core === null || core === void 0 ? void 0 : core.gun))
422
- return null;
423
- return core.gun.get(path);
547
+ if (isShogunCore(core)) {
548
+ if (!core.gun)
549
+ return null;
550
+ return core.gun.get(path);
551
+ }
552
+ else if (isQuickStart(core)) {
553
+ if (!core.database.gun)
554
+ return null;
555
+ return core.database.gun.get(path);
556
+ }
557
+ return null;
424
558
  },
425
559
  remove: async (path) => {
426
- if (!(core === null || core === void 0 ? void 0 : core.gun))
427
- throw new Error('Gun instance not available');
428
- return new Promise((resolve, reject) => {
429
- core.gun.get(path).put(null, (ack) => {
430
- if (ack.err)
431
- reject(new Error(ack.err));
432
- else
433
- resolve();
560
+ if (isShogunCore(core)) {
561
+ if (!core.gun)
562
+ throw new Error('Gun instance not available');
563
+ return new Promise((resolve, reject) => {
564
+ core.gun.get(path).put(null, (ack) => {
565
+ if (ack.err)
566
+ reject(new Error(ack.err));
567
+ else
568
+ resolve();
569
+ });
434
570
  });
435
- });
571
+ }
572
+ else if (isQuickStart(core)) {
573
+ if (!core.database.gun)
574
+ throw new Error('Gun instance not available');
575
+ return new Promise((resolve, reject) => {
576
+ core.database.gun.get(path).put(null, (ack) => {
577
+ if (ack.err)
578
+ reject(new Error(ack.err));
579
+ else
580
+ resolve();
581
+ });
582
+ });
583
+ }
584
+ else {
585
+ throw new Error('Core not available');
586
+ }
436
587
  },
437
588
  }), [
438
589
  core,
@@ -499,7 +650,7 @@ const ExportIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org
499
650
  // Component for Shogun login button
500
651
  export const ShogunButton = (() => {
501
652
  const Button = () => {
502
- const { isLoggedIn, username, logout, login, signUp, core, options, exportGunPair, importGunPair, } = useShogun();
653
+ const { isLoggedIn, username, logout, login, signUp, core, options, exportGunPair, importGunPair, hasPlugin, } = useShogun();
503
654
  // Form states
504
655
  const [modalIsOpen, setModalIsOpen] = useState(false);
505
656
  const [formUsername, setFormUsername] = useState("");
@@ -602,7 +753,7 @@ export const ShogunButton = (() => {
602
753
  if (formMode === "signup") {
603
754
  const result = await signUp("password", formUsername, formPassword, formPasswordConfirm);
604
755
  if (result && result.success) {
605
- if (core === null || core === void 0 ? void 0 : core.db) {
756
+ if (isShogunCore(core) && core.db) {
606
757
  try {
607
758
  const res = await core.db.setPasswordHintWithSecurity(formUsername, formPassword, formHint, [formSecurityQuestion], [formSecurityAnswer]);
608
759
  if (!(res === null || res === void 0 ? void 0 : res.success)) {
@@ -633,14 +784,14 @@ export const ShogunButton = (() => {
633
784
  }
634
785
  };
635
786
  const handleWebAuthnAuth = () => {
636
- if (!(core === null || core === void 0 ? void 0 : core.hasPlugin("webauthn"))) {
787
+ if (!hasPlugin("webauthn")) {
637
788
  setError("WebAuthn is not supported in your browser");
638
789
  return;
639
790
  }
640
791
  setAuthView("webauthn-username");
641
792
  };
642
793
  const handleZkProofAuth = () => {
643
- if (!(core === null || core === void 0 ? void 0 : core.hasPlugin("zkproof"))) {
794
+ if (!hasPlugin("zkproof")) {
644
795
  setError("ZK-Proof plugin not available");
645
796
  return;
646
797
  }
@@ -694,18 +845,20 @@ export const ShogunButton = (() => {
694
845
  setError("");
695
846
  setLoading(true);
696
847
  try {
697
- if (!(core === null || core === void 0 ? void 0 : core.db)) {
698
- throw new Error("SDK not ready");
699
- }
700
- const result = await core.db.forgotPassword(formUsername, [
701
- formSecurityAnswer,
702
- ]);
703
- if (result.success && result.hint) {
704
- setRecoveredHint(result.hint);
705
- setAuthView("showHint");
848
+ if (isShogunCore(core) && core.db) {
849
+ const result = await core.db.forgotPassword(formUsername, [
850
+ formSecurityAnswer,
851
+ ]);
852
+ if (result.success && result.hint) {
853
+ setRecoveredHint(result.hint);
854
+ setAuthView("showHint");
855
+ }
856
+ else {
857
+ setError(result.error || "Could not recover hint.");
858
+ }
706
859
  }
707
860
  else {
708
- setError(result.error || "Could not recover hint.");
861
+ setError("Password recovery not supported with QuickStart");
709
862
  }
710
863
  }
711
864
  catch (e) {
@@ -796,23 +949,23 @@ export const ShogunButton = (() => {
796
949
  };
797
950
  // Add buttons for both login and signup for alternative auth methods
798
951
  const renderAuthOptions = () => (React.createElement("div", { className: "shogun-auth-options" },
799
- options.showMetamask !== false && (core === null || core === void 0 ? void 0 : core.hasPlugin("web3")) && (React.createElement("div", { className: "shogun-auth-option-group" },
952
+ options.showMetamask !== false && hasPlugin("web3") && (React.createElement("div", { className: "shogun-auth-option-group" },
800
953
  React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => handleAuth("web3"), disabled: loading },
801
954
  React.createElement(WalletIcon, null),
802
955
  formMode === "login"
803
956
  ? "Login with MetaMask"
804
957
  : "Signup with MetaMask"))),
805
- options.showWebauthn !== false && (core === null || core === void 0 ? void 0 : core.hasPlugin("webauthn")) && (React.createElement("div", { className: "shogun-auth-option-group" },
958
+ options.showWebauthn !== false && hasPlugin("webauthn") && (React.createElement("div", { className: "shogun-auth-option-group" },
806
959
  React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: handleWebAuthnAuth, disabled: loading },
807
960
  React.createElement(WebAuthnIcon, null),
808
961
  formMode === "login"
809
962
  ? "Login with WebAuthn"
810
963
  : "Signup with WebAuthn"))),
811
- options.showNostr !== false && (core === null || core === void 0 ? void 0 : core.hasPlugin("nostr")) && (React.createElement("div", { className: "shogun-auth-option-group" },
964
+ options.showNostr !== false && hasPlugin("nostr") && (React.createElement("div", { className: "shogun-auth-option-group" },
812
965
  React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => handleAuth("nostr"), disabled: loading },
813
966
  React.createElement(NostrIcon, null),
814
967
  formMode === "login" ? "Login with Nostr" : "Signup with Nostr"))),
815
- options.showZkProof !== false && (core === null || core === void 0 ? void 0 : core.hasPlugin("zkproof")) && (React.createElement("div", { className: "shogun-auth-option-group" },
968
+ options.showZkProof !== false && hasPlugin("zkproof") && (React.createElement("div", { className: "shogun-auth-option-group" },
816
969
  React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: handleZkProofAuth, disabled: loading },
817
970
  React.createElement(ZkProofIcon, null),
818
971
  formMode === "login"