@openfort/react-native 0.1.15 → 0.1.16

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.
Files changed (59) hide show
  1. package/dist/components/AuthBoundary.js +0 -2
  2. package/dist/constants/index.js +1 -0
  3. package/dist/core/client.js +5 -5
  4. package/dist/core/index.js +3 -3
  5. package/dist/core/provider.js +13 -10
  6. package/dist/core/storage.js +5 -5
  7. package/dist/hooks/auth/index.js +3 -3
  8. package/dist/hooks/auth/useCreateWalletPostAuth.js +8 -4
  9. package/dist/hooks/auth/useEmailAuth.js +10 -8
  10. package/dist/hooks/auth/useGuestAuth.js +5 -3
  11. package/dist/hooks/auth/useOAuth.js +17 -11
  12. package/dist/hooks/auth/useSignOut.js +7 -7
  13. package/dist/hooks/auth/useWalletAuth.js +19 -11
  14. package/dist/hooks/core/useUser.js +2 -2
  15. package/dist/hooks/index.js +3 -2
  16. package/dist/hooks/wallet/useWallets.js +38 -32
  17. package/dist/index.js +8 -9
  18. package/dist/lib/logger.js +3 -11
  19. package/dist/native/index.js +4 -4
  20. package/dist/native/oauth.js +7 -12
  21. package/dist/native/storage.js +10 -2
  22. package/dist/native/webview.js +7 -5
  23. package/dist/types/baseFlowState.js +1 -1
  24. package/dist/types/components/AuthBoundary.d.ts +1 -2
  25. package/dist/types/components/index.d.ts +1 -1
  26. package/dist/types/core/client.d.ts +1 -1
  27. package/dist/types/core/context.d.ts +2 -2
  28. package/dist/types/core/index.d.ts +5 -5
  29. package/dist/types/core/provider.d.ts +1 -1
  30. package/dist/types/core/storage.d.ts +1 -1
  31. package/dist/types/hooks/auth/index.d.ts +6 -2
  32. package/dist/types/hooks/auth/useCreateWalletPostAuth.d.ts +1 -15
  33. package/dist/types/hooks/auth/useEmailAuth.d.ts +2 -2
  34. package/dist/types/hooks/auth/useGuestAuth.d.ts +2 -2
  35. package/dist/types/hooks/auth/useOAuth.d.ts +2 -2
  36. package/dist/types/hooks/auth/useSignOut.d.ts +2 -2
  37. package/dist/types/hooks/auth/useWalletAuth.d.ts +2 -2
  38. package/dist/types/hooks/core/useOpenfort.d.ts +1 -1
  39. package/dist/types/hooks/index.d.ts +1 -1
  40. package/dist/types/hooks/wallet/useWallets.d.ts +4 -4
  41. package/dist/types/index.d.ts +4 -6
  42. package/dist/types/index.js +1 -1
  43. package/dist/types/lib/hookConsistency.d.ts +2 -2
  44. package/dist/types/lib/logger.d.ts +0 -2
  45. package/dist/types/native/index.d.ts +4 -4
  46. package/dist/types/native/oauth.d.ts +1 -1
  47. package/dist/types/native/webview.d.ts +1 -1
  48. package/dist/types/oauth.js +1 -1
  49. package/dist/types/types/baseFlowState.d.ts +2 -2
  50. package/dist/types/types/config.d.ts +0 -12
  51. package/dist/types/types/hookOption.d.ts +1 -1
  52. package/dist/types/types/index.d.ts +5 -5
  53. package/dist/types/types/predicates.d.ts +1 -1
  54. package/dist/types/types/wallet.d.ts +7 -7
  55. package/package.json +74 -19
  56. package/dist/hooks/auth/useAuthCallback.js +0 -1
  57. package/dist/types/hooks/auth/useAuthCallback.d.ts +0 -0
  58. package/dist/types/state.js +0 -1
  59. package/dist/types/types/state.d.ts +0 -0
@@ -1,9 +1,9 @@
1
- import { AccountTypeEnum, ChainTypeEnum, EmbeddedState, RecoveryMethod } from '@openfort/openfort-js';
1
+ import { AccountTypeEnum, ChainTypeEnum, EmbeddedState, RecoveryMethod, } from '@openfort/openfort-js';
2
2
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
3
3
  import { useOpenfortContext } from '../../core/context';
4
4
  import { onError, onSuccess } from '../../lib/hookConsistency';
5
- import { OpenfortError, OpenfortErrorType } from '../../types/openfortError';
6
5
  import { logger } from '../../lib/logger';
