@orangecheck/auth-client 2.22.1 → 2.24.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/index.mjs CHANGED
@@ -1998,15 +1998,27 @@ var primaryChipStyle = {
1998
1998
  color: V.primary,
1999
1999
  border: `1px solid ${V.primary}`
2000
2000
  };
2001
+ function isSameOriginPath(candidate, origin) {
2002
+ try {
2003
+ return new URL(candidate, origin).origin === origin;
2004
+ } catch {
2005
+ return false;
2006
+ }
2007
+ }
2008
+ function resolutionOrigin() {
2009
+ return typeof window === "undefined" ? "https://ochk.io" : window.location.origin;
2010
+ }
2001
2011
  function safeReturnTo(input) {
2002
2012
  const candidate = input ?? "/";
2003
2013
  if (typeof candidate !== "string") return "/";
2004
- if (!candidate.startsWith("/") || candidate.startsWith("//")) return "/";
2005
- return candidate;
2014
+ if (!candidate.startsWith("/")) return "/";
2015
+ return isSameOriginPath(candidate, resolutionOrigin()) ? candidate : "/";
2006
2016
  }
2007
2017
  function familyReturnTarget(input) {
2008
2018
  if (typeof input !== "string" || input.length === 0) return void 0;
2009
- if (input.startsWith("/") && !input.startsWith("//")) return input;
2019
+ if (input.startsWith("/") && isSameOriginPath(input, resolutionOrigin())) {
2020
+ return input;
2021
+ }
2010
2022
  try {
2011
2023
  const u = new URL(input);
2012
2024
  if (u.protocol !== "https:") return void 0;
@@ -2625,7 +2637,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2625
2637
  }
2626
2638
  if (stage === "enter") {
2627
2639
  return /* @__PURE__ */ jsxs("form", { onSubmit: start, "data-oc-signin-email": "", children: [
2628
- /* @__PURE__ */ jsx(FlowHeader, { label: "\xA7 email + otp", children: "We email you a 6-digit code. No password. The federation provisions a custodial wallet for you in your browser. Best path if you don't have a Bitcoin wallet yet \u2014 graduate to self-custody anytime by adding your BTC address from your account dashboard." }),
2640
+ /* @__PURE__ */ jsx(FlowHeader, { label: "\xA7 email + otp", children: "We email you a 6-digit code. No password, and no wallet needed to start. Link a Bitcoin address any time \u2014 that is the identity you hold yourself." }),
2629
2641
  /* @__PURE__ */ jsx(Label, { children: "email" }),
2630
2642
  /* @__PURE__ */ jsx(
2631
2643
  "input",
@@ -2645,7 +2657,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
2645
2657
  ),
2646
2658
  emailError && /* @__PURE__ */ jsx(ErrorLine2, { children: emailError }),
2647
2659
  /* @__PURE__ */ jsx("button", { type: "submit", disabled: submitting, style: submitStyle(submitting), children: submitting ? "sending\u2026" : "send one-time code \u2192" }),
2648
- /* @__PURE__ */ jsx(Hint, { children: "OTP delivered by the auth host. Codes expire in 10 minutes and are single-use. Rate-limited 5 starts/hour/IP." })
2660
+ /* @__PURE__ */ jsx(Hint, { children: "Codes come from the auth host, expire in 10 minutes, and work once." })
2649
2661
  ] });
2650
2662
  }
2651
2663
  return /* @__PURE__ */ jsxs("form", { onSubmit: verify, "data-oc-signin-email-verify": "", children: [
@@ -3100,6 +3112,6 @@ function handleSudoRequired(body, args = {}) {
3100
3112
  return false;
3101
3113
  }
3102
3114
 
3103
- export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, OcAccountChip, OcAccountPill, OcAddressInput, OcLinkedIdentities, OcSessionProvider, OcSignIn, OcSignInButton, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
3115
+ export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, OcAccountChip, OcAccountPill, OcAddressInput, OcLinkedIdentities, OcSessionProvider, OcSignIn, OcSignInButton, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, familyReturnTarget, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, safeReturnTo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
3104
3116
  //# sourceMappingURL=index.mjs.map
3105
3117
  //# sourceMappingURL=index.mjs.map