@openfort/react 0.0.5 → 0.0.6
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/components/Common/TickList/index.d.ts +7 -0
- package/build/components/Common/TickList/styles.d.ts +3 -0
- package/build/components/Openfort/context.d.ts +1 -1
- package/build/components/Openfort/types.d.ts +17 -24
- package/build/components/Pages/Recover/index.d.ts +2 -2
- package/build/components/Pages/Recover/styles.d.ts +1 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.d.ts +4 -0
- package/build/components/PasswordStrength/password-utility.d.ts +52 -0
- package/build/components/contexts/web3/index.d.ts +1 -2
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +1 -1
- package/build/hooks/openfort/auth/{useCreateWalletPostAuth.d.ts → useConnectToWalletPostAuth.d.ts} +5 -4
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +1 -1
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +1 -1
- package/build/hooks/openfort/auth/useOAuth.d.ts +1 -1
- package/build/hooks/openfort/auth/useSignOut.d.ts +1 -1
- package/build/hooks/openfort/useWallets.d.ts +2 -1
- package/build/index.es.js +538 -160
- package/build/index.es.js.map +1 -1
- package/build/version.d.ts +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const TickListContainer: import("styled-components").StyledComponent<"ul", any, {}, never>;
|
|
2
|
+
export declare const TickItem: import("styled-components").StyledComponent<"li", any, {}, never>;
|
|
3
|
+
export declare const TickIconWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -31,7 +31,7 @@ export type ContextValue = {
|
|
|
31
31
|
displayError: (message: string | React.ReactNode | null, code?: any) => void;
|
|
32
32
|
resize: number;
|
|
33
33
|
triggerResize: () => void;
|
|
34
|
-
uiConfig
|
|
34
|
+
uiConfig: OpenfortUIOptionsExtended;
|
|
35
35
|
walletConfig?: OpenfortWalletConfig;
|
|
36
36
|
overrides?: SDKOverrides;
|
|
37
37
|
thirdPartyAuth?: ThirdPartyAuthConfiguration;
|
|
@@ -30,41 +30,24 @@ export declare enum AuthProvider {
|
|
|
30
30
|
GUEST = "guest"
|
|
31
31
|
}
|
|
32
32
|
export declare const socialProviders: AuthProvider[];
|
|
33
|
+
type PolicyConfig = string | Record<number, string>;
|
|
33
34
|
type CommonWalletConfig = {
|
|
34
35
|
/** Publishable key for the Shield API */
|
|
35
36
|
shieldPublishableKey: string;
|
|
36
37
|
/** Policy ID (pol_...) for the embedded signer */
|
|
37
|
-
ethereumProviderPolicyId?:
|
|
38
|
+
ethereumProviderPolicyId?: PolicyConfig;
|
|
38
39
|
accountType?: AccountTypeEnum;
|
|
39
40
|
debug?: boolean;
|
|
40
41
|
};
|
|
41
42
|
type EncryptionSession = {
|
|
42
43
|
/** Function to retrieve an encryption session using a session ID */
|
|
43
|
-
getEncryptionSession
|
|
44
|
+
getEncryptionSession?: () => Promise<string>;
|
|
44
45
|
createEncryptedSessionEndpoint?: never;
|
|
45
46
|
} | {
|
|
46
47
|
/** API endpoint for creating an encrypted session */
|
|
47
48
|
getEncryptionSession?: never;
|
|
48
|
-
createEncryptedSessionEndpoint
|
|
49
|
+
createEncryptedSessionEndpoint?: string;
|
|
49
50
|
};
|
|
50
|
-
/**
|
|
51
|
-
* Configuration for automatic recovery, which requires an encryption session.
|
|
52
|
-
*/
|
|
53
|
-
type AutomaticRecoveryWalletConfig = {
|
|
54
|
-
/** Specifies that the recovery method is automatic */
|
|
55
|
-
recoveryMethod: RecoveryMethod.AUTOMATIC;
|
|
56
|
-
} & EncryptionSession;
|
|
57
|
-
type PasswordRecoveryWalletConfig = {
|
|
58
|
-
/** Specifies that the recovery method is password-based */
|
|
59
|
-
recoveryMethod: RecoveryMethod.PASSWORD;
|
|
60
|
-
} & ((EncryptionSession & {
|
|
61
|
-
shieldEncryptionKey?: never;
|
|
62
|
-
}) | {
|
|
63
|
-
/** Required shield encryption key when no encryption session is used */
|
|
64
|
-
shieldEncryptionKey: string;
|
|
65
|
-
createEncryptedSessionEndpoint?: never;
|
|
66
|
-
getEncryptionSession?: never;
|
|
67
|
-
});
|
|
68
51
|
/**
|
|
69
52
|
* Configuration for automatic recovery.
|
|
70
53
|
* - An encryption session is required.
|
|
@@ -77,10 +60,10 @@ type PasswordRecoveryWalletConfig = {
|
|
|
77
60
|
* - `createEncryptedSessionEndpoint` as a string, OR
|
|
78
61
|
* - `getEncryptionSession.` as a function that returns a promise.
|
|
79
62
|
*/
|
|
80
|
-
export type OpenfortWalletConfig = CommonWalletConfig &
|
|
63
|
+
export type OpenfortWalletConfig = CommonWalletConfig & EncryptionSession;
|
|
81
64
|
export type OpenfortUIOptions = {
|
|
82
65
|
linkWalletOnSignUp?: boolean;
|
|
83
|
-
authProviders
|
|
66
|
+
authProviders: AuthProvider[];
|
|
84
67
|
skipEmailVerification?: boolean;
|
|
85
68
|
termsOfServiceUrl?: string;
|
|
86
69
|
privacyPolicyUrl?: string;
|
|
@@ -89,6 +72,10 @@ export type OpenfortUIOptions = {
|
|
|
89
72
|
export type OpenfortSDKOptions = {
|
|
90
73
|
overrides?: CoreOpenfortProviderProps['overrides'];
|
|
91
74
|
};
|
|
75
|
+
export type WalletRecoveryOptions = {
|
|
76
|
+
allowedMethods?: RecoveryMethod[];
|
|
77
|
+
defaultMethod?: RecoveryMethod;
|
|
78
|
+
};
|
|
92
79
|
export type ConnectUIOptions = {
|
|
93
80
|
theme?: Theme;
|
|
94
81
|
mode?: Mode;
|
|
@@ -109,7 +96,12 @@ export type ConnectUIOptions = {
|
|
|
109
96
|
initialChainId?: number;
|
|
110
97
|
enforceSupportedChains?: boolean;
|
|
111
98
|
overlayBlur?: number;
|
|
112
|
-
|
|
99
|
+
walletRecovery?: WalletRecoveryOptions;
|
|
100
|
+
} & Partial<OpenfortUIOptions>;
|
|
101
|
+
type WalletRecoveryOptionsExtended = {
|
|
102
|
+
allowedMethods: RecoveryMethod[];
|
|
103
|
+
defaultMethod: RecoveryMethod;
|
|
104
|
+
};
|
|
113
105
|
export type OpenfortUIOptionsExtended = {
|
|
114
106
|
theme: Theme;
|
|
115
107
|
mode: Mode;
|
|
@@ -135,5 +127,6 @@ export type OpenfortUIOptionsExtended = {
|
|
|
135
127
|
walletOnboardingUrl?: string;
|
|
136
128
|
disableSiweRedirect?: boolean;
|
|
137
129
|
overlayBlur?: number;
|
|
130
|
+
walletRecovery: WalletRecoveryOptionsExtended;
|
|
138
131
|
} & OpenfortUIOptions;
|
|
139
132
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const RecoverPage: React.FC;
|
|
3
|
+
export default RecoverPage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OtherMethodButton: import("styled-components").StyledComponent<"button", any, {}, never>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Password Utilities Module
|
|
3
|
+
* Provides functions for password strength calculation, passphrase generation,
|
|
4
|
+
* and password validation.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MEDIUM_SCORE_THRESHOLD = 0.5;
|
|
7
|
+
export declare const STRONG_SCORE_THRESHOLD = 0.75;
|
|
8
|
+
export declare const VERY_STRONG_SCORE_THRESHOLD = 0.9;
|
|
9
|
+
/** Password strength levels */
|
|
10
|
+
export type PasswordStrengthLabel = 'Weak' | 'Medium' | 'Strong' | 'Very Strong';
|
|
11
|
+
/** Password summary information */
|
|
12
|
+
export interface PasswordSummary {
|
|
13
|
+
value: number;
|
|
14
|
+
label: PasswordStrengthLabel;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Gets a list of invalid characters in the provided text.
|
|
18
|
+
* Replaces spaces with 'SPACE' for visibility.
|
|
19
|
+
*
|
|
20
|
+
* @param text - The text to check for invalid characters
|
|
21
|
+
* @returns Array of unique invalid characters
|
|
22
|
+
*/
|
|
23
|
+
export declare function getInvalidCharacters(text?: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Converts a numeric password strength score to a human-readable label.
|
|
26
|
+
*
|
|
27
|
+
* @param score - The strength score (0-1)
|
|
28
|
+
* @returns The corresponding strength label
|
|
29
|
+
*/
|
|
30
|
+
export declare function getPasswordStrengthLabel(score: number): PasswordStrengthLabel;
|
|
31
|
+
/**
|
|
32
|
+
* Calculates the diversity score of a password based on character types used.
|
|
33
|
+
* Considers lowercase, uppercase, digits, and special characters.
|
|
34
|
+
*
|
|
35
|
+
* @param password - The password to analyze
|
|
36
|
+
* @returns A score between 0 and 1 representing character diversity
|
|
37
|
+
*/
|
|
38
|
+
export declare function calculatePasswordDiversityScore(password: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* Calculates the overall password strength combining diversity and entropy.
|
|
41
|
+
*
|
|
42
|
+
* @param password - The password to analyze
|
|
43
|
+
* @returns A strength score between 0 and 1
|
|
44
|
+
*/
|
|
45
|
+
export declare function getPasswordStrength(password?: string): number;
|
|
46
|
+
/**
|
|
47
|
+
* Gets a comprehensive summary of password strength.
|
|
48
|
+
*
|
|
49
|
+
* @param password - The password to analyze
|
|
50
|
+
* @returns An object containing the strength value and label
|
|
51
|
+
*/
|
|
52
|
+
export declare function getPasswordSummary(password?: string): PasswordSummary;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This provider is responsible for handling reusable web3 logic across the app.
|
|
3
3
|
*/
|
|
4
|
-
import React from 'react';
|
|
5
4
|
import { Address, Chain } from 'viem';
|
|
6
5
|
type Web3Context = {
|
|
7
6
|
connect: {
|
|
@@ -16,7 +15,7 @@ type Web3Context = {
|
|
|
16
15
|
address: Address;
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
|
-
declare const Web3Context:
|
|
18
|
+
declare const Web3Context: import("react").Context<Web3Context>;
|
|
20
19
|
export declare const Web3ContextProvider: ({ enabled, children, }: {
|
|
21
20
|
enabled?: boolean;
|
|
22
21
|
children: React.ReactNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OpenfortHookOptions, OpenfortError } from "../../../types";
|
|
2
2
|
import { AuthProvider } from "../../../components/Openfort/types";
|
|
3
|
-
import { CreateWalletPostAuthOptions } from "./
|
|
3
|
+
import { CreateWalletPostAuthOptions } from "./useConnectToWalletPostAuth";
|
|
4
4
|
import { EmailVerificationResult } from "./useEmailAuth";
|
|
5
5
|
import { StoreCredentialsResult } from "./useOAuth";
|
|
6
6
|
type CallbackResult = (StoreCredentialsResult & {
|
package/build/hooks/openfort/auth/{useCreateWalletPostAuth.d.ts → useConnectToWalletPostAuth.d.ts}
RENAMED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserWallet } from "../useWallets";
|
|
1
2
|
export type CreateWalletPostAuthOptions = {
|
|
2
3
|
/**
|
|
3
4
|
* @default true
|
|
@@ -5,13 +6,13 @@ export type CreateWalletPostAuthOptions = {
|
|
|
5
6
|
*/
|
|
6
7
|
logoutOnError?: boolean;
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* @default true
|
|
10
|
+
* It will automatically try to recover the first wallet with automatic recovery.
|
|
9
11
|
*/
|
|
10
12
|
automaticRecovery?: boolean;
|
|
11
13
|
};
|
|
12
|
-
export declare const
|
|
14
|
+
export declare const useConnectToWalletPostAuth: () => {
|
|
13
15
|
tryUseWallet: ({ logoutOnError: signOutOnError, automaticRecovery }: CreateWalletPostAuthOptions) => Promise<{
|
|
14
|
-
|
|
15
|
-
wallet?: import("../useWallets").UserWallet;
|
|
16
|
+
wallet?: UserWallet;
|
|
16
17
|
}>;
|
|
17
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
|
|
2
2
|
import { OpenfortHookOptions, OpenfortError } from "../../../types";
|
|
3
|
-
import { CreateWalletPostAuthOptions } from './
|
|
3
|
+
import { CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
4
4
|
import { UserWallet } from '../useWallets';
|
|
5
5
|
export type EmailAuthResult = {
|
|
6
6
|
error?: OpenfortError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
|
|
2
2
|
import { OpenfortHookOptions, OpenfortError } from "../../../types";
|
|
3
|
-
import { CreateWalletPostAuthOptions } from "./
|
|
3
|
+
import { CreateWalletPostAuthOptions } from "./useConnectToWalletPostAuth";
|
|
4
4
|
import { UserWallet } from "../useWallets";
|
|
5
5
|
export type GuestHookResult = {
|
|
6
6
|
error?: OpenfortError;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OAuthProvider } from '@openfort/openfort-js';
|
|
2
2
|
import { OpenfortHookOptions, OpenfortError } from '../../../types';
|
|
3
|
-
import { CreateWalletPostAuthOptions } from './
|
|
3
|
+
import { CreateWalletPostAuthOptions } from './useConnectToWalletPostAuth';
|
|
4
4
|
import { UserWallet } from "../useWallets";
|
|
5
5
|
import { type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
|
|
6
6
|
export type InitializeOAuthOptions = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OpenfortError, OpenfortHookOptions } from '../../../types';
|
|
2
2
|
export declare function useSignOut(hookOptions?: OpenfortHookOptions): {
|
|
3
3
|
signOut: (options?: OpenfortHookOptions) => Promise<{}>;
|
|
4
4
|
isLoading: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountTypeEnum, RecoveryParams } from "@openfort/openfort-js";
|
|
1
|
+
import { AccountTypeEnum, RecoveryMethod, RecoveryParams } from "@openfort/openfort-js";
|
|
2
2
|
import { Hex } from "viem";
|
|
3
3
|
import { Connector } from "wagmi";
|
|
4
4
|
import { embeddedWalletId } from "../../constants/openfort";
|
|
@@ -12,6 +12,7 @@ export type UserWallet = {
|
|
|
12
12
|
isAvailable: boolean;
|
|
13
13
|
isActive?: boolean;
|
|
14
14
|
isConnecting?: boolean;
|
|
15
|
+
recoveryMethod?: RecoveryMethod;
|
|
15
16
|
};
|
|
16
17
|
type SetActiveWalletResult = {
|
|
17
18
|
error?: OpenfortError;
|