@openfort/react 0.0.11 → 0.0.13
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/build/assets/browsers.d.ts +1 -1
- package/build/assets/chains.d.ts +6 -0
- package/build/assets/logos.d.ts +4 -0
- package/build/components/Common/ConnectorList/styles.d.ts +1 -0
- package/build/components/Common/Modal/index.d.ts +2 -1
- package/build/components/Common/Modal/styles.d.ts +3 -1
- package/build/components/Openfort/OpenfortProvider.d.ts +25 -12
- package/build/components/Openfort/context.d.ts +2 -0
- package/build/components/Openfort/types.d.ts +20 -15
- package/build/components/Pages/Connectors/styles.d.ts +1 -0
- package/build/components/Pages/EmailLogin/styles.d.ts +1 -0
- package/build/components/Pages/Providers/styles.d.ts +2 -0
- package/build/components/PasswordStrength/password-utility.d.ts +50 -16
- package/build/components/contexts/web3/index.d.ts +18 -1
- package/build/constants/openfort.d.ts +0 -1
- package/build/defaultTransports.d.ts +27 -4
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +63 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.d.ts +26 -4
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +71 -0
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +59 -0
- package/build/hooks/openfort/auth/useOAuth.d.ts +74 -0
- package/build/hooks/openfort/auth/useSignOut.d.ts +57 -0
- package/build/hooks/openfort/useStatus.d.ts +42 -0
- package/build/hooks/openfort/useUI.d.ts +63 -0
- package/build/hooks/openfort/useUser.d.ts +44 -0
- package/build/hooks/openfort/useWallet.d.ts +50 -0
- package/build/hooks/openfort/useWallets.d.ts +56 -0
- package/build/hooks/useChainIsSupported.d.ts +24 -1
- package/build/hooks/useChains.d.ts +39 -0
- package/build/hooks/useConnect.d.ts +18 -10
- package/build/hooks/useConnectors.d.ts +7 -5
- package/build/hooks/useLocales.d.ts +2 -1
- package/build/index.es.js +3624 -2703
- package/build/index.es.js.map +1 -1
- package/build/localizations/index.d.ts +5 -0
- package/build/localizations/locales/ar-AE.d.ts +1 -1
- package/build/localizations/locales/ee-EE.d.ts +1 -1
- package/build/localizations/locales/en-US.d.ts +5 -0
- package/build/localizations/locales/es-ES.d.ts +1 -1
- package/build/localizations/locales/fa-IR.d.ts +1 -1
- package/build/localizations/locales/fr-FR.d.ts +1 -1
- package/build/localizations/locales/ja-JP.d.ts +3 -93
- package/build/localizations/locales/pt-BR.d.ts +1 -1
- package/build/localizations/locales/ru-RU.d.ts +1 -1
- package/build/localizations/locales/tr-TR.d.ts +1 -1
- package/build/localizations/locales/vi-VN.d.ts +1 -1
- package/build/localizations/locales/zh-CN.d.ts +1 -1
- package/build/openfort/core/client.d.ts +26 -7
- package/build/styles/styled/index.d.ts +5 -7
- package/build/styles/themes/base.d.ts +12 -12
- package/build/styles/themes/minimal.d.ts +2 -17
- package/build/styles/themes/retro.d.ts +3 -1
- package/build/styles/themes/rounded.d.ts +3 -1
- package/build/styles/themes/web95.d.ts +3 -1
- package/build/utils/index.d.ts +3 -0
- package/build/utils/localstorage.d.ts +61 -2
- package/build/utils/wallets.d.ts +2 -0
- package/build/version.d.ts +1 -1
- package/build/wallets/walletConfigs.d.ts +2 -2
- package/package.json +1 -1
- package/build/components/Pages/EmailSignup/index.d.ts +0 -3
package/build/assets/chains.d.ts
CHANGED
|
@@ -2,6 +2,9 @@ type Logo = {
|
|
|
2
2
|
testnet?: boolean;
|
|
3
3
|
};
|
|
4
4
|
export declare const Ethereum: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const LensChain: ({ testnet, ...props }: {
|
|
6
|
+
testnet?: boolean;
|
|
7
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
5
8
|
export declare const Polygon: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
|
6
9
|
export declare const Optimism: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
|
7
10
|
export declare const Arbitrum: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,6 +14,9 @@ declare const _default: {
|
|
|
11
14
|
Base: ({ testnet, ...props }: {
|
|
12
15
|
testnet?: boolean;
|
|
13
16
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
LensChain: ({ testnet, ...props }: {
|
|
18
|
+
testnet?: boolean;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
20
|
Ethereum: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
|
15
21
|
Polygon: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
|
16
22
|
Optimism: ({ testnet, ...props }: Logo) => import("react/jsx-runtime").JSX.Element;
|
package/build/assets/logos.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const Coinbase: ({ background, ...props }: {
|
|
|
16
16
|
[x: string]: any;
|
|
17
17
|
background?: boolean | undefined;
|
|
18
18
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const FamilyAccount: () => import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export declare const Family: ({ ...props }: {
|
|
20
21
|
[x: string]: any;
|
|
21
22
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -87,6 +88,8 @@ export declare const providersLogos: {
|
|
|
87
88
|
google: import("react/jsx-runtime").JSX.Element;
|
|
88
89
|
twitter: import("react/jsx-runtime").JSX.Element;
|
|
89
90
|
facebook: import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
discord: import("react/jsx-runtime").JSX.Element;
|
|
92
|
+
apple: import("react/jsx-runtime").JSX.Element;
|
|
90
93
|
};
|
|
91
94
|
declare const _default: {
|
|
92
95
|
Mock: ({ ...props }: {
|
|
@@ -113,6 +116,7 @@ declare const _default: {
|
|
|
113
116
|
Family: ({ ...props }: {
|
|
114
117
|
[x: string]: any;
|
|
115
118
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
119
|
+
FamilyAccount: () => import("react/jsx-runtime").JSX.Element;
|
|
116
120
|
Trust: ({ theme, ...props }: {
|
|
117
121
|
[x: string]: any;
|
|
118
122
|
theme?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const ConnectorButton: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLButtonElement, import("framer-motion").HTMLMotionProps<"button">>, any, {}, never>;
|
|
2
|
+
export declare const ConnectorAnchor: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLAnchorElement, import("framer-motion").HTMLMotionProps<"a">>, any, {}, never>;
|
|
2
3
|
export declare const ConnectorLabel: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLSpanElement, import("framer-motion").HTMLMotionProps<"span">>, any, {}, never>;
|
|
3
4
|
export declare const ConnectorIcon: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
4
5
|
export declare const RecentlyUsedTag: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLSpanElement, import("framer-motion").HTMLMotionProps<"span">>, any, {}, never>;
|
|
@@ -18,7 +18,8 @@ type ModalProps = {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
declare const Modal: React.FC<ModalProps>;
|
|
21
|
-
export declare const OrDivider: ({ children }: {
|
|
21
|
+
export declare const OrDivider: ({ children, hideHr, }: {
|
|
22
22
|
children?: React.ReactNode;
|
|
23
|
+
hideHr?: boolean;
|
|
23
24
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
export default Modal;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const ErrorMessage: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
2
2
|
export declare const PageContent: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
3
|
-
export declare const TextWithHr: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
|
|
3
|
+
export declare const TextWithHr: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {
|
|
4
|
+
$disableHr?: boolean;
|
|
5
|
+
}, never>;
|
|
4
6
|
export declare const ModalHeading: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
5
7
|
export declare const ModalContentContainer: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
6
8
|
export declare const ModalContent: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
@@ -13,19 +13,32 @@ type OpenfortProviderProps = {
|
|
|
13
13
|
thirdPartyAuth?: ThirdPartyAuthConfiguration;
|
|
14
14
|
} & useConnectCallbackProps;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
* It must be used within a WagmiProvider.
|
|
16
|
+
* Provides Openfort configuration and context to descendant components.
|
|
18
17
|
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* @param
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
25
|
-
*
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
28
|
-
*
|
|
18
|
+
* The provider must be rendered within a {@link WagmiContext} and should only be mounted once
|
|
19
|
+
* to avoid conflicting global state. See {@link OpenfortProviderProps} for the supported options.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Provider configuration including callbacks, UI options and the wrapped children.
|
|
22
|
+
* @returns A React element that sets up the Openfort context.
|
|
23
|
+
* @throws If the component is rendered outside of a Wagmi provider or mounted multiple times.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { WagmiConfig, createConfig } from 'wagmi';
|
|
28
|
+
* import { OpenfortProvider } from '@openfort/openfort-react';
|
|
29
|
+
*
|
|
30
|
+
* const config = createConfig({ YOU_WAGMI_CONFIG_HERE });
|
|
31
|
+
*
|
|
32
|
+
* export function App() {
|
|
33
|
+
* return (
|
|
34
|
+
* <WagmiConfig config={config}>
|
|
35
|
+
* <OpenfortProvider publishableKey={process.env.NEXT_PUBLIC_PUBLISHABLE_KEY!}>
|
|
36
|
+
* <YourApp />
|
|
37
|
+
* </OpenfortProvider>
|
|
38
|
+
* </WagmiConfig>
|
|
39
|
+
* );
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
29
42
|
*/
|
|
30
43
|
export declare const OpenfortProvider: ({ children, uiConfig, onConnect, onDisconnect, debugMode, publishableKey, walletConfig, overrides, thirdPartyAuth, }: OpenfortProviderProps) => React.FunctionComponentElement<React.ProviderProps<ContextValue | null>>;
|
|
31
44
|
export {};
|
|
@@ -35,6 +35,8 @@ export type ContextValue = {
|
|
|
35
35
|
walletConfig?: OpenfortWalletConfig;
|
|
36
36
|
overrides?: SDKOverrides;
|
|
37
37
|
thirdPartyAuth?: ThirdPartyAuthConfiguration;
|
|
38
|
+
emailInput: string;
|
|
39
|
+
setEmailInput: React.Dispatch<React.SetStateAction<string>>;
|
|
38
40
|
} & useConnectCallbackProps;
|
|
39
41
|
export declare const Openfortcontext: React.Context<ContextValue | null>;
|
|
40
42
|
export {};
|
|
@@ -8,7 +8,6 @@ export declare const routes: {
|
|
|
8
8
|
readonly LOADING: "loading";
|
|
9
9
|
readonly RECOVER: "recover";
|
|
10
10
|
readonly EMAIL_LOGIN: "emailLogin";
|
|
11
|
-
readonly EMAIL_SIGNUP: "emailSignup";
|
|
12
11
|
readonly FORGOT_PASSWORD: "forgotPassword";
|
|
13
12
|
readonly EMAIL_VERIFICATION: "emailVerification";
|
|
14
13
|
readonly LINK_EMAIL: "linkEmail";
|
|
@@ -25,6 +24,8 @@ export declare enum UIAuthProvider {
|
|
|
25
24
|
GOOGLE = "google",
|
|
26
25
|
TWITTER = "twitter",
|
|
27
26
|
FACEBOOK = "facebook",
|
|
27
|
+
DISCORD = "discord",
|
|
28
|
+
APPLE = "apple",
|
|
28
29
|
EMAIL = "email",
|
|
29
30
|
WALLET = "wallet",
|
|
30
31
|
GUEST = "guest"
|
|
@@ -32,33 +33,29 @@ export declare enum UIAuthProvider {
|
|
|
32
33
|
export declare const socialProviders: UIAuthProvider[];
|
|
33
34
|
type PolicyConfig = string | Record<number, string>;
|
|
34
35
|
type CommonWalletConfig = {
|
|
35
|
-
/** Publishable key for the Shield API */
|
|
36
|
+
/** Publishable key for the Shield API. */
|
|
36
37
|
shieldPublishableKey: string;
|
|
37
|
-
/** Policy ID (pol_...) for the embedded signer */
|
|
38
|
+
/** Policy ID (pol_...) for the embedded signer. */
|
|
38
39
|
ethereumProviderPolicyId?: PolicyConfig;
|
|
39
40
|
accountType?: AccountTypeEnum;
|
|
40
41
|
debug?: boolean;
|
|
41
42
|
};
|
|
42
43
|
type EncryptionSession = {
|
|
43
|
-
/** Function to retrieve an encryption session using a session ID */
|
|
44
|
+
/** Function to retrieve an encryption session using a session ID. */
|
|
44
45
|
getEncryptionSession?: (accessToken: string) => Promise<string>;
|
|
45
46
|
createEncryptedSessionEndpoint?: never;
|
|
46
47
|
} | {
|
|
47
|
-
/** API endpoint for creating an encrypted session */
|
|
48
|
+
/** API endpoint for creating an encrypted session. */
|
|
48
49
|
getEncryptionSession?: never;
|
|
49
50
|
createEncryptedSessionEndpoint?: string;
|
|
50
51
|
};
|
|
51
52
|
/**
|
|
52
|
-
* Configuration for
|
|
53
|
-
* - An encryption session is required.
|
|
53
|
+
* Configuration for wallet recovery behaviour.
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* Encryption session can be created using either:
|
|
60
|
-
* - `createEncryptedSessionEndpoint` as a string, OR
|
|
61
|
-
* - `getEncryptionSession.` as a function that returns a promise.
|
|
55
|
+
* @remarks
|
|
56
|
+
* Automatic recovery requires an encryption session, which may be supplied via
|
|
57
|
+
* the `createEncryptedSessionEndpoint` endpoint or the `getEncryptionSession` callback.
|
|
58
|
+
* Password-based and passkey-based recovery methods do not require encryption sessions.
|
|
62
59
|
*/
|
|
63
60
|
export type OpenfortWalletConfig = CommonWalletConfig & EncryptionSession;
|
|
64
61
|
export type OpenfortUIOptions = {
|
|
@@ -84,17 +81,20 @@ export type ConnectUIOptions = {
|
|
|
84
81
|
hideTooltips?: boolean;
|
|
85
82
|
hideRecentBadge?: boolean;
|
|
86
83
|
walletConnectCTA?: 'link' | 'modal' | 'both';
|
|
84
|
+
/** Avoids layout shift when the Openfort modal is open by adding padding to the body. */
|
|
87
85
|
avoidLayoutShift?: boolean;
|
|
86
|
+
/** Automatically embeds the Google font of the current theme. Does not work with custom themes. */
|
|
88
87
|
embedGoogleFonts?: boolean;
|
|
89
88
|
truncateLongENSAddress?: boolean;
|
|
90
89
|
walletConnectName?: string;
|
|
91
90
|
reducedMotion?: boolean;
|
|
92
91
|
disclaimer?: ReactNode | string;
|
|
93
|
-
/** Buffer
|
|
92
|
+
/** Buffer polyfill, needed for bundlers that do not provide Node polyfills (e.g. CRA, Vite, etc.). */
|
|
94
93
|
bufferPolyfill?: boolean;
|
|
95
94
|
customAvatar?: React.FC<CustomAvatarProps>;
|
|
96
95
|
initialChainId?: number;
|
|
97
96
|
enforceSupportedChains?: boolean;
|
|
97
|
+
/** Blur intensity applied to the background when the modal is open. */
|
|
98
98
|
overlayBlur?: number;
|
|
99
99
|
walletRecovery?: WalletRecoveryOptions;
|
|
100
100
|
} & Partial<OpenfortUIOptions>;
|
|
@@ -113,19 +113,24 @@ export type OpenfortUIOptionsExtended = {
|
|
|
113
113
|
hideNoWalletCTA?: boolean;
|
|
114
114
|
hideRecentBadge?: boolean;
|
|
115
115
|
walletConnectCTA?: 'link' | 'modal' | 'both';
|
|
116
|
+
/** Avoids layout shift when the Openfort modal is open by adding padding to the body. */
|
|
116
117
|
avoidLayoutShift?: boolean;
|
|
118
|
+
/** Automatically embeds the Google font of the current theme. Does not work with custom themes. */
|
|
117
119
|
embedGoogleFonts?: boolean;
|
|
118
120
|
truncateLongENSAddress?: boolean;
|
|
119
121
|
walletConnectName?: string;
|
|
120
122
|
reducedMotion?: boolean;
|
|
121
123
|
disclaimer?: ReactNode | string;
|
|
124
|
+
/** Buffer polyfill, needed for bundlers that do not provide Node polyfills (e.g. CRA, Vite, etc.). */
|
|
122
125
|
bufferPolyfill?: boolean;
|
|
123
126
|
customAvatar?: React.FC<CustomAvatarProps>;
|
|
124
127
|
initialChainId?: number;
|
|
125
128
|
enforceSupportedChains?: boolean;
|
|
126
129
|
ethereumOnboardingUrl?: string;
|
|
127
130
|
walletOnboardingUrl?: string;
|
|
131
|
+
/** Disable redirect to the SIWE page after a wallet is connected. */
|
|
128
132
|
disableSiweRedirect?: boolean;
|
|
133
|
+
/** Blur intensity applied to the background when the modal is open. */
|
|
129
134
|
overlayBlur?: number;
|
|
130
135
|
walletRecovery: WalletRecoveryOptionsExtended;
|
|
131
136
|
} & OpenfortUIOptions;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const Container: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
1
2
|
export declare const InfoBox: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
3
|
export declare const InfoBoxButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
4
|
export declare const LearnMoreContainer: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLDivElement, import("framer-motion").HTMLMotionProps<"div">>, any, {}, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const FooterContainer: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const ProviderInputInner: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
+
export declare const EmailInnerButton: import("styled-components").StyledComponent<import("framer-motion").ForwardRefComponent<HTMLButtonElement, import("framer-motion").HTMLMotionProps<"button">>, any, {}, never>;
|
|
1
3
|
export declare const ProvidersButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
4
|
export declare const ProviderLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
5
|
export declare const ProviderIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,52 +1,86 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Password
|
|
3
|
-
*
|
|
4
|
-
* and password validation.
|
|
2
|
+
* Password utility helpers for strength calculation and validation.
|
|
3
|
+
*
|
|
4
|
+
* Provides functions for password strength calculation, passphrase generation, and password validation.
|
|
5
5
|
*/
|
|
6
6
|
export declare const MEDIUM_SCORE_THRESHOLD = 0.5;
|
|
7
7
|
export declare const STRONG_SCORE_THRESHOLD = 0.75;
|
|
8
8
|
export declare const VERY_STRONG_SCORE_THRESHOLD = 0.9;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Password strength levels.
|
|
11
|
+
*/
|
|
10
12
|
export type PasswordStrengthLabel = 'Weak' | 'Medium' | 'Strong' | 'Very Strong';
|
|
11
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Password summary information.
|
|
15
|
+
*/
|
|
12
16
|
export interface PasswordSummary {
|
|
13
17
|
value: number;
|
|
14
18
|
label: PasswordStrengthLabel;
|
|
15
19
|
}
|
|
16
20
|
/**
|
|
17
21
|
* Gets a list of invalid characters in the provided text.
|
|
18
|
-
* Replaces spaces with 'SPACE' for visibility.
|
|
19
22
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
23
|
+
* Replaces spaces with `SPACE` for visibility.
|
|
24
|
+
*
|
|
25
|
+
* @param text - The text to check for invalid characters.
|
|
26
|
+
* @returns Array of unique invalid characters.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const invalid = getInvalidCharacters('Pa$$ word');
|
|
31
|
+
* // invalid === ['$', 'SPACE']
|
|
32
|
+
* ```
|
|
22
33
|
*/
|
|
23
34
|
export declare function getInvalidCharacters(text?: string): string[];
|
|
24
35
|
/**
|
|
25
36
|
* Converts a numeric password strength score to a human-readable label.
|
|
26
37
|
*
|
|
27
|
-
* @param score - The strength score (0-1)
|
|
28
|
-
* @returns The corresponding strength label
|
|
38
|
+
* @param score - The strength score (0-1).
|
|
39
|
+
* @returns The corresponding strength label.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const label = getPasswordStrengthLabel(0.8);
|
|
44
|
+
* // label === 'Strong'
|
|
45
|
+
* ```
|
|
29
46
|
*/
|
|
30
47
|
export declare function getPasswordStrengthLabel(score: number): PasswordStrengthLabel;
|
|
31
48
|
/**
|
|
32
49
|
* Calculates the diversity score of a password based on character types used.
|
|
50
|
+
*
|
|
33
51
|
* Considers lowercase, uppercase, digits, and special characters.
|
|
34
52
|
*
|
|
35
|
-
* @param password - The password to
|
|
36
|
-
* @returns A score between 0 and 1 representing character diversity
|
|
53
|
+
* @param password - The password to analyse.
|
|
54
|
+
* @returns A score between 0 and 1 representing character diversity.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const diversity = calculatePasswordDiversityScore('Password123!');
|
|
59
|
+
* ```
|
|
37
60
|
*/
|
|
38
61
|
export declare function calculatePasswordDiversityScore(password: string): number;
|
|
39
62
|
/**
|
|
40
63
|
* Calculates the overall password strength combining diversity and entropy.
|
|
41
64
|
*
|
|
42
|
-
* @param password - The password to
|
|
43
|
-
* @returns A strength score between 0 and 1
|
|
65
|
+
* @param password - The password to analyse.
|
|
66
|
+
* @returns A strength score between 0 and 1.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const strength = getPasswordStrength('Password123!');
|
|
71
|
+
* ```
|
|
44
72
|
*/
|
|
45
73
|
export declare function getPasswordStrength(password?: string): number;
|
|
46
74
|
/**
|
|
47
75
|
* Gets a comprehensive summary of password strength.
|
|
48
76
|
*
|
|
49
|
-
* @param password - The password to
|
|
50
|
-
* @returns An object containing the strength value and label
|
|
77
|
+
* @param password - The password to analyse.
|
|
78
|
+
* @returns An object containing the strength value and label.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* const summary = getPasswordSummary('Password123!');
|
|
83
|
+
* // summary === { value: 0.74, label: 'Strong' }
|
|
84
|
+
* ```
|
|
51
85
|
*/
|
|
52
86
|
export declare function getPasswordSummary(password?: string): PasswordSummary;
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Provides reusable Web3 state and helpers to descendant components.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```tsx
|
|
6
|
+
* <Web3ContextProvider>
|
|
7
|
+
* <WalletSelector />
|
|
8
|
+
* </Web3ContextProvider>
|
|
9
|
+
* ```
|
|
3
10
|
*/
|
|
4
11
|
import { Address, Chain } from 'viem';
|
|
5
12
|
type Web3Context = {
|
|
@@ -20,5 +27,15 @@ export declare const Web3ContextProvider: ({ enabled, children, }: {
|
|
|
20
27
|
enabled?: boolean;
|
|
21
28
|
children: React.ReactNode;
|
|
22
29
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* React hook to access the {@link Web3Context} values.
|
|
32
|
+
*
|
|
33
|
+
* @returns Shared Web3 utilities exposed by the provider.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const { account } = useWeb3();
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
23
40
|
export declare const useWeb3: () => Web3Context;
|
|
24
41
|
export {};
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Developers using this causes loss of granular control over a dapps transports,
|
|
5
|
-
* but for simple use cases, it's nice to have and saves a lot of boilerplate.
|
|
2
|
+
* Helpers for constructing default Wagmi transports for supported chains.
|
|
6
3
|
*
|
|
4
|
+
* These utilities favour convenience over granular control, making them suitable for
|
|
5
|
+
* straightforward integrations where automatically configuring transports is preferable to
|
|
6
|
+
* repeating boilerplate in every application.
|
|
7
7
|
*/
|
|
8
8
|
import { type CreateConfigParameters } from '@wagmi/core';
|
|
9
|
+
/**
|
|
10
|
+
* Options for {@link getDefaultTransports}.
|
|
11
|
+
*/
|
|
9
12
|
type GetDefaultTransportsProps = {
|
|
10
13
|
chains?: CreateConfigParameters['chains'];
|
|
11
14
|
alchemyId?: string;
|
|
12
15
|
infuraId?: string;
|
|
13
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Creates a map of Wagmi transports for the provided chains.
|
|
19
|
+
*
|
|
20
|
+
* @param props - Configuration for the generated transports.
|
|
21
|
+
* @param props.chains - Chains that require transports. Defaults to popular EVM chains.
|
|
22
|
+
* @param props.alchemyId - Alchemy API key used to prioritise Alchemy transports when available.
|
|
23
|
+
* @param props.infuraId - Infura API key used to prioritise Infura transports when available.
|
|
24
|
+
* @returns A record mapping chain identifiers to their fallback transport configuration.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { createConfig } from 'wagmi';
|
|
29
|
+
* import { getDefaultTransports } from '@openfort/openfort-react';
|
|
30
|
+
*
|
|
31
|
+
* const config = createConfig({
|
|
32
|
+
* chains: [mainnet],
|
|
33
|
+
* transports: getDefaultTransports({ alchemyId: process.env.ALCHEMY_ID ?? '' }),
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
14
37
|
export declare const getDefaultTransports: ({ chains, alchemyId, infuraId, }: GetDefaultTransportsProps) => CreateConfigParameters["transports"];
|
|
15
38
|
export {};
|
|
@@ -11,6 +11,69 @@ type CallbackResult = (StoreCredentialsResult & {
|
|
|
11
11
|
type UseAuthCallbackOptions = {
|
|
12
12
|
enabled?: boolean;
|
|
13
13
|
} & OpenfortHookOptions<CallbackResult> & CreateWalletPostAuthOptions;
|
|
14
|
+
/**
|
|
15
|
+
* Hook for handling authentication callbacks from OAuth providers and email verification
|
|
16
|
+
*
|
|
17
|
+
* This hook automatically processes authentication callbacks when the page loads with
|
|
18
|
+
* authentication parameters in the URL. It handles both OAuth provider callbacks
|
|
19
|
+
* (with access tokens) and email verification callbacks (with state tokens).
|
|
20
|
+
* The hook extracts parameters from the URL and automatically calls the appropriate
|
|
21
|
+
* authentication methods, then cleans up the URL parameters.
|
|
22
|
+
*
|
|
23
|
+
* @param options - Optional configuration with callback functions and authentication options
|
|
24
|
+
* @returns Current callback processing state and extracted information
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const authCallback = useAuthCallback({
|
|
29
|
+
* enabled: true,
|
|
30
|
+
* onSuccess: (result) => {
|
|
31
|
+
* if (result.type === 'storeCredentials') {
|
|
32
|
+
* console.log('OAuth callback processed:', result.user);
|
|
33
|
+
* } else if (result.type === 'verifyEmail') {
|
|
34
|
+
* console.log('Email verified:', result.email);
|
|
35
|
+
* }
|
|
36
|
+
* },
|
|
37
|
+
* onError: (error) => console.error('Callback processing failed:', error),
|
|
38
|
+
* recoverWalletAutomatically: true,
|
|
39
|
+
* });
|
|
40
|
+
*
|
|
41
|
+
* // Check callback processing state
|
|
42
|
+
* if (authCallback.isLoading) {
|
|
43
|
+
* console.log('Processing authentication callback...');
|
|
44
|
+
* } else if (authCallback.isError) {
|
|
45
|
+
* console.error('Callback error:', authCallback.error);
|
|
46
|
+
* } else if (authCallback.isSuccess) {
|
|
47
|
+
* console.log('Callback processed successfully');
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* // Access extracted information
|
|
51
|
+
* if (authCallback.provider) {
|
|
52
|
+
* console.log('Authentication provider:', authCallback.provider);
|
|
53
|
+
* }
|
|
54
|
+
*
|
|
55
|
+
* if (authCallback.email) {
|
|
56
|
+
* console.log('Email from callback:', authCallback.email);
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* // Manually trigger verification (if needed)
|
|
60
|
+
* const handleManualVerification = async () => {
|
|
61
|
+
* await authCallback.verifyEmail({
|
|
62
|
+
* email: 'user@example.com',
|
|
63
|
+
* state: 'verification-token',
|
|
64
|
+
* });
|
|
65
|
+
* };
|
|
66
|
+
*
|
|
67
|
+
* // Manually store credentials (if needed)
|
|
68
|
+
* const handleManualStore = async () => {
|
|
69
|
+
* await authCallback.storeCredentials({
|
|
70
|
+
* player: 'player-id',
|
|
71
|
+
* accessToken: 'access-token',
|
|
72
|
+
* refreshToken: 'refresh-token',
|
|
73
|
+
* });
|
|
74
|
+
* };
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
14
77
|
export declare const useAuthCallback: ({ enabled, ...hookOptions }?: UseAuthCallbackOptions) => {
|
|
15
78
|
email: string | null;
|
|
16
79
|
provider: UIAuthProvider | null;
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
import { UserWallet } from "../useWallets";
|
|
2
|
+
/**
|
|
3
|
+
* Options that control the behaviour of {@link useConnectToWalletPostAuth} when attempting to
|
|
4
|
+
* recover or create an embedded wallet after authentication.
|
|
5
|
+
*/
|
|
2
6
|
export type CreateWalletPostAuthOptions = {
|
|
3
7
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
8
|
+
* Whether the user should be signed out if automatic wallet creation fails.
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue true
|
|
6
11
|
*/
|
|
7
12
|
logoutOnError?: boolean;
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
14
|
+
* Whether the hook should automatically attempt to recover an existing wallet that
|
|
15
|
+
* supports automatic recovery.
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue true
|
|
11
18
|
*/
|
|
12
19
|
recoverWalletAutomatically?: boolean;
|
|
13
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* React hook that attempts to recover or create an embedded wallet once a user has authenticated.
|
|
23
|
+
*
|
|
24
|
+
* @returns Helpers that execute the post-authentication wallet connection flow.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const { tryUseWallet } = useConnectToWalletPostAuth();
|
|
29
|
+
*
|
|
30
|
+
* const result = await tryUseWallet({ recoverWalletAutomatically: false });
|
|
31
|
+
* if (!result.wallet) {
|
|
32
|
+
* console.warn('No embedded wallet available after authentication');
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
14
36
|
export declare const useConnectToWalletPostAuth: () => {
|
|
15
37
|
tryUseWallet: ({ logoutOnError: signOutOnError, recoverWalletAutomatically }: CreateWalletPostAuthOptions) => Promise<{
|
|
16
38
|
wallet?: UserWallet;
|
|
@@ -44,6 +44,77 @@ export type EmailVerificationResult = {
|
|
|
44
44
|
export type UseEmailHookOptions = {
|
|
45
45
|
emailVerificationRedirectTo?: string;
|
|
46
46
|
} & OpenfortHookOptions<EmailAuthResult | EmailVerificationResult> & CreateWalletPostAuthOptions;
|
|
47
|
+
/**
|
|
48
|
+
* Hook for email-based authentication operations
|
|
49
|
+
*
|
|
50
|
+
* This hook manages email authentication flows including sign-in, sign-up, password reset,
|
|
51
|
+
* email verification, and email linking. It handles both password and passwordless authentication
|
|
52
|
+
* and automatically manages wallet connection after successful authentication.
|
|
53
|
+
*
|
|
54
|
+
* @param hookOptions - Optional configuration with callback functions and authentication options
|
|
55
|
+
* @returns Current authentication state with email auth actions
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const emailAuth = useEmailAuth({
|
|
60
|
+
* onSignInEmailSuccess: (result) => console.log('Signed in:', result.user),
|
|
61
|
+
* onSignInEmailError: (error) => console.error('Sign-in failed:', error),
|
|
62
|
+
* emailVerificationRedirectTo: 'https://yourapp.com/verify',
|
|
63
|
+
* recoverWalletAutomatically: true,
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* // Sign up with email and password
|
|
67
|
+
* await emailAuth.signUpEmail({
|
|
68
|
+
* email: 'user@example.com',
|
|
69
|
+
* password: 'securePassword123',
|
|
70
|
+
* name: 'John Doe',
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* // Sign in with email and password
|
|
74
|
+
* await emailAuth.signInEmail({
|
|
75
|
+
* email: 'user@example.com',
|
|
76
|
+
* password: 'securePassword123',
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* // Request password reset
|
|
80
|
+
* await emailAuth.requestResetPassword({
|
|
81
|
+
* email: 'user@example.com',
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* // Reset password with state token
|
|
85
|
+
* await emailAuth.resetPassword({
|
|
86
|
+
* email: 'user@example.com',
|
|
87
|
+
* password: 'newPassword123',
|
|
88
|
+
* state: 'reset-token-from-email',
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* // Verify email with state token
|
|
92
|
+
* await emailAuth.verifyEmail({
|
|
93
|
+
* email: 'user@example.com',
|
|
94
|
+
* state: 'verification-token-from-email',
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* // Link email to existing authenticated account
|
|
98
|
+
* await emailAuth.linkEmail({
|
|
99
|
+
* email: 'secondary@example.com',
|
|
100
|
+
* password: 'password123',
|
|
101
|
+
* });
|
|
102
|
+
*
|
|
103
|
+
* // Check authentication state
|
|
104
|
+
* if (emailAuth.isLoading) {
|
|
105
|
+
* console.log('Processing authentication...');
|
|
106
|
+
* } else if (emailAuth.isError) {
|
|
107
|
+
* console.error('Authentication error:', emailAuth.error);
|
|
108
|
+
* } else if (emailAuth.isSuccess) {
|
|
109
|
+
* console.log('Authentication successful');
|
|
110
|
+
* }
|
|
111
|
+
*
|
|
112
|
+
* // Handle email verification requirement
|
|
113
|
+
* if (emailAuth.requiresEmailVerification) {
|
|
114
|
+
* console.log('Please check your email to verify your account');
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
47
118
|
export declare const useEmailAuth: (hookOptions?: UseEmailHookOptions) => {
|
|
48
119
|
requiresEmailVerification: boolean;
|
|
49
120
|
isAwaitingInput: boolean;
|