shogun-button-react 6.3.3 → 6.3.5
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/components/ShogunButton.js +63 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -609,6 +609,7 @@ export const ShogunButton = (() => {
|
|
|
609
609
|
const [showImportSuccess, setShowImportSuccess] = useState(false);
|
|
610
610
|
const [zkTrapdoor, setZkTrapdoor] = useState("");
|
|
611
611
|
const [zkGeneratedTrapdoor, setZkGeneratedTrapdoor] = useState("");
|
|
612
|
+
const [webauthnSeedPhrase, setWebauthnSeedPhrase] = useState("");
|
|
612
613
|
const dropdownRef = useRef(null);
|
|
613
614
|
// Handle click outside to close dropdown
|
|
614
615
|
useEffect(() => {
|
|
@@ -670,7 +671,19 @@ export const ShogunButton = (() => {
|
|
|
670
671
|
window.location.href = result.redirectUrl;
|
|
671
672
|
}
|
|
672
673
|
else {
|
|
673
|
-
|
|
674
|
+
const shouldShowWebauthnSeed = formMode === "signup" &&
|
|
675
|
+
method === "webauthn" &&
|
|
676
|
+
result &&
|
|
677
|
+
result.success &&
|
|
678
|
+
result.seedPhrase;
|
|
679
|
+
if (shouldShowWebauthnSeed) {
|
|
680
|
+
setWebauthnSeedPhrase(result.seedPhrase);
|
|
681
|
+
setShowCopySuccess(false);
|
|
682
|
+
setAuthView("webauthn-signup-result");
|
|
683
|
+
}
|
|
684
|
+
else {
|
|
685
|
+
setModalIsOpen(false);
|
|
686
|
+
}
|
|
674
687
|
}
|
|
675
688
|
}
|
|
676
689
|
catch (e) {
|
|
@@ -895,6 +908,7 @@ export const ShogunButton = (() => {
|
|
|
895
908
|
setRecoveredHint("");
|
|
896
909
|
setZkTrapdoor("");
|
|
897
910
|
setZkGeneratedTrapdoor("");
|
|
911
|
+
setWebauthnSeedPhrase("");
|
|
898
912
|
};
|
|
899
913
|
const openModal = () => {
|
|
900
914
|
resetForm();
|
|
@@ -1127,6 +1141,52 @@ export const ShogunButton = (() => {
|
|
|
1127
1141
|
React.createElement("button", { type: "button", className: "shogun-submit-button", onClick: handleZkProofLogin, disabled: loading || !zkTrapdoor.trim() }, loading ? "Processing..." : "Login Anonymously"),
|
|
1128
1142
|
React.createElement("div", { className: "shogun-form-footer" },
|
|
1129
1143
|
React.createElement("button", { className: "shogun-toggle-mode", onClick: () => setAuthView("options"), disabled: loading }, "Back to Login Options"))));
|
|
1144
|
+
const renderWebauthnSignupResult = () => (React.createElement("div", { className: "shogun-auth-form" },
|
|
1145
|
+
React.createElement("h3", null, "WebAuthn Account Created!"),
|
|
1146
|
+
React.createElement("div", { style: {
|
|
1147
|
+
backgroundColor: "#fef3c7",
|
|
1148
|
+
padding: "12px",
|
|
1149
|
+
borderRadius: "8px",
|
|
1150
|
+
marginBottom: "16px",
|
|
1151
|
+
border: "1px solid #f59e0b",
|
|
1152
|
+
} },
|
|
1153
|
+
React.createElement("p", { style: {
|
|
1154
|
+
fontSize: "14px",
|
|
1155
|
+
color: "#92400e",
|
|
1156
|
+
margin: "0",
|
|
1157
|
+
fontWeight: "500",
|
|
1158
|
+
} }, "\u26A0\uFE0F Important: Save Your Recovery Code"),
|
|
1159
|
+
React.createElement("p", { style: { fontSize: "13px", color: "#a16207", margin: "4px 0 0 0" } }, "This seed phrase lets you add new devices or recover your WebAuthn account. Keep it private and store it securely.")),
|
|
1160
|
+
React.createElement("div", { className: "shogun-form-group" },
|
|
1161
|
+
React.createElement("label", null, "Your WebAuthn Recovery Code (Seed Phrase):"),
|
|
1162
|
+
React.createElement("textarea", { value: webauthnSeedPhrase, readOnly: true, rows: 4, style: {
|
|
1163
|
+
fontFamily: "monospace",
|
|
1164
|
+
fontSize: "12px",
|
|
1165
|
+
width: "100%",
|
|
1166
|
+
padding: "8px",
|
|
1167
|
+
border: "2px solid #f59e0b",
|
|
1168
|
+
borderRadius: "4px",
|
|
1169
|
+
backgroundColor: "#fffbeb",
|
|
1170
|
+
} }),
|
|
1171
|
+
React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "8px" }, onClick: async () => {
|
|
1172
|
+
if (navigator.clipboard && webauthnSeedPhrase) {
|
|
1173
|
+
await navigator.clipboard.writeText(webauthnSeedPhrase);
|
|
1174
|
+
setShowCopySuccess(true);
|
|
1175
|
+
setTimeout(() => setShowCopySuccess(false), 3000);
|
|
1176
|
+
}
|
|
1177
|
+
}, disabled: !webauthnSeedPhrase }, showCopySuccess ? "✅ Copied!" : "📋 Copy Recovery Code"),
|
|
1178
|
+
!navigator.clipboard && (React.createElement("p", { style: { fontSize: "12px", color: "#666", marginTop: "8px" } }, "\u26A0\uFE0F Please manually copy the code above for safekeeping."))),
|
|
1179
|
+
React.createElement("div", { style: {
|
|
1180
|
+
backgroundColor: "#dcfce7",
|
|
1181
|
+
color: "#166534",
|
|
1182
|
+
padding: "12px",
|
|
1183
|
+
borderRadius: "8px",
|
|
1184
|
+
marginTop: "16px",
|
|
1185
|
+
fontSize: "14px",
|
|
1186
|
+
border: "1px solid #22c55e",
|
|
1187
|
+
textAlign: "center",
|
|
1188
|
+
} }, "\u2705 You're now logged in with WebAuthn!"),
|
|
1189
|
+
React.createElement("button", { type: "button", className: "shogun-submit-button", style: { marginTop: "16px" }, onClick: () => setModalIsOpen(false) }, "Close and Continue")));
|
|
1130
1190
|
const renderZkProofSignupResult = () => (React.createElement("div", { className: "shogun-auth-form" },
|
|
1131
1191
|
React.createElement("h3", null, "ZK-Proof Account Created!"),
|
|
1132
1192
|
React.createElement("div", { style: {
|
|
@@ -1271,6 +1331,8 @@ export const ShogunButton = (() => {
|
|
|
1271
1331
|
authView === "import" && renderImportForm(),
|
|
1272
1332
|
authView === "webauthn-username" &&
|
|
1273
1333
|
renderWebAuthnUsernameForm(),
|
|
1334
|
+
authView === "webauthn-signup-result" &&
|
|
1335
|
+
renderWebauthnSignupResult(),
|
|
1274
1336
|
authView === "zkproof-login" && renderZkProofLoginForm(),
|
|
1275
1337
|
authView === "zkproof-signup-result" &&
|
|
1276
1338
|
renderZkProofSignupResult()))))));
|