@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.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +19 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -134,6 +134,8 @@ interface OcSignInProps {
|
|
|
134
134
|
add?: boolean;
|
|
135
135
|
className?: string;
|
|
136
136
|
}
|
|
137
|
+
declare function safeReturnTo(input: string | undefined): string;
|
|
138
|
+
declare function familyReturnTarget(input: string | undefined | null): string | undefined;
|
|
137
139
|
declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, linkPrompt, add: addProp, authOrigin, initialPath, providersFirst, paths, className, }: OcSignInProps): React.ReactElement;
|
|
138
140
|
|
|
139
141
|
interface OcLinkedIdentity {
|
|
@@ -253,4 +255,4 @@ declare function handleSudoRequired(body: {
|
|
|
253
255
|
returnTo?: string;
|
|
254
256
|
}): boolean;
|
|
255
257
|
|
|
256
|
-
export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, type DisplayIdentity, type DisplayIdentityKind, type OcAccount, OcAccountChip, type OcAccountChipProps, OcAccountPill, type OcAccountPillProps, type OcAccountSummary, OcAddressInput, type OcAddressInputProps, type OcAuthConfig, OcLinkedIdentities, type OcLinkedIdentitiesProps, type OcLinkedIdentity, OcSessionProvider, type OcSessionState, type OcSessionStatus, OcSignIn, OcSignInButton, type OcSignInButtonProps, type OcSignInProps, type OcSignOutScope, type OcTabSession, type RedirectToSudoArgs, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, type UseOcAddressSuggestionOptions, type UseOcAddressSuggestionReturn, type UseStepUpAuthReturn, type UseWebAuthnListReturn, type UseWebAuthnRegisterReturn, type WebAuthnAssertionStatus, type WebAuthnCredentialPublic, type WebAuthnListStatus, type WebAuthnRegisterResult, type WebAuthnRegisterStatus, type WebAuthnRemoveResult, type WebAuthnRenameResult, type WebAuthnStepUpResult, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
|
|
258
|
+
export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, type DisplayIdentity, type DisplayIdentityKind, type OcAccount, OcAccountChip, type OcAccountChipProps, OcAccountPill, type OcAccountPillProps, type OcAccountSummary, OcAddressInput, type OcAddressInputProps, type OcAuthConfig, OcLinkedIdentities, type OcLinkedIdentitiesProps, type OcLinkedIdentity, OcSessionProvider, type OcSessionState, type OcSessionStatus, OcSignIn, OcSignInButton, type OcSignInButtonProps, type OcSignInProps, type OcSignOutScope, type OcTabSession, type RedirectToSudoArgs, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, type UseOcAddressSuggestionOptions, type UseOcAddressSuggestionReturn, type UseStepUpAuthReturn, type UseWebAuthnListReturn, type UseWebAuthnRegisterReturn, type WebAuthnAssertionStatus, type WebAuthnCredentialPublic, type WebAuthnListStatus, type WebAuthnRegisterResult, type WebAuthnRegisterStatus, type WebAuthnRemoveResult, type WebAuthnRenameResult, type WebAuthnStepUpResult, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, familyReturnTarget, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, safeReturnTo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
|
package/dist/index.d.ts
CHANGED
|
@@ -134,6 +134,8 @@ interface OcSignInProps {
|
|
|
134
134
|
add?: boolean;
|
|
135
135
|
className?: string;
|
|
136
136
|
}
|
|
137
|
+
declare function safeReturnTo(input: string | undefined): string;
|
|
138
|
+
declare function familyReturnTarget(input: string | undefined | null): string | undefined;
|
|
137
139
|
declare function OcSignIn({ audience, returnTo, onSuccess, resolveReturnTo, linkPrompt, add: addProp, authOrigin, initialPath, providersFirst, paths, className, }: OcSignInProps): React.ReactElement;
|
|
138
140
|
|
|
139
141
|
interface OcLinkedIdentity {
|
|
@@ -253,4 +255,4 @@ declare function handleSudoRequired(body: {
|
|
|
253
255
|
returnTo?: string;
|
|
254
256
|
}): boolean;
|
|
255
257
|
|
|
256
|
-
export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, type DisplayIdentity, type DisplayIdentityKind, type OcAccount, OcAccountChip, type OcAccountChipProps, OcAccountPill, type OcAccountPillProps, type OcAccountSummary, OcAddressInput, type OcAddressInputProps, type OcAuthConfig, OcLinkedIdentities, type OcLinkedIdentitiesProps, type OcLinkedIdentity, OcSessionProvider, type OcSessionState, type OcSessionStatus, OcSignIn, OcSignInButton, type OcSignInButtonProps, type OcSignInProps, type OcSignOutScope, type OcTabSession, type RedirectToSudoArgs, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, type UseOcAddressSuggestionOptions, type UseOcAddressSuggestionReturn, type UseStepUpAuthReturn, type UseWebAuthnListReturn, type UseWebAuthnRegisterReturn, type WebAuthnAssertionStatus, type WebAuthnCredentialPublic, type WebAuthnListStatus, type WebAuthnRegisterResult, type WebAuthnRegisterStatus, type WebAuthnRemoveResult, type WebAuthnRenameResult, type WebAuthnStepUpResult, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
|
|
258
|
+
export { DEFAULT_CONFIG, DISPLAY_IDENTITY_KINDS, type DisplayIdentity, type DisplayIdentityKind, type OcAccount, OcAccountChip, type OcAccountChipProps, OcAccountPill, type OcAccountPillProps, type OcAccountSummary, OcAddressInput, type OcAddressInputProps, type OcAuthConfig, OcLinkedIdentities, type OcLinkedIdentitiesProps, type OcLinkedIdentity, OcSessionProvider, type OcSessionState, type OcSessionStatus, OcSignIn, OcSignInButton, type OcSignInButtonProps, type OcSignInProps, type OcSignOutScope, type OcTabSession, type RedirectToSudoArgs, TAB_ACCOUNT_HINT_KEY, TAB_ADOPT_HASH, TAB_SESSION_HEADER, TAB_SESSION_STORAGE_KEY, type UseOcAddressSuggestionOptions, type UseOcAddressSuggestionReturn, type UseStepUpAuthReturn, type UseWebAuthnListReturn, type UseWebAuthnRegisterReturn, type WebAuthnAssertionStatus, type WebAuthnCredentialPublic, type WebAuthnListStatus, type WebAuthnRegisterResult, type WebAuthnRegisterStatus, type WebAuthnRemoveResult, type WebAuthnRenameResult, type WebAuthnStepUpResult, buildAddAccountUrl, buildSignInUrl, clearTabSession, consumeTabAccountHint, consumeTabAdoptMarker, familyReturnTarget, fetchOcLinkedIdentities, handleSudoRequired, installTabFetchInterceptor, installTabLinkDecorator, readTabSession, redirectToSudo, safeReturnTo, tabSessionHeader, useOcAddressSuggestion, useOcSession, useOptionalOcSession, useStepUpAuth, useWebAuthnList, useWebAuthnRegister, writeTabSession };
|
package/dist/index.js
CHANGED
|
@@ -2020,15 +2020,27 @@ var primaryChipStyle = {
|
|
|
2020
2020
|
color: V.primary,
|
|
2021
2021
|
border: `1px solid ${V.primary}`
|
|
2022
2022
|
};
|
|
2023
|
+
function isSameOriginPath(candidate, origin) {
|
|
2024
|
+
try {
|
|
2025
|
+
return new URL(candidate, origin).origin === origin;
|
|
2026
|
+
} catch {
|
|
2027
|
+
return false;
|
|
2028
|
+
}
|
|
2029
|
+
}
|
|
2030
|
+
function resolutionOrigin() {
|
|
2031
|
+
return typeof window === "undefined" ? "https://ochk.io" : window.location.origin;
|
|
2032
|
+
}
|
|
2023
2033
|
function safeReturnTo(input) {
|
|
2024
2034
|
const candidate = input ?? "/";
|
|
2025
2035
|
if (typeof candidate !== "string") return "/";
|
|
2026
|
-
if (!candidate.startsWith("/")
|
|
2027
|
-
return candidate;
|
|
2036
|
+
if (!candidate.startsWith("/")) return "/";
|
|
2037
|
+
return isSameOriginPath(candidate, resolutionOrigin()) ? candidate : "/";
|
|
2028
2038
|
}
|
|
2029
2039
|
function familyReturnTarget(input) {
|
|
2030
2040
|
if (typeof input !== "string" || input.length === 0) return void 0;
|
|
2031
|
-
if (input.startsWith("/") &&
|
|
2041
|
+
if (input.startsWith("/") && isSameOriginPath(input, resolutionOrigin())) {
|
|
2042
|
+
return input;
|
|
2043
|
+
}
|
|
2032
2044
|
try {
|
|
2033
2045
|
const u = new URL(input);
|
|
2034
2046
|
if (u.protocol !== "https:") return void 0;
|
|
@@ -2647,7 +2659,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
|
|
|
2647
2659
|
}
|
|
2648
2660
|
if (stage === "enter") {
|
|
2649
2661
|
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: start, "data-oc-signin-email": "", children: [
|
|
2650
|
-
/* @__PURE__ */ jsxRuntime.jsx(FlowHeader, { label: "\xA7 email + otp", children: "We email you a 6-digit code. No password
|
|
2662
|
+
/* @__PURE__ */ jsxRuntime.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." }),
|
|
2651
2663
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { children: "email" }),
|
|
2652
2664
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2653
2665
|
"input",
|
|
@@ -2667,7 +2679,7 @@ function EmailFlow({ authOrigin, add, onSuccess }) {
|
|
|
2667
2679
|
),
|
|
2668
2680
|
emailError && /* @__PURE__ */ jsxRuntime.jsx(ErrorLine2, { children: emailError }),
|
|
2669
2681
|
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", disabled: submitting, style: submitStyle(submitting), children: submitting ? "sending\u2026" : "send one-time code \u2192" }),
|
|
2670
|
-
/* @__PURE__ */ jsxRuntime.jsx(Hint, { children: "
|
|
2682
|
+
/* @__PURE__ */ jsxRuntime.jsx(Hint, { children: "Codes come from the auth host, expire in 10 minutes, and work once." })
|
|
2671
2683
|
] });
|
|
2672
2684
|
}
|
|
2673
2685
|
return /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: verify, "data-oc-signin-email-verify": "", children: [
|
|
@@ -3140,12 +3152,14 @@ exports.buildSignInUrl = buildSignInUrl;
|
|
|
3140
3152
|
exports.clearTabSession = clearTabSession;
|
|
3141
3153
|
exports.consumeTabAccountHint = consumeTabAccountHint;
|
|
3142
3154
|
exports.consumeTabAdoptMarker = consumeTabAdoptMarker;
|
|
3155
|
+
exports.familyReturnTarget = familyReturnTarget;
|
|
3143
3156
|
exports.fetchOcLinkedIdentities = fetchOcLinkedIdentities;
|
|
3144
3157
|
exports.handleSudoRequired = handleSudoRequired;
|
|
3145
3158
|
exports.installTabFetchInterceptor = installTabFetchInterceptor;
|
|
3146
3159
|
exports.installTabLinkDecorator = installTabLinkDecorator;
|
|
3147
3160
|
exports.readTabSession = readTabSession;
|
|
3148
3161
|
exports.redirectToSudo = redirectToSudo;
|
|
3162
|
+
exports.safeReturnTo = safeReturnTo;
|
|
3149
3163
|
exports.tabSessionHeader = tabSessionHeader;
|
|
3150
3164
|
exports.useOcAddressSuggestion = useOcAddressSuggestion;
|
|
3151
3165
|
exports.useOcSession = useOcSession;
|