6
+ import { OpenfortError, OpenfortErrorType } from '../../types/openfortError';
7
7
  const mapWalletStatus = (status) => {
8
8
  return {
9
9
  error: status.error,
@@ -53,12 +53,12 @@ export function useWallets(hookOptions = {}) {
53
53
  const recoverPromiseRef = useRef(null);
54
54
  const [activeWalletId, setActiveWalletId] = useState(null); // OPENFORT-JS Should provide this
55
55
  const [status, setStatus] = useState({
56
- status: "idle",
56
+ status: 'idle',
57
57
  });
58
58
  const activeWallet = useMemo(() => {
59
59
  if (!activeWalletId || !embeddedAccounts)
60
60
  return null;
61
- const account = embeddedAccounts.find(acc => acc.id === activeWalletId);
61
+ const account = embeddedAccounts.find((acc) => acc.id === activeWalletId);
62
62
  if (!account)
63
63
  return null;
64
64
  return {
@@ -89,9 +89,11 @@ export function useWallets(hookOptions = {}) {
89
89
  },
90
90
  });
91
91
  if (!response.ok) {
92
- throw new OpenfortError('Failed to create encryption session', OpenfortErrorType.WALLET_ERROR, { status: response.status });
92
+ throw new OpenfortError('Failed to create encryption session', OpenfortErrorType.WALLET_ERROR, {
93
+ status: response.status,
94
+ });
93
95
  }
94
- const body = await response.json();
96
+ const body = (await response.json());
95
97
  if (!body?.session || typeof body.session !== 'string') {
96
98
  throw new OpenfortError('Encryption session response is missing the `session` property', OpenfortErrorType.WALLET_ERROR);
97
99
  }
@@ -128,8 +130,8 @@ export function useWallets(hookOptions = {}) {
128
130
  // Validate chainId if provided
129
131
  let chainId;
130
132
  if (options?.chainId) {
131
- if (!supportedChains || !supportedChains.some(chain => chain.id === options.chainId)) {
132
- throw new OpenfortError(`Chain ID ${options.chainId} is not supported. Supported chains: ${supportedChains?.map(c => c.id).join(', ') || 'none'}`, OpenfortErrorType.WALLET_ERROR);
133
+ if (!supportedChains || !supportedChains.some((chain) => chain.id === options.chainId)) {
134
+ throw new OpenfortError(`Chain ID ${options.chainId} is not supported. Supported chains: ${supportedChains?.map((c) => c.id).join(', ') || 'none'}`, OpenfortErrorType.WALLET_ERROR);
133
135
  }
134
136
  chainId = options.chainId;
135
137
  }
@@ -142,11 +144,11 @@ export function useWallets(hookOptions = {}) {
142
144
  let embeddedAccountToRecover;
143
145
  if (walletConfig?.accountType === AccountTypeEnum.EOA) {
144
146
  // For EOAs, match only by address (EOAs work across all chains)
145
- embeddedAccountToRecover = embeddedAccounts.find(account => account.address.toLowerCase() === address?.toLowerCase());
147
+ embeddedAccountToRecover = embeddedAccounts.find((account) => account.address.toLowerCase() === address?.toLowerCase());
146
148
  }
147
149
  else {
148
150
  // For Smart Accounts, match by both address and chainId (Smart Accounts are chain-specific)
149
- embeddedAccountToRecover = embeddedAccounts.find(account => account.chainId === chainId && account.address.toLowerCase() === address?.toLowerCase());
151
+ embeddedAccountToRecover = embeddedAccounts.find((account) => account.chainId === chainId && account.address.toLowerCase() === address?.toLowerCase());
150
152
  }
151
153
  let embeddedAccount;
152
154
  if (!embeddedAccountToRecover) {
@@ -157,7 +159,6 @@ export function useWallets(hookOptions = {}) {
157
159
  }
158
160
  else {
159
161
  let recoveryParams;
160
- ;
161
162
  if (options?.recoveryPassword) {
162
163
  recoveryParams = {
163
164
  recoveryMethod: RecoveryMethod.PASSWORD,
@@ -167,7 +168,7 @@ export function useWallets(hookOptions = {}) {
167
168
  else {
168
169
  recoveryParams = {
169
170
  recoveryMethod: RecoveryMethod.AUTOMATIC,
170
- encryptionSession: await resolveEncryptionSession()
171
+ encryptionSession: await resolveEncryptionSession(),
171
172
  };
172
173
  }
173
174
  // Recover the embedded wallet with shield authentication
@@ -197,12 +198,14 @@ export function useWallets(hookOptions = {}) {
197
198
  hookOptions,
198
199
  data: {
199
200
  wallet,
200
- }
201
+ },
201
202
  });
202
203
  }
203
204
  catch (e) {
204
205
  recoverPromiseRef.current = null;
205
- const error = e instanceof OpenfortError ? e : new OpenfortError('Failed to recover embedded wallet', OpenfortErrorType.WALLET_ERROR);
206
+ const error = e instanceof OpenfortError
207
+ ? e
208
+ : new OpenfortError('Failed to recover embedded wallet', OpenfortErrorType.WALLET_ERROR);
206
209
  setStatus({
207
210
  status: 'error',
208
211
  error,
@@ -226,8 +229,7 @@ export function useWallets(hookOptions = {}) {
226
229
  const accounts = await client.embeddedWallet.list({
227
230
  limit: 100,
228
231
  // If its EOA we want all accounts, otherwise we want only smart accounts
229
- accountType: walletConfig?.accountType === AccountTypeEnum.EOA ?
230
- undefined : AccountTypeEnum.SMART_ACCOUNT
232
+ accountType: walletConfig?.accountType === AccountTypeEnum.EOA ? undefined : AccountTypeEnum.SMART_ACCOUNT,
231
233
  });
232
234
  setEmbeddedAccounts(accounts);
233
235
  }
@@ -243,7 +245,7 @@ export function useWallets(hookOptions = {}) {
243
245
  const ethereumProviderPolicyId = walletConfig?.ethereumProviderPolicyId;
244
246
  if (!ethereumProviderPolicyId)
245
247
  return undefined;
246
- if (typeof ethereumProviderPolicyId === "string") {
248
+ if (typeof ethereumProviderPolicyId === 'string') {
247
249
  return ethereumProviderPolicyId;
248
250
  }
249
251
  if (!hookOptions.chainId)
@@ -257,6 +259,7 @@ export function useWallets(hookOptions = {}) {
257
259
  return await client.embeddedWallet.getEthereumProvider({ announceProvider: false, policy: resolvePolicy() });
258
260
  }, [client.embeddedWallet]);
259
261
  useEffect(() => {
262
+ ;
260
263
  (async () => {
261
264
  try {
262
265
  const embeddedAccount = await client.embeddedWallet.get();
@@ -273,14 +276,14 @@ export function useWallets(hookOptions = {}) {
273
276
  const deduplicatedAccounts = embeddedAccounts.reduce((acc, account) => {
274
277
  if (walletConfig?.accountType === AccountTypeEnum.EOA) {
275
278
  // For EOAs, deduplicate by address only (EOAs work across all chains)
276
- if (!acc.some(a => a.address.toLowerCase() === account.address.toLowerCase())) {
279
+ if (!acc.some((a) => a.address.toLowerCase() === account.address.toLowerCase())) {
277
280
  acc.push(account);
278
281
  }
279
282
  }
280
283
  else {
281
284
  // For Smart Accounts, keep separate entries per chain (they're chain-specific)
282
285
  // Only deduplicate exact matches (same address AND same chainId)
283
- if (!acc.some(a => a.address.toLowerCase() === account.address.toLowerCase() && a.chainId === account.chainId)) {
286
+ if (!acc.some((a) => a.address.toLowerCase() === account.address.toLowerCase() && a.chainId === account.chainId)) {
284
287
  acc.push(account);
285
288
  }
286
289
  }
@@ -292,7 +295,7 @@ export function useWallets(hookOptions = {}) {
292
295
  ownerAddress: account.ownerAddress,
293
296
  chainType: account.chainType,
294
297
  isActive: activeWalletId === account.id,
295
- isConnecting: status.status === "connecting" && status.address === account.address,
298
+ isConnecting: status.status === 'connecting' && status.address === account.address,
296
299
  getProvider: async () => {
297
300
  return await getEthereumProvider();
298
301
  },
@@ -307,8 +310,8 @@ export function useWallets(hookOptions = {}) {
307
310
  // Validate chainId if provided
308
311
  let chainId;
309
312
  if (options?.chainId) {
310
- if (!supportedChains || !supportedChains.some(chain => chain.id === options.chainId)) {
311
- throw new OpenfortError(`Chain ID ${options.chainId} is not supported. Supported chains: ${supportedChains?.map(c => c.id).join(', ') || 'none'}`, OpenfortErrorType.WALLET_ERROR);
313
+ if (!supportedChains || !supportedChains.some((chain) => chain.id === options.chainId)) {
314
+ throw new OpenfortError(`Chain ID ${options.chainId} is not supported. Supported chains: ${supportedChains?.map((c) => c.id).join(', ') || 'none'}`, OpenfortErrorType.WALLET_ERROR);
312
315
  }
313
316
  chainId = options.chainId;
314
317
  }
@@ -321,7 +324,6 @@ export function useWallets(hookOptions = {}) {
321
324
  }
322
325
  logger.info('Using chain ID for wallet creation', chainId);
323
326
  let recoveryParams;
324
- ;
325
327
  if (options?.recoveryPassword) {
326
328
  recoveryParams = {
327
329
  recoveryMethod: RecoveryMethod.PASSWORD,
@@ -331,7 +333,7 @@ export function useWallets(hookOptions = {}) {
331
333
  else {
332
334
  recoveryParams = {
333
335
  recoveryMethod: RecoveryMethod.AUTOMATIC,
334
- encryptionSession: await resolveEncryptionSession()
336
+ encryptionSession: await resolveEncryptionSession(),
335
337
  };
336
338
  }
337
339
  // Configure embedded wallet with shield authentication
@@ -365,12 +367,14 @@ export function useWallets(hookOptions = {}) {
365
367
  getProvider: async () => {
366
368
  return await client.embeddedWallet.getEthereumProvider();
367
369
  },
368
- }
369
- }
370
+ },
371
+ },
370
372
  });
371
373
  }
372
374
  catch (e) {
373
- const error = e instanceof OpenfortError ? e : new OpenfortError('Failed to create Ethereum wallet', OpenfortErrorType.WALLET_ERROR, { error: e });
375
+ const error = e instanceof OpenfortError
376
+ ? e
377
+ : new OpenfortError('Failed to create Ethereum wallet', OpenfortErrorType.WALLET_ERROR, { error: e });
374
378
  setStatus({
375
379
  status: 'error',
376
380
  error,
@@ -378,7 +382,7 @@ export function useWallets(hookOptions = {}) {
378
382
  return onError({
379
383
  hookOptions,
380
384
  options,
381
- error
385
+ error,
382
386
  });
383
387
  }
384
388
  }, [client, supportedChains, walletConfig, resolveEncryptionSession, _internal, user]);
@@ -405,9 +409,9 @@ export function useWallets(hookOptions = {}) {
405
409
  isConnecting: false,
406
410
  getProvider: async () => {
407
411
  return await getEthereumProvider();
408
- }
409
- }
410
- }
412
+ },
413
+ },
414
+ },
411
415
  });
412
416
  }
413
417
  catch (error) {
@@ -415,7 +419,9 @@ export function useWallets(hookOptions = {}) {
415
419
  return onError({
416
420
  hookOptions,
417
421
  options: params,
418
- error: new OpenfortError('Failed to set wallet recovery', OpenfortErrorType.WALLET_ERROR, { error: errorObj }),
422
+ error: new OpenfortError('Failed to set wallet recovery', OpenfortErrorType.WALLET_ERROR, {
423
+ error: errorObj,
424
+ }),
419
425
  });
420
426
  }
421
427
  }, [client, setStatus, hookOptions]);
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ // biome-ignore-all lint/performance/noReExportAll: This is an index file that re-exports everything
1
2
  /**
2
3
  * @packageDocumentation
3
4
  *
@@ -8,20 +9,18 @@
8
9
  * Expo applications.
9
10
  */
10
11
  // Re-export commonly used types from @openfort/openfort-js
11
- export { OpenfortError, RecoveryMethod, Openfort as OpenfortClient, OpenfortConfiguration, ShieldConfiguration, EmbeddedState, } from '@openfort/openfort-js';
12
12
  // Re-export enums and values from @openfort/openfort-js
13
- export { OAuthProvider, AccountTypeEnum, } from '@openfort/openfort-js';
14
13
  // Re-export event listener functionality from @openfort/openfort-js
15
- export { openfortEvents, OpenfortEvents, } from '@openfort/openfort-js';
16
- // Re-export all types from the main types module
17
- export * from './types';
18
- // Re-export all hooks
19
- export * from './hooks';
14
+ export { AccountTypeEnum, EmbeddedState, OAuthProvider, Openfort as OpenfortClient, OpenfortConfiguration, OpenfortError, OpenfortEvents, openfortEvents, RecoveryMethod, ShieldConfiguration, } from '@openfort/openfort-js';
20
15
  // Re-export all components and UI elements
21
16
  export * from './components';
17
+ // Re-export constants
18
+ export * from './constants';
22
19
  // Re-export core functionality
23
20
  export * from './core';
21
+ // Re-export all hooks
22
+ export * from './hooks';
24
23
  // Re-export native functionality
25
24
  export * from './native';
26
- // Re-export constants
27
- export * from './constants';
25
+ // Re-export all types from the main types module
26
+ export * from './types';
@@ -3,32 +3,24 @@
3
3
  import { EmbeddedState } from '@openfort/openfort-js';
4
4
  const PREFIX = '[OPENFORT_PROVIDER]';
5
5
  let verboseMode = false;
6
- function formatMessage(level, message) {
6
+ function formatMessage(_level, message) {
7
7
  const text = typeof message === 'string' ? message : JSON.stringify(message);
8
8
  return `${PREFIX} ${text}`;
9
9
  }
10
- function log(level, message, ...optionalParams) {
10
+ function log(level, message, ..._optionalParams) {
11
11
  // Only log debug and info messages in verbose mode
12
12
  if ((level === 'debug' || level === 'info') && !verboseMode) {
13
13
  return;
14
14
  }
15
- const formatted = formatMessage(level, message);
15
+ const _formatted = formatMessage(level, message);
16
16
  switch (level) {
17
17
  case 'debug':
18
- // eslint-disable-next-line no-console
19
- console.debug(formatted, ...optionalParams);
20
18
  break;
21
19
  case 'info':
22
- // eslint-disable-next-line no-console
23
- console.log(formatted, ...optionalParams);
24
20
  break;
25
21
  case 'warn':
26
- // eslint-disable-next-line no-console
27
- console.warn(formatted, ...optionalParams);
28
22
  break;
29
23
  case 'error':
30
- // eslint-disable-next-line no-console
31
- console.error(formatted, ...optionalParams);
32
24
  break;
33
25
  }
34
26
  }
@@ -1,6 +1,6 @@
1
1
  // WebView integration
2
- export { EmbeddedWalletWebView, WebViewUtils } from './webview';
3
- // Storage utilities
4
- export { isSecureStorageMessage, handleSecureStorageMessage, NativeStorageUtils, } from './storage';
5
2
  // OAuth flows
6
- export { openOAuthSession, authenticateWithApple, isAppleSignInAvailable, parseOAuthUrl, createOAuthRedirectUri, OAuthUtils, } from './oauth';
3
+ export { authenticateWithApple, createOAuthRedirectUri, isAppleSignInAvailable, OAuthUtils, openOAuthSession, parseOAuthUrl, } from './oauth';
4
+ // Storage utilities
5
+ export { handleSecureStorageMessage, isSecureStorageMessage, NativeStorageUtils, } from './storage';
6
+ export { EmbeddedWalletWebView, WebViewUtils } from './webview';
@@ -1,9 +1,9 @@
1
- import { Platform } from 'react-native';
2
- import * as WebBrowser from 'expo-web-browser';
1
+ import { OAuthProvider as OAuthProviderType } from '@openfort/openfort-js';
2
+ import * as AppleAuthentication from 'expo-apple-authentication';
3
3
  import * as Linking from 'expo-linking';
4
+ import * as WebBrowser from 'expo-web-browser';
5
+ import { Platform } from 'react-native';
4
6
  import { logger } from '../lib/logger';
5
- import * as AppleAuthentication from 'expo-apple-authentication';
6
- import { OAuthProvider as OAuthProviderType } from '@openfort/openfort-js';
7
7
  /**
8
8
  * Opens an OAuth authentication session
9
9
  */
@@ -160,9 +160,7 @@ export const OAuthUtils = {
160
160
  * Checks if a provider should use native authentication
161
161
  */
162
162
  shouldUseNativeAuth(provider, isLegacyAppleIosBehaviorEnabled = false) {
163
- return (Platform.OS === 'ios' &&
164
- provider === 'apple' &&
165
- !isLegacyAppleIosBehaviorEnabled);
163
+ return Platform.OS === 'ios' && provider === 'apple' && !isLegacyAppleIosBehaviorEnabled;
166
164
  },
167
165
  /**
168
166
  * Gets platform-specific OAuth configuration
@@ -185,7 +183,7 @@ export const OAuthUtils = {
185
183
  OAuthProviderType.LINE,
186
184
  OAuthProviderType.FACEBOOK,
187
185
  OAuthProviderType.EPIC_GAMES,
188
- OAuthProviderType.APPLE
186
+ OAuthProviderType.APPLE,
189
187
  ];
190
188
  return supportedProviders.includes(provider);
191
189
  },
@@ -213,9 +211,6 @@ export const OAuthUtils = {
213
211
  * Combines OAuth session with timeout
214
212
  */
215
213
  async withTimeout(promise, timeoutMs = 120000) {
216
- return Promise.race([
217
- promise,
218
- this.createTimeoutPromise(timeoutMs),
219
- ]);
214
+ return Promise.race([promise, this.createTimeoutPromise(timeoutMs)]);
220
215
  },
221
216
  };
@@ -101,8 +101,16 @@ export async function handleSecureStorageMessage(message) {
101
101
  // Systematically delete all known storage keys for this origin
102
102
  // These are the keys used by the iframe signature service
103
103
  const storageKeys = [
104
- 'playerID', 'chainId', 'deviceID', 'accountType', 'address',
105
- 'ownerAddress', 'share', 'account', 'chainType', 'signerId'
104
+ 'playerID',
105
+ 'chainId',
106
+ 'deviceID',
107
+ 'accountType',
108
+ 'address',
109
+ 'ownerAddress',
110
+ 'share',
111
+ 'account',
112
+ 'chainType',
113
+ 'signerId',
106
114
  ];
107
115
  const deletePromises = storageKeys.map(async (key) => {
108
116
  const fullKey = normalizeKey(`${origin}:${key}`);
@@ -1,9 +1,10 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import React, { useRef, useCallback, useEffect } from 'react';
2
+ // biome-ignore lint: need to import react
3
+ import React, { useCallback, useEffect, useRef } from 'react';
3
4
  import { AppState, Platform, View } from 'react-native';
4
5
  import WebView from 'react-native-webview';
5
- import { isSecureStorageMessage, handleSecureStorageMessage } from './storage';
6
6
  import { logger } from '../lib/logger';
7
+ import { handleSecureStorageMessage, isSecureStorageMessage } from './storage';
7
8
  /**
8
9
  * WebView component for embedded wallet integration
9
10
  * Handles secure communication between React Native and the embedded wallet WebView
@@ -45,7 +46,7 @@ export const EmbeddedWalletWebView = ({ client, isClientReady, onProxyStatusChan
45
46
  const messagePoster = {
46
47
  postMessage: (message) => {
47
48
  webViewRef.current?.postMessage(message);
48
- }
49
+ },
49
50
  };
50
51
  client.embeddedWallet.setMessagePoster(messagePoster);
51
52
  }
@@ -73,13 +74,14 @@ export const EmbeddedWalletWebView = ({ client, isClientReady, onProxyStatusChan
73
74
  // Ref callback to set up message poster immediately
74
75
  const handleWebViewRef = useCallback((ref) => {
75
76
  if (webViewRef.current !== ref) {
77
+ ;
76
78
  webViewRef.current = ref;
77
79
  }
78
80
  if (ref) {
79
81
  const messagePoster = {
80
82
  postMessage: (message) => {
81
83
  ref.postMessage(message);
82
- }
84
+ },
83
85
  };
84
86
  client.embeddedWallet.setMessagePoster(messagePoster);
85
87
  }
@@ -144,7 +146,7 @@ export const WebViewUtils = {
144
146
  catch (error) {
145
147
  return {
146
148
  isValid: false,
147
- error: error instanceof Error ? error.message : 'Failed to parse message'
149
+ error: error instanceof Error ? error.message : 'Failed to parse message',
148
150
  };
149
151
  }
150
152
  },
@@ -3,6 +3,6 @@ export const mapStatus = (status) => {
3
3
  isLoading: status.status === 'loading',
4
4
  isError: status.status === 'error',
5
5
  isSuccess: status.status === 'success',
6
- error: status.error
6
+ error: status.error,
7
7
  };
8
8
  };
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import type React from 'react';
2
2
  /**
3
3
  * Props for the AuthBoundary component
4
4
  */
@@ -81,4 +81,3 @@ export interface AuthBoundaryProps {
81
81
  * ```
82
82
  */
83
83
  export declare const AuthBoundary: React.FC<AuthBoundaryProps>;
84
- export default AuthBoundary;
@@ -4,4 +4,4 @@
4
4
  * This barrel currently exposes the authentication boundary component used to gate
5
5
  * access to protected UI based on SDK readiness and user state.
6
6
  */
7
- export { AuthBoundary } from './AuthBoundary';
7
+ export { AuthBoundary, type AuthBoundaryProps } from './AuthBoundary';
@@ -1,4 +1,4 @@
1
- import { Openfort as OpenfortClient, OpenfortSDKConfiguration } from '@openfort/openfort-js';
1
+ import { Openfort as OpenfortClient, type OpenfortSDKConfiguration } from '@openfort/openfort-js';
2
2
  /**
3
3
  * Creates an {@link OpenfortClient} configured for Expo and React Native environments.
4
4
  *
@@ -1,6 +1,6 @@
1
+ import type { EmbeddedState, Openfort as OpenfortClient } from '@openfort/openfort-js';
1
2
  import React from 'react';
2
- import type { Openfort as OpenfortClient, EmbeddedState } from '@openfort/openfort-js';
3
- import { OAuthFlowState, PasswordFlowState, RecoveryFlowState, SiweFlowState } from '../types';
3
+ import type { OAuthFlowState, PasswordFlowState, RecoveryFlowState, SiweFlowState } from '../types';
4
4
  import type { Chain, EmbeddedWalletConfiguration } from './provider';
5
5
  /**
6
6
  * Core Openfort context interface describing the state and methods exposed through {@link OpenfortContext}.
@@ -1,8 +1,8 @@
1
- export { createOpenfortClient, getDefaultClient, setDefaultClient } from './client';
2
- export { RecoveryMethod } from '@openfort/openfort-js';
3
1
  export type { SDKOverrides } from '@openfort/openfort-js';
4
- export { OpenfortContext, useOpenfortContext, useOpenfortContextSafe, isOpenfortContextValue } from './context';
2
+ export { RecoveryMethod } from '@openfort/openfort-js';
3
+ export { createOpenfortClient, getDefaultClient, setDefaultClient } from './client';
5
4
  export type { OpenfortContextValue } from './context';
5
+ export { isOpenfortContextValue, OpenfortContext, useOpenfortContext, useOpenfortContextSafe } from './context';
6
+ export type { CommonEmbeddedWalletConfiguration, EmbeddedWalletConfiguration, EncryptionSession, OpenfortProviderProps, } from './provider';
6
7
  export { OpenfortProvider } from './provider';
7
- export type { OpenfortProviderProps, EmbeddedWalletConfiguration, CommonEmbeddedWalletConfiguration, EncryptionSession, } from './provider';
8
- export { SecureStorageAdapter, createNormalizedStorage } from './storage';
8
+ export { createNormalizedStorage, SecureStorageAdapter } from './storage';
@@ -1,5 +1,5 @@
1
+ import { type AccountTypeEnum, type SDKOverrides, type ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
1
2
  import React from 'react';
2
- import { SDKOverrides, AccountTypeEnum, ThirdPartyAuthConfiguration } from '@openfort/openfort-js';
3
3
  /**
4
4
  * Shape for configuring custom authentication synchronization behavior.
5
5
  */
@@ -1,4 +1,4 @@
1
- import { Storage } from '@openfort/openfort-js';
1
+ import type { Storage } from '@openfort/openfort-js';
2
2
  declare enum StorageKeys {
3
3
  AUTHENTICATION = "openfort.authentication",
4
4
  SIGNER = "openfort.signer",
@@ -3,8 +3,12 @@
3
3
  *
4
4
  * This module re-exports all authentication-related hooks for convenient importing.
5
5
  */
6
+ export type { EmailAuthResult, EmailVerificationResult, LinkEmailOptions, RequestResetPasswordOptions, ResetPasswordOptions, SignInEmailOptions, SignUpEmailOptions, UseEmailHookOptions, VerifyEmailOptions, } from './useEmailAuth';
6
7
  export { useEmailAuth } from './useEmailAuth';
7
- export { useOAuth } from './useOAuth';
8
- export { useWalletAuth } from './useWalletAuth';
8
+ export type { GuestHookOptions, GuestHookResult } from './useGuestAuth';
9
9
  export { useGuestAuth } from './useGuestAuth';
10
+ export type { AuthHookOptions, InitializeOAuthOptions, InitOAuthReturnType, StoreCredentialsResult, } from './useOAuth';
11
+ export { useOAuth } from './useOAuth';
10
12
  export { useSignOut } from './useSignOut';
13
+ export type { WalletHookOptions, WalletHookResult } from './useWalletAuth';
14
+ export { useWalletAuth } from './useWalletAuth';
@@ -1,15 +1 @@
1
- export type CreateWalletPostAuthOptions = {};
2
- /**
3
- * Hook for creating wallets after user authentication.
4
- *
5
- * TODO: the implementation is currently a placeholder that always returns an
6
- * undefined wallet. Once the post-auth wallet flow is wired up, this helper will
7
- * attempt to provision or connect an embedded wallet automatically.
8
- *
9
- * @returns Object containing wallet creation utilities (placeholder for now).
10
- */
11
- export declare const useCreateWalletPostAuth: () => {
12
- tryUseWallet: ({}: CreateWalletPostAuthOptions) => Promise<{
13
- wallet: undefined;
14
- }>;
15
- };
1
+ export type CreateWalletPostAuthOptions = any;
@@ -1,7 +1,7 @@
1
1
  import type { AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
- import { OpenfortHookOptions } from '../../types/hookOption';
2
+ import type { OpenfortHookOptions } from '../../types/hookOption';
3
3
  import { OpenfortError } from '../../types/openfortError';
4
- import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
4
+ import type { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
5
5
  export type EmailAuthResult = {
6
6
  error?: OpenfortError;
7
7
  user?: OpenfortUser;
@@ -1,7 +1,7 @@
1
1
  import type { AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
- import { OpenfortHookOptions } from '../../types/hookOption';
2
+ import type { OpenfortHookOptions } from '../../types/hookOption';
3
3
  import { OpenfortError } from '../../types/openfortError';
4
- import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
4
+ import type { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
5
5
  export type GuestHookResult = {
6
6
  error?: OpenfortError;
7
7
  user?: OpenfortUser;
@@ -1,7 +1,7 @@
1
1
  import { OAuthProvider, type AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
- import { OpenfortHookOptions } from '../../types/hookOption';
3
- import { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
2
+ import type { OpenfortHookOptions } from '../../types/hookOption';
4
3
  import { OpenfortError } from '../../types/openfortError';
4
+ import type { CreateWalletPostAuthOptions } from './useCreateWalletPostAuth';
5
5
  export type InitializeOAuthOptions = {
6
6
  provider: OAuthProvider;
7
7
  redirectTo?: string;
@@ -1,5 +1,5 @@
1
- import { OpenfortHookOptions } from "../../types/hookOption";
2
- import { OpenfortError } from "../../types/openfortError";
1
+ import type { OpenfortHookOptions } from '../../types/hookOption';
2
+ import { OpenfortError } from '../../types/openfortError';
3
3
  /**
4
4
  * Hook for user sign out functionality
5
5
  *
@@ -1,5 +1,5 @@
1
- import { AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
- import { OpenfortHookOptions } from '../../types/hookOption';
1
+ import type { AuthPlayerResponse as OpenfortUser } from '@openfort/openfort-js';
2
+ import type { OpenfortHookOptions } from '../../types/hookOption';
3
3
  import { OpenfortError } from '../../types/openfortError';
4
4
  export type WalletHookResult = {
5
5
  error?: OpenfortError;
@@ -1,4 +1,4 @@
1
- import { UseOpenfort } from '../../types';
1
+ import type { UseOpenfort } from '../../types';
2
2
  /**
3
3
  * Hook that exposes the core state of the Openfort SDK.
4
4
  *
@@ -8,6 +8,6 @@
8
8
  * - Auth: Authentication helpers (email, OAuth, SIWE, guest)
9
9
  * - Wallet: Embedded wallet management utilities
10
10
  */
11
- export * from './core';
12
11
  export * from './auth';
12
+ export * from './core';
13
13
  export * from './wallet';
@@ -1,8 +1,8 @@
1
- import { AccountTypeEnum, ChainTypeEnum, Provider, RecoveryParams } from '@openfort/openfort-js';
2
- import { Hex } from '../../types/hex';
3
- import { OpenfortHookOptions } from '../../types/hookOption';
1
+ import { AccountTypeEnum, ChainTypeEnum, type Provider, type RecoveryParams } from '@openfort/openfort-js';
2
+ import type { Hex } from '../../types/hex';
3
+ import type { OpenfortHookOptions } from '../../types/hookOption';
4
4
  import { OpenfortError } from '../../types/openfortError';
5
- import { UserWallet } from '../../types/wallet';
5
+ import type { UserWallet } from '../../types/wallet';
6
6
  type SetActiveWalletResult = {
7
7
  error?: OpenfortError;
8
8
  wallet?: UserWallet;
@@ -7,12 +7,10 @@
7
7
  * required to integrate Openfort authentication and embedded wallets into React Native and
8
8
  * Expo applications.
9
9
  */
10
- export { AuthPlayerResponse, OpenfortError, RecoveryMethod, RecoveryParams, Openfort as OpenfortClient, Provider, OpenfortConfiguration, ShieldConfiguration, EmbeddedState, AuthResponse, EmbeddedAccount, SignedMessagePayload, AuthInitPayload, } from '@openfort/openfort-js';
11
- export { OAuthProvider, AccountTypeEnum, } from '@openfort/openfort-js';
12
- export { openfortEvents, OpenfortEventMap, OpenfortEvents, } from '@openfort/openfort-js';
13
- export * from './types';
14
- export * from './hooks';
10
+ export { AccountTypeEnum, AuthInitPayload, AuthPlayerResponse, AuthResponse, EmbeddedAccount, EmbeddedState, OAuthProvider, Openfort as OpenfortClient, OpenfortConfiguration, OpenfortError, OpenfortEventMap, OpenfortEvents, openfortEvents, Provider, RecoveryMethod, RecoveryParams, ShieldConfiguration, SignedMessagePayload, } from '@openfort/openfort-js';
15
11
  export * from './components';
12
+ export * from './constants';
16
13
  export * from './core';
14
+ export * from './hooks';
17
15
  export * from './native';
18
- export * from './constants';
16
+ export * from './types';
@@ -1,2 +1,2 @@
1
1
  // Predicate functions (exported directly, not as types)
2
- export { isConnected, isReconnecting, isConnecting, isDisconnected, isNotCreated, isCreating, hasError, needsRecovery, isLoading, isReady, needsUserAction, isStable, canTransact, getStateDescription, getActionText, } from './predicates';
2
+ export { canTransact, getActionText, getStateDescription, hasError, isConnected, isConnecting, isCreating, isDisconnected, isLoading, isNotCreated, isReady, isReconnecting, isStable, needsRecovery, needsUserAction, } from './predicates';