shogun-button-react 6.9.4 → 6.9.7

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.
@@ -34,14 +34,14 @@ type ShogunButtonProviderProps = {
34
34
  userPub: string;
35
35
  username: string;
36
36
  password?: string;
37
- authMethod?: "password" | "web3" | "webauthn" | "nostr" | "zkproof" | "challenge" | "seed" | "pair";
37
+ authMethod?: "password" | "web3" | "webauthn" | "nostr" | "challenge" | "seed" | "pair";
38
38
  }) => void;
39
39
  onSignupSuccess?: (data: {
40
40
  userPub: string;
41
41
  username: string;
42
42
  password?: string;
43
43
  seedPhrase?: string;
44
- authMethod?: "password" | "web3" | "webauthn" | "nostr" | "zkproof" | "challenge" | "seed" | "pair";
44
+ authMethod?: "password" | "web3" | "webauthn" | "nostr" | "challenge" | "seed" | "pair";
45
45
  }) => void;
46
46
  onError?: (error: string) => void;
47
47
  };
@@ -3,7 +3,9 @@ import { Observable } from "rxjs";
3
3
  import "../styles/index.css";
4
4
  // Helper type to check if core is ShogunCore
5
5
  function isShogunCore(core) {
6
- return core && typeof core.isLoggedIn === 'function' && typeof core.gun !== 'undefined';
6
+ return (core &&
7
+ typeof core.isLoggedIn === "function" &&
8
+ typeof core.gun !== "undefined");
7
9
  }
8
10
  // Default context
9
11
  const defaultShogunContext = {
@@ -174,24 +176,6 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
174
176
  throw new Error("Nostr requires ShogunCore");
175
177
  }
176
178
  break;
177
- case "zkproof":
178
- const trapdoor = args[0];
179
- if (!trapdoor || typeof trapdoor !== "string") {
180
- throw new Error("Invalid trapdoor provided");
181
- }
182
- if (isShogunCore(core)) {
183
- const zkproof = core.getPlugin("zkproof");
184
- if (!zkproof)
185
- throw new Error("ZK-Proof plugin not available");
186
- const zkLoginResult = await zkproof.login(trapdoor);
187
- result = zkLoginResult;
188
- username = zkLoginResult.username || zkLoginResult.alias || `zk_${(zkLoginResult.userPub || "").slice(0, 16)}`;
189
- authMethod = "zkproof";
190
- }
191
- else {
192
- throw new Error("ZK-Proof requires ShogunCore");
193
- }
194
- break;
195
179
  case "challenge":
196
180
  username = args[0];
197
181
  if (!username)
@@ -351,21 +335,6 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
351
335
  throw new Error("Nostr requires ShogunCore");
352
336
  }
353
337
  break;
354
- case "zkproof":
355
- if (isShogunCore(core)) {
356
- const zkproofPlugin = core.getPlugin("zkproof");
357
- if (!zkproofPlugin)
358
- throw new Error("ZK-Proof plugin not available");
359
- const seed = args[0]; // Optional seed
360
- const zkSignupResult = await zkproofPlugin.signUp(seed);
361
- result = zkSignupResult;
362
- username = zkSignupResult.username || zkSignupResult.alias || `zk_${(zkSignupResult.userPub || "").slice(0, 16)}`;
363
- authMethod = "zkproof";
364
- }
365
- else {
366
- throw new Error("ZK-Proof requires ShogunCore");
367
- }
368
- break;
369
338
  default:
370
339
  throw new Error("Unsupported signup method");
371
340
  }
