@openfort/react-native 1.0.7 → 1.0.9
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/hooks/core/index.js +1 -1
- package/dist/hooks/core/{usePasskeySupport.js → usePasskeyPrfSupport.js} +6 -8
- package/dist/hooks/wallet/useEmbeddedEthereumWallet.js +1 -1
- package/dist/hooks/wallet/useEmbeddedSolanaWallet.js +2 -1
- package/dist/native/index.js +1 -1
- package/dist/native/passkey.js +10 -3
- package/dist/types/hooks/core/index.d.ts +1 -1
- package/dist/types/hooks/core/usePasskeyPrfSupport.d.ts +11 -0
- package/dist/types/native/index.d.ts +1 -1
- package/dist/types/native/passkey.d.ts +3 -3
- package/dist/types/types/wallet.d.ts +4 -0
- package/package.json +1 -1
- package/dist/types/hooks/core/usePasskeySupport.d.ts +0 -13
package/dist/hooks/core/index.js
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
// Core SDK hooks
|
|
7
7
|
export { useOpenfort } from './useOpenfort';
|
|
8
8
|
export { useOpenfortClient } from './useOpenfortClient';
|
|
9
|
-
export {
|
|
9
|
+
export { usePasskeyPrfSupport } from './usePasskeyPrfSupport';
|
|
10
10
|
export { useUser } from './useUser';
|
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { isPasskeyPrfSupported } from '../../native/passkey';
|
|
3
3
|
/**
|
|
4
|
-
* Hook to detect if the
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* PRF support can only be determined during passkey creation via the
|
|
8
|
-
* `clientExtensionResults.prf.enabled` field in the response.
|
|
4
|
+
* Hook to detect if the device supports passkey-based wallet recovery with the PRF extension.
|
|
5
|
+
* Requires Android 14+ (API 34) or iOS 18+. On older versions or other platforms, returns
|
|
6
|
+
* `isSupported: false`. Use to conditionally show passkey options in your UI.
|
|
9
7
|
*
|
|
10
8
|
* @returns Object with `isSupported` boolean and `isLoading` state
|
|
11
9
|
*/
|
|
12
|
-
export function
|
|
10
|
+
export function usePasskeyPrfSupport() {
|
|
13
11
|
const [isSupported, setIsSupported] = useState(false);
|
|
14
12
|
const [isLoading, setIsLoading] = useState(true);
|
|
15
13
|
useEffect(() => {
|
|
16
14
|
async function checkSupport() {
|
|
17
15
|
try {
|
|
18
|
-
const available = await
|
|
16
|
+
const available = await isPasskeyPrfSupported();
|
|
19
17
|
setIsSupported(available);
|
|
20
18
|
}
|
|
21
19
|
catch {
|
|
@@ -552,7 +552,7 @@ export function useEmbeddedEthereumWallet(options = {}) {
|
|
|
552
552
|
wallets,
|
|
553
553
|
setActive,
|
|
554
554
|
setRecovery,
|
|
555
|
-
exportPrivateKey: client.embeddedWallet.exportPrivateKey,
|
|
555
|
+
exportPrivateKey: () => client.embeddedWallet.exportPrivateKey(),
|
|
556
556
|
};
|
|
557
557
|
// Priority 1: Explicit action states (user-initiated operations)
|
|
558
558
|
if (status.status === 'fetching-wallets') {
|
|
@@ -477,6 +477,7 @@ export function useEmbeddedSolanaWallet(options = {}) {
|
|
|
477
477
|
create,
|
|
478
478
|
wallets,
|
|
479
479
|
setActive,
|
|
480
|
+
exportPrivateKey: () => client.embeddedWallet.exportPrivateKey(),
|
|
480
481
|
};
|
|
481
482
|
// Priority 1: Explicit action states (user-initiated operations)
|
|
482
483
|
if (status.status === 'fetching-wallets') {
|
|
@@ -512,6 +513,6 @@ export function useEmbeddedSolanaWallet(options = {}) {
|
|
|
512
513
|
}
|
|
513
514
|
// Default: disconnected (authenticated but no wallet selected)
|
|
514
515
|
return { ...baseActions, status: 'disconnected', activeWallet: null };
|
|
515
|
-
}, [status, activeWallet, activeAccount, provider, wallets, embeddedState, create, setActive]);
|
|
516
|
+
}, [status, activeWallet, activeAccount, provider, wallets, embeddedState, create, setActive, client.embeddedWallet]);
|
|
516
517
|
return state;
|
|
517
518
|
}
|
package/dist/native/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// OAuth flows
|
|
2
2
|
export { authenticateWithApple, createOAuthRedirectUri, isAppleSignInAvailable, OAuthUtils, openOAuthSession, parseOAuthUrl, } from './oauth';
|
|
3
3
|
// Passkey handler and support checks
|
|
4
|
-
export { getPasskeyDiagnostics,
|
|
4
|
+
export { getPasskeyDiagnostics, isPasskeyPrfSupported, NativePasskeyHandler } from './passkey';
|
|
5
5
|
// Storage utilities
|
|
6
6
|
export { handleSecureStorageMessage, isSecureStorageMessage, NativeStorageUtils, } from './storage';
|
|
7
7
|
export { EmbeddedWalletWebView, WebViewUtils } from './webview';
|
package/dist/native/passkey.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PasskeyAssertionFailedError, PasskeyCreationFailedError, PasskeyPRFNotSupportedError, PasskeySeedInvalidError, PasskeyUserCancelledError, } from '@openfort/openfort-js';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
2
3
|
import { logger } from '../lib/logger';
|
|
3
4
|
/**
|
|
4
5
|
* Utility functions for passkey operations in React Native.
|
|
@@ -110,10 +111,16 @@ export function getPasskeyDiagnostics() {
|
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
/**
|
|
113
|
-
* Checks if the device supports passkeys (WebAuthn)
|
|
114
|
-
*
|
|
114
|
+
* Checks if the device supports passkeys (WebAuthn) with PRF extension. Requires Android 14+ or iOS 18+.
|
|
115
|
+
* Uses the library's isSupported() after platform version check. No credential creation.
|
|
115
116
|
*/
|
|
116
|
-
export async function
|
|
117
|
+
export async function isPasskeyPrfSupported() {
|
|
118
|
+
if (Platform.OS === 'android' && Platform.Version < 34)
|
|
119
|
+
return false;
|
|
120
|
+
if (Platform.OS === 'ios' && parseInt(String(Platform.Version), 10) < 18)
|
|
121
|
+
return false;
|
|
122
|
+
if (Platform.OS !== 'android' && Platform.OS !== 'ios')
|
|
123
|
+
return false;
|
|
117
124
|
const api = getPasskeysAPI();
|
|
118
125
|
if (!api || api.isSupported == null) {
|
|
119
126
|
return false;
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { useOpenfort } from './useOpenfort';
|
|
7
7
|
export { useOpenfortClient } from './useOpenfortClient';
|
|
8
|
-
export {
|
|
8
|
+
export { usePasskeyPrfSupport } from './usePasskeyPrfSupport';
|
|
9
9
|
export { useUser } from './useUser';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook to detect if the device supports passkey-based wallet recovery with the PRF extension.
|
|
3
|
+
* Requires Android 14+ (API 34) or iOS 18+. On older versions or other platforms, returns
|
|
4
|
+
* `isSupported: false`. Use to conditionally show passkey options in your UI.
|
|
5
|
+
*
|
|
6
|
+
* @returns Object with `isSupported` boolean and `isLoading` state
|
|
7
|
+
*/
|
|
8
|
+
export declare function usePasskeyPrfSupport(): {
|
|
9
|
+
isSupported: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { AppleAuthResult, OAuthResult, OAuthSessionConfig, } from './oauth';
|
|
2
2
|
export { authenticateWithApple, createOAuthRedirectUri, isAppleSignInAvailable, OAuthUtils, openOAuthSession, parseOAuthUrl, } from './oauth';
|
|
3
3
|
export type { NativePasskeyHandlerConfig, PasskeysAPI } from './passkey';
|
|
4
|
-
export { getPasskeyDiagnostics,
|
|
4
|
+
export { getPasskeyDiagnostics, isPasskeyPrfSupported, NativePasskeyHandler } from './passkey';
|
|
5
5
|
export type { SecureStorageMessage, SecureStorageResponse, } from './storage';
|
|
6
6
|
export { handleSecureStorageMessage, isSecureStorageMessage, NativeStorageUtils, } from './storage';
|
|
7
7
|
export { EmbeddedWalletWebView, WebViewUtils } from './webview';
|
|
@@ -49,10 +49,10 @@ export declare function getPasskeyDiagnostics(): {
|
|
|
49
49
|
moduleLoaded: boolean;
|
|
50
50
|
};
|
|
51
51
|
/**
|
|
52
|
-
* Checks if the device supports passkeys (WebAuthn)
|
|
53
|
-
*
|
|
52
|
+
* Checks if the device supports passkeys (WebAuthn) with PRF extension. Requires Android 14+ or iOS 18+.
|
|
53
|
+
* Uses the library's isSupported() after platform version check. No credential creation.
|
|
54
54
|
*/
|
|
55
|
-
export declare function
|
|
55
|
+
export declare function isPasskeyPrfSupported(): Promise<boolean>;
|
|
56
56
|
export interface NativePasskeyHandlerConfig {
|
|
57
57
|
rpId?: string;
|
|
58
58
|
rpName?: string;
|
|
@@ -315,6 +315,10 @@ export interface SolanaWalletActions {
|
|
|
315
315
|
* Set a wallet as active (recover/connect to it)
|
|
316
316
|
*/
|
|
317
317
|
setActive(options: SetActiveSolanaWalletOptions): Promise<void>;
|
|
318
|
+
/**
|
|
319
|
+
* Export the private key of the active wallet
|
|
320
|
+
*/
|
|
321
|
+
exportPrivateKey(): Promise<string>;
|
|
318
322
|
}
|
|
319
323
|
/**
|
|
320
324
|
* Ethereum wallet hook return type - discriminated union based on status
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hook to detect if the platform supports passkeys (WebAuthn).
|
|
3
|
-
*
|
|
4
|
-
* Note: This only checks basic passkey support, not PRF extension support.
|
|
5
|
-
* PRF support can only be determined during passkey creation via the
|
|
6
|
-
* `clientExtensionResults.prf.enabled` field in the response.
|
|
7
|
-
*
|
|
8
|
-
* @returns Object with `isSupported` boolean and `isLoading` state
|
|
9
|
-
*/
|
|
10
|
-
export declare function usePasskeySupport(): {
|
|
11
|
-
isSupported: boolean;
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
};
|