@@ -543,7 +512,7 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
543
512
  put: async (path, data) => {
544
513
  if (isShogunCore(core)) {
545
514
  if (!core.gun)
546
- throw new Error('Gun instance not available');
515
+ throw new Error("Gun instance not available");
547
516
  return new Promise((resolve, reject) => {
548
517
  core.gun.get(path).put(data, (ack) => {
549
518
  if (ack.err)
@@ -554,7 +523,7 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
554
523
  });
555
524
  }
556
525
  else {
557
- throw new Error('Core not available');
526
+ throw new Error("Core not available");
558
527
  }
559
528
  },
560
529
  get: (path) => {
@@ -568,7 +537,7 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
568
537
  remove: async (path) => {
569
538
  if (isShogunCore(core)) {
570
539
  if (!core.gun)
571
- throw new Error('Gun instance not available');
540
+ throw new Error("Gun instance not available");
572
541
  return new Promise((resolve, reject) => {
573
542
  core.gun.get(path).put(null, (ack) => {
574
543
  if (ack.err)
@@ -579,7 +548,7 @@ export function ShogunButtonProvider({ children, core, options, onLoginSuccess,
579
548
  });
580
549
  }
581
550
  else {
582
- throw new Error('Core not available');
551
+ throw new Error("Core not available");
583
552
  }
584
553
  },
585
554
  }), [
@@ -637,10 +606,6 @@ const ImportIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org
637
606
  React.createElement("polyline", { points: "14,2 14,8 20,8" }),
638
607
  React.createElement("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
639
608
  React.createElement("line", { x1: "12", y1: "17", x2: "12", y2: "9" })));
640
- const ZkProofIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
641
- React.createElement("path", { d: "M12 2L2 7l10 5 10-5-10-5z" }),
642
- React.createElement("path", { d: "M2 17l10 5 10-5" }),
643
- React.createElement("path", { d: "M2 12l10 5 10-5" })));
644
609
  const ChallengeIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
645
610
  React.createElement("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" })));
646
611
  const ExportIcon = () => (React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" },
@@ -657,24 +622,17 @@ export const ShogunButton = (() => {
657
622
  const [formUsername, setFormUsername] = useState("");
658
623
  const [formPassword, setFormPassword] = useState("");
659
624
  const [formPasswordConfirm, setFormPasswordConfirm] = useState("");
660
- const [formHint, setFormHint] = useState("");
661
- const [formSecurityQuestion] = useState("What is your favorite color?"); // Hardcoded for now
662
- const [formSecurityAnswer, setFormSecurityAnswer] = useState("");
663
625
  const [formMode, setFormMode] = useState("login");
664
626
  const [authView, setAuthView] = useState("options");
665
627
  const [error, setError] = useState("");
666
628
  const [loading, setLoading] = useState(false);
667
629
  const [dropdownOpen, setDropdownOpen] = useState(false);
668
- const [recoveredHint, setRecoveredHint] = useState("");
669
630
  const [exportPassword, setExportPassword] = useState("");
670
631
  const [importPassword, setImportPassword] = useState("");
671
632
  const [importPairData, setImportPairData] = useState("");
672
633
  const [exportedPair, setExportedPair] = useState("");
673
634
  const [showCopySuccess, setShowCopySuccess] = useState(false);
674
635
  const [showImportSuccess, setShowImportSuccess] = useState(false);
675
- const [zkTrapdoor, setZkTrapdoor] = useState("");
676
- const [zkSignupTrapdoor, setZkSignupTrapdoor] = useState("");
677
- const [showZkTrapdoorCopySuccess, setShowZkTrapdoorCopySuccess] = useState(false);
678
636
  const [webauthnSeedPhrase, setWebauthnSeedPhrase] = useState("");
679
637
  const [webauthnRecoverySeed, setWebauthnRecoverySeed] = useState("");
680
638
  const [formMnemonic, setFormMnemonic] = useState("");
@@ -697,17 +655,13 @@ export const ShogunButton = (() => {
697
655
  useEffect(() => {
698
656
  if (hasPendingSignup) {
699
657
  setModalIsOpen(true);
700
- if (authView !== "webauthn-signup-result" &&
701
- authView !== "zkproof-signup-result") {
658
+ if (authView !== "webauthn-signup-result") {
702
659
  if (webauthnSeedPhrase) {
703
660
  setAuthView("webauthn-signup-result");
704
661
  }
705
- else if (zkSignupTrapdoor) {
706
- setAuthView("zkproof-signup-result");
707
- }
708
662
  }
709
663
  }
710
- }, [hasPendingSignup, authView, webauthnSeedPhrase, zkSignupTrapdoor]);
664
+ }, [hasPendingSignup, authView, webauthnSeedPhrase]);
711
665
  // If already logged in, show only logout button
712
666
  if (isLoggedIn && username && !modalIsOpen) {
713
667
  return (React.createElement("div", { className: "shogun-logged-in-container" },
@@ -786,24 +740,6 @@ export const ShogunButton = (() => {
786
740
  if (result && result.success) {
787
741
  // Password hint functionality has been removed from shogun-core
788
742
  // Users should store hints manually in their own data structures if needed
789
- if (isShogunCore(core) && core.db && formHint) {
790
- try {
791
- // Store hint manually in user data
792
- const user = core.gun.user();
793
- if (user && user.is) {
794
- core.db.gun.get('users').get(formUsername).get('hint').put(formHint);
795
- if (formSecurityAnswer) {
796
- core.db.gun.get('users').get(formUsername).get('security').put({
797
- question: formSecurityQuestion,
798
- answer: formSecurityAnswer
799
- });
800
- }
801
- }
802
- }
803
- catch (error) {
804
- console.warn('Failed to store password hint:', error);
805
- }
806
- }
807
743
  setModalIsOpen(false);
808
744
  }
809
745
  else if (result && result.error) {
@@ -863,63 +799,6 @@ export const ShogunButton = (() => {
863
799
  setLoading(false);
864
800
  }
865
801
  };
866
- const handleZkProofAuth = () => {
867
- if (!hasPlugin("zkproof")) {
868
- setError("ZK-Proof plugin not available");
869
- return;
870
- }
871
- if (formMode === "login") {
872
- setAuthView("zkproof-login");
873
- }
874
- else {
875
- // For signup, directly call signUp and show trapdoor
876
- handleZkProofSignup();
877
- }
878
- };
879
- const handleZkProofLogin = async () => {
880
- setError("");
881
- setLoading(true);
882
- try {
883
- if (!zkTrapdoor.trim()) {
884
- throw new Error("Please enter your trapdoor");
885
- }
886
- await handleAuth("zkproof", zkTrapdoor);
887
- setModalIsOpen(false);
888
- }
889
- catch (e) {
890
- setError(e.message || "ZK-Proof login failed");
891
- }
892
- finally {
893
- setLoading(false);
894
- }
895
- };
896
- const handleZkProofSignup = async () => {
897
- setError("");
898
- setLoading(true);
899
- try {
900
- const result = await signUp("zkproof");
901
- if (!result || !result.success) {
902
- throw new Error((result === null || result === void 0 ? void 0 : result.error) || "ZK-Proof signup failed");
903
- }
904
- const trapdoorValue = result.seedPhrase || result.trapdoor || "";
905
- if (trapdoorValue) {
906
- setZkSignupTrapdoor(trapdoorValue);
907
- setShowZkTrapdoorCopySuccess(false);
908
- setAuthView("zkproof-signup-result");
909
- setHasPendingSignup(true);
910
- }
911
- else {
912
- setAuthView("options");
913
- setModalIsOpen(false);
914
- }
915
- }
916
- catch (e) {
917
- setError(e.message || "ZK-Proof signup failed");
918
- }
919
- finally {
920
- setLoading(false);
921
- }
922
- };
923
802
  const handleChallengeAuth = () => {
924
803
  if (!hasPlugin("challenge")) {
925
804
  setError("Challenge plugin not available");
@@ -964,52 +843,6 @@ export const ShogunButton = (() => {
964
843
  setLoading(false);
965
844
  }
966
845
  };
967
- const handleRecover = async () => {
968
- setError("");
969
- setLoading(true);
970
- try {
971
- if (isShogunCore(core) && core.db) {
972
- // Password recovery functionality has been removed from shogun-core
973
- // Users should implement their own recovery logic using Gun's get operations
974
- try {
975
- const hintNode = await new Promise((resolve) => {
976
- core.db.gun.get('users').get(formUsername).get('hint').once((hint) => {
977
- resolve(hint || null);
978
- });
979
- });
980
- const securityNode = await new Promise((resolve) => {
981
- core.db.gun.get('users').get(formUsername).get('security').once((security) => {
982
- resolve(security || null);
983
- });
984
- });
985
- if (securityNode && securityNode.answer === formSecurityAnswer) {
986
- if (hintNode) {
987
- setRecoveredHint(hintNode);
988
- setAuthView("showHint");
989
- }
990
- else {
991
- setError("No hint found for this user.");
992
- }
993
- }
994
- else {
995
- setError("Security answer is incorrect.");
996
- }
997
- }
998
- catch (error) {
999
- setError(error.message || "Could not recover hint.");
1000
- }
1001
- }
1002
- else {
1003
- setError("Password recovery requires ShogunCore");
1004
- }
1005
- }
1006
- catch (e) {
1007
- setError(e.message || "An unexpected error occurred.");
1008
- }
1009
- finally {
1010
- setLoading(false);
1011
- }
1012
- };
1013
846
  const handleExportPair = async () => {
1014
847
  setError("");
1015
848
  setLoading(true);
@@ -1061,8 +894,6 @@ export const ShogunButton = (() => {
1061
894
  setFormUsername("");
1062
895
  setFormPassword("");
1063
896
  setFormPasswordConfirm("");
1064
- setFormHint("");
1065
- setFormSecurityAnswer("");
1066
897
  setError("");
1067
898
  setLoading(false);
1068
899
  setAuthView("options");
@@ -1072,10 +903,7 @@ export const ShogunButton = (() => {
1072
903
  setExportedPair("");
1073
904
  setShowCopySuccess(false);
1074
905
  setShowImportSuccess(false);
1075
- setRecoveredHint("");
1076
- setZkTrapdoor("");
1077
- setZkSignupTrapdoor("");
1078
- setShowZkTrapdoorCopySuccess(false);
906
+ // Additional reset code if needed
1079
907
  setWebauthnSeedPhrase("");
1080
908
  setWebauthnRecoverySeed("");
1081
909
  setFormMnemonic("");
@@ -1090,7 +918,7 @@ export const ShogunButton = (() => {
1090
918
  setModalIsOpen(false);
1091
919
  setHasPendingSignup(false);
1092
920
  };
1093
- const finalizeZkProofSignup = () => {
921
+ const finalizeSignup = () => {
1094
922
  setError("");
1095
923
  resetForm();
1096
924
  setModalIsOpen(false);
@@ -1125,12 +953,6 @@ export const ShogunButton = (() => {
1125
953
  formMode === "login"
1126
954
  ? "Login with Challenge"
1127
955
  : "Signup with Challenge (N/A)"))),
1128
- options.showZkProof !== false && hasPlugin("zkproof") && (React.createElement("div", { className: "shogun-auth-option-group" },
1129
- React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: handleZkProofAuth, disabled: loading },
1130
- React.createElement(ZkProofIcon, null),
1131
- formMode === "login"
1132
- ? "Login with ZK-Proof"
1133
- : "Signup with ZK-Proof"))),
1134
956
  React.createElement("div", { className: "shogun-divider" },
1135
957
  React.createElement("span", null, "or")),
1136
958
  React.createElement("button", { type: "button", className: "shogun-auth-option-button", onClick: () => setAuthView("password"), disabled: loading },
@@ -1160,22 +982,7 @@ export const ShogunButton = (() => {
1160
982
  React.createElement("label", { htmlFor: "passwordConfirm" },
1161
983
  React.createElement(KeyIcon, null),
1162
984
  React.createElement("span", null, "Confirm Password")),
1163
- React.createElement("input", { type: "password", id: "passwordConfirm", value: formPasswordConfirm, onChange: (e) => setFormPasswordConfirm(e.target.value), disabled: loading, required: true, placeholder: "Confirm your password" })),
1164
- React.createElement("div", { className: "shogun-form-group" },
1165
- React.createElement("label", { htmlFor: "hint" },
1166
- React.createElement(UserIcon, null),
1167
- React.createElement("span", null, "Password Hint")),
1168
- React.createElement("input", { type: "text", id: "hint", value: formHint, onChange: (e) => setFormHint(e.target.value), disabled: loading, required: true, placeholder: "Enter your password hint" })),
1169
- React.createElement("div", { className: "shogun-form-group" },
1170
- React.createElement("label", { htmlFor: "securityQuestion" },
1171
- React.createElement(UserIcon, null),
1172
- React.createElement("span", null, "Security Question")),
1173
- React.createElement("input", { type: "text", id: "securityQuestion", value: formSecurityQuestion, disabled: true })),
1174
- React.createElement("div", { className: "shogun-form-group" },
1175
- React.createElement("label", { htmlFor: "securityAnswer" },
1176
- React.createElement(UserIcon, null),
1177
- React.createElement("span", null, "Security Answer")),
1178
- React.createElement("input", { type: "text", id: "securityAnswer", value: formSecurityAnswer, onChange: (e) => setFormSecurityAnswer(e.target.value), disabled: loading, required: true, placeholder: "Enter your security answer" })))),
985
+ React.createElement("input", { type: "password", id: "passwordConfirm", value: formPasswordConfirm, onChange: (e) => setFormPasswordConfirm(e.target.value), disabled: loading, required: true, placeholder: "Confirm your password" })))),
1179
986
  React.createElement("button", { type: "submit", className: "shogun-submit-button", disabled: loading }, loading
1180
987
  ? "Processing..."
1181
988
  : formMode === "login"
@@ -1184,8 +991,7 @@ export const ShogunButton = (() => {
1184
991
  React.createElement("div", { className: "shogun-form-footer" },
1185
992
  React.createElement("button", { type: "button", className: "shogun-toggle-mode shogun-prominent-toggle", onClick: toggleMode, disabled: loading }, formMode === "login"
1186
993
  ? "Don't have an account? Sign up"
1187
- : "Already have an account? Log in"),
1188
- formMode === "login" && (React.createElement("button", { type: "button", className: "shogun-toggle-mode", onClick: () => setAuthView("recover"), disabled: loading }, "Forgot password?")))));
994
+ : "Already have an account? Log in"))));
1189
995
  const renderWebAuthnUsernameForm = () => (React.createElement("div", { className: "shogun-auth-form" },
1190
996
  React.createElement("h3", null, formMode === "login"
1191
997
  ? "Login with WebAuthn"
@@ -1261,31 +1067,6 @@ export const ShogunButton = (() => {
1261
1067
  setError("");
1262
1068
  setAuthView("webauthn-username");
1263
1069
  }, disabled: loading }, "\u2190 Back to WebAuthn"))));
1264
- const renderRecoveryForm = () => (React.createElement("div", { className: "shogun-auth-form" },
1265
- React.createElement("div", { className: "shogun-form-group" },
1266
- React.createElement("label", { htmlFor: "username" },
1267
- React.createElement(UserIcon, null),
1268
- React.createElement("span", null, "Username")),
1269
- React.createElement("input", { type: "text", id: "username", value: formUsername, onChange: (e) => setFormUsername(e.target.value), disabled: loading, required: true, placeholder: "Enter your username" })),
1270
- React.createElement("div", { className: "shogun-form-group" },
1271
- React.createElement("label", null, "Security Question"),
1272
- React.createElement("p", null, formSecurityQuestion)),
1273
- React.createElement("div", { className: "shogun-form-group" },
1274
- React.createElement("label", { htmlFor: "securityAnswer" },
1275
- React.createElement(KeyIcon, null),
1276
- React.createElement("span", null, "Answer")),
1277
- React.createElement("input", { type: "text", id: "securityAnswer", value: formSecurityAnswer, onChange: (e) => setFormSecurityAnswer(e.target.value), disabled: loading, required: true, placeholder: "Enter your answer" })),
1278
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleRecover, disabled: loading }, loading ? "Recovering..." : "Get Hint"),
1279
- React.createElement("div", { className: "shogun-form-footer" },
1280
- React.createElement("button", { className: "shogun-toggle-mode", onClick: () => setAuthView("password"), disabled: loading }, "Back to Login"))));
1281
- const renderHint = () => (React.createElement("div", { className: "shogun-auth-form" },
1282
- React.createElement("h3", null, "Your Password Hint"),
1283
- React.createElement("p", { className: "shogun-hint" }, recoveredHint),
1284
- React.createElement("button", { className: "shogun-submit-button", onClick: () => {
1285
- setAuthView("password");
1286
- resetForm();
1287
- setFormMode("login");
1288
- } }, "Back to Login")));
1289
1070
  const renderExportForm = () => (React.createElement("div", { className: "shogun-auth-form" },
1290
1071
  React.createElement("h3", null, "Export Gun Pair"),
1291
1072
  React.createElement("div", { style: {
@@ -1342,86 +1123,6 @@ export const ShogunButton = (() => {
1342
1123
  setExportedPair("");
1343
1124
  }
1344
1125
  }, disabled: loading }, "Back"))));
1345
- const renderZkProofLoginForm = () => (React.createElement("div", { className: "shogun-auth-form" },
1346
- React.createElement("h3", null, "Login with ZK-Proof"),
1347
- React.createElement("div", { style: {
1348
- backgroundColor: "#f0f9ff",
1349
- padding: "12px",
1350
- borderRadius: "8px",
1351
- marginBottom: "16px",
1352
- border: "1px solid #0ea5e9",
1353
- } },
1354
- React.createElement("p", { style: {
1355
- fontSize: "14px",
1356
- color: "#0c4a6e",
1357
- margin: "0",
1358
- fontWeight: "500",
1359
- } }, "\uD83D\uDD12 Anonymous Authentication"),
1360
- React.createElement("p", { style: { fontSize: "13px", color: "#075985", margin: "4px 0 0 0" } }, "Enter your trapdoor (recovery phrase) to login anonymously using Zero-Knowledge Proofs. Your identity remains private.")),
1361
- React.createElement("div", { className: "shogun-form-group" },
1362
- React.createElement("label", { htmlFor: "zkTrapdoor" },
1363
- React.createElement(KeyIcon, null),
1364
- React.createElement("span", null, "Trapdoor / Recovery Phrase")),
1365
- React.createElement("textarea", { id: "zkTrapdoor", value: zkTrapdoor, onChange: (e) => setZkTrapdoor(e.target.value), disabled: loading, placeholder: "Enter your trapdoor...", rows: 4, style: {
1366
- fontFamily: "monospace",
1367
- fontSize: "12px",
1368
- width: "100%",
1369
- padding: "8px",
1370
- border: "1px solid #ccc",
1371
- borderRadius: "4px",
1372
- } })),
1373
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleZkProofLogin, disabled: loading || !zkTrapdoor.trim() }, loading ? "Processing..." : "Login Anonymously"),
1374
- React.createElement("div", { className: "shogun-form-footer" },
1375
- React.createElement("button", { className: "shogun-toggle-mode", onClick: () => setAuthView("options"), disabled: loading }, "Back to Login Options"))));
1376
- const renderZkProofSignupResult = () => (React.createElement("div", { className: "shogun-auth-form" },
1377
- React.createElement("h3", null, "ZK-Proof Account Created!"),
1378
- React.createElement("div", { style: {
1379
- backgroundColor: "#fef3c7",
1380
- padding: "12px",
1381
- borderRadius: "8px",
1382
- marginBottom: "16px",
1383
- border: "1px solid #f59e0b",
1384
- } },
1385
- React.createElement("p", { style: {
1386
- fontSize: "14px",
1387
- color: "#92400e",
1388
- margin: "0",
1389
- fontWeight: "500",
1390
- } }, "\u26A0\uFE0F Important: Save Your Trapdoor"),
1391
- React.createElement("p", { style: { fontSize: "13px", color: "#a16207", margin: "4px 0 0 0" } }, "This trapdoor lets you restore your anonymous identity on new devices. Store it securely and never share it.")),
1392
- React.createElement("div", { className: "shogun-form-group" },
1393
- React.createElement("label", null, "Your Trapdoor (Recovery Phrase):"),
1394
- React.createElement("textarea", { value: zkSignupTrapdoor, readOnly: true, rows: 4, style: {
1395
- fontFamily: "monospace",
1396
- fontSize: "12px",
1397
- width: "100%",
1398
- padding: "8px",
1399
- border: "2px solid #f59e0b",
1400
- borderRadius: "4px",
1401
- backgroundColor: "#fffbeb",
1402
- } }),
1403
- React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "8px" }, onClick: async () => {
1404
- if (!zkSignupTrapdoor) {
1405
- return;
1406
- }
1407
- try {
1408
- if (navigator.clipboard) {
1409
- await navigator.clipboard.writeText(zkSignupTrapdoor);
1410
- setShowZkTrapdoorCopySuccess(true);
1411
- setTimeout(() => setShowZkTrapdoorCopySuccess(false), 3000);
1412
- }
1413
- }
1414
- catch (copyError) {
1415
- console.warn("Failed to copy trapdoor:", copyError);
1416
- }
1417
- }, disabled: !zkSignupTrapdoor }, "Copy Trapdoor"),
1418
- showZkTrapdoorCopySuccess && (React.createElement("p", { style: {
1419
- color: "#047857",
1420
- fontSize: "12px",
1421
- marginTop: "6px",
1422
- } }, "Trapdoor copied to clipboard!"))),
1423
- React.createElement("div", { className: "shogun-form-footer" },
1424
- React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: finalizeZkProofSignup }, "I Saved My Trapdoor"))));
1425
1126
  const renderWebauthnSignupResult = () => (React.createElement("div", { className: "shogun-auth-form" },
1426
1127
  React.createElement("h3", null, "WebAuthn Account Created!"),
1427
1128
  React.createElement("div", { style: {
@@ -1467,7 +1168,7 @@ export const ShogunButton = (() => {
1467
1168
  border: "1px solid #22c55e",
1468
1169
  textAlign: "center",
1469
1170
  } }, "\u2705 You're now logged in with WebAuthn!"),
1470
- React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "16px" }, onClick: finalizeZkProofSignup }, "Close and Start Using App")));
1171
+ React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "16px" }, onClick: finalizeSignup }, "Close and Start Using App")));
1471
1172
  const renderChallengeForm = () => (React.createElement("div", { className: "shogun-auth-form" },
1472
1173
  React.createElement("div", { className: "shogun-form-group" },
1473
1174
  React.createElement("label", { htmlFor: "challenge-username" },
@@ -1559,23 +1260,17 @@ export const ShogunButton = (() => {
1559
1260
  modalIsOpen && (React.createElement("div", { className: "shogun-modal-overlay", onClick: closeModal },
1560
1261
  React.createElement("div", { className: "shogun-modal", onClick: (e) => e.stopPropagation() },
1561
1262
  React.createElement("div", { className: "shogun-modal-header" },
1562
- React.createElement("h2", null, authView === "recover"
1563
- ? "Recover Password"
1564
- : authView === "showHint"
1565
- ? "Password Hint"
1566
- : authView === "export"
1567
- ? "Export Gun Pair"
1568
- : authView === "import"
1569
- ? "Import Gun Pair"
1570
- : authView === "webauthn-username"
1571
- ? "WebAuthn"
1572
- : authView === "zkproof-login"
1573
- ? "ZK-Proof Login"
1574
- : authView === "seed-login"
1575
- ? "Login with Seed"
1576
- : formMode === "login"
1577
- ? "Login"
1578
- : "Sign Up"),
1263
+ React.createElement("h2", null, authView === "export"
1264
+ ? "Export Gun Pair"
1265
+ : authView === "import"
1266
+ ? "Import Gun Pair"
1267
+ : authView === "webauthn-username"
1268
+ ? "WebAuthn"
1269
+ : authView === "seed-login"
1270
+ ? "Login with Seed"
1271
+ : formMode === "login"
1272
+ ? "Login"
1273
+ : "Sign Up"),
1579
1274
  React.createElement("button", { className: "shogun-close-button", onClick: closeModal, "aria-label": "Close" },
1580
1275
  React.createElement(CloseIcon, null))),
1581
1276
  React.createElement("div", { className: "shogun-modal-content" },
@@ -1590,8 +1285,6 @@ export const ShogunButton = (() => {
1590
1285
  authView === "password" && (React.createElement(React.Fragment, null,
1591
1286
  React.createElement("button", { className: "shogun-back-button", onClick: () => setAuthView("options") }, "\u2190 Back"),
1592
1287
  renderPasswordForm())),
1593
- authView === "recover" && renderRecoveryForm(),
1594
- authView === "showHint" && renderHint(),
1595
1288
  authView === "export" && renderExportForm(),
1596
1289
  authView === "import" && renderImportForm(),
1597
1290
  authView === "webauthn-username" &&
@@ -1600,11 +1293,7 @@ export const ShogunButton = (() => {
1600
1293
  renderWebauthnRecoveryForm(),
1601
1294
  authView === "webauthn-signup-result" &&
1602
1295
  renderWebauthnSignupResult(),
1603
- authView === "zkproof-login" && renderZkProofLoginForm(),
1604
- authView === "zkproof-signup-result" &&
1605
- renderZkProofSignupResult(),
1606
- authView === "challenge-username" &&
1607
- renderChallengeForm()))))));
1296
+ authView === "challenge-username" && renderChallengeForm()))))));
1608
1297
  };
1609
1298
  Button.displayName = "ShogunButton";
1610
1299
  return Object.assign(Button, {
package/dist/connector.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ShogunCore } from "shogun-core";
2
2
  export async function shogunConnector(options) {
3
- const { gunInstance, appName, timeouts, webauthn, nostr, web3, zkproof, challenge, showWebauthn, showNostr, showMetamask, showZkProof, showChallenge, darkMode, enableGunDebug = true, enableConnectionMonitoring = true, defaultPageSize = 20, connectionTimeout = 10000, debounceInterval = 100, crypto, ...restOptions } = options;
3
+ const { gunInstance, appName, timeouts, webauthn, nostr, web3, challenge, showWebauthn, showNostr, showMetamask, showChallenge, darkMode, enableGunDebug = true, enableConnectionMonitoring = true, defaultPageSize = 20, connectionTimeout = 10000, debounceInterval = 100, crypto, ...restOptions } = options;
4
4
  let core = null;
5
5
  let gun = null;
6
6
  gun = gunInstance;
@@ -14,10 +14,6 @@ export async function shogunConnector(options) {
14
14
  } : undefined,
15
15
  web3: (web3 === null || web3 === void 0 ? void 0 : web3.enabled) ? { enabled: true } : undefined,
16
16
  nostr: (nostr === null || nostr === void 0 ? void 0 : nostr.enabled) ? { enabled: true } : undefined,
17
- zkproof: (zkproof === null || zkproof === void 0 ? void 0 : zkproof.enabled) ? {
18
- enabled: true,
19
- defaultGroupId: zkproof.defaultGroupId || "shogun-users",
20
- } : undefined,
21
17
  challenge: (challenge === null || challenge === void 0 ? void 0 : challenge.enabled) ? { enabled: true } : undefined,
22
18
  timeouts,
23
19
  silent: false, // Enable console logs for debugging