@moon-x/react-native-sdk 0.0.1

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.
@@ -0,0 +1,273 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { PostMessageType, PostMessageMethod } from '@moon-x/core/utils';
3
+ export { PostMessageMethod, PostMessageType } from '@moon-x/core/utils';
4
+ import { PublicWallet, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult } from '@moon-x/core/types';
5
+ export { Chain, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, Network, PublicWallet, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, WalletConnectConfig } from '@moon-x/core/types';
6
+ export { useAddPasskey, useCreateWallet, useImportKey, useLoginWithEmail, useLogout, usePasskeyStatus, useRegisterPasskey, useRemovePasskey, useUser, useWallets } from '@moon-x/core/react';
7
+
8
+ interface WebViewRefLike {
9
+ injectJavaScript: (script: string) => void;
10
+ }
11
+ interface WebViewMessageEventLike {
12
+ nativeEvent: {
13
+ data: string;
14
+ };
15
+ }
16
+ type IncomingMessageHandler<Payload, Response = unknown> = (payload: Payload) => Response | Promise<Response> | void | Promise<void>;
17
+ declare class WebViewBridge {
18
+ private webViewRef;
19
+ private pending;
20
+ private oneWayHandlers;
21
+ constructor(webViewRef: {
22
+ current: WebViewRefLike | null;
23
+ });
24
+ handleMessage: (event: WebViewMessageEventLike) => void;
25
+ register<Payload>(type: PostMessageType, method: PostMessageMethod | string, handler: IncomingMessageHandler<Payload>): () => void;
26
+ isReady(): boolean;
27
+ send<Payload, Response>(type: PostMessageType, method: PostMessageMethod | string, payload?: Payload): Promise<Response>;
28
+ sendOneWay<Payload>(type: PostMessageType, method: PostMessageMethod | string, payload?: Payload): void;
29
+ cleanup(reason?: string): void;
30
+ }
31
+
32
+ interface RNAuthSDK {
33
+ publishableKey: string;
34
+ ready: boolean;
35
+ sendCode: (params: {
36
+ email: string;
37
+ disableSignup?: boolean;
38
+ }) => Promise<void>;
39
+ loginWithCode: (params: {
40
+ code: string;
41
+ }) => Promise<void>;
42
+ verifyOAuth: (params: {
43
+ provider: "google" | "apple";
44
+ code?: string;
45
+ token?: string;
46
+ state?: string;
47
+ }) => Promise<any>;
48
+ isAuthenticated: boolean;
49
+ user: any | null;
50
+ getCurrentSession: () => Promise<any>;
51
+ getUser: () => Promise<any>;
52
+ refreshUser: () => Promise<void>;
53
+ getSessionTokens: () => Promise<{
54
+ refreshToken: string;
55
+ accessToken: string;
56
+ } | null>;
57
+ logout: () => Promise<{
58
+ success: boolean;
59
+ message: string;
60
+ }>;
61
+ createWallet: (walletType: "solana" | "ethereum", options?: {
62
+ createAdditional?: boolean;
63
+ walletIndex?: number;
64
+ }) => Promise<{
65
+ wallet: PublicWallet;
66
+ }>;
67
+ importKey: (walletType: "solana" | "ethereum", key: string) => Promise<{
68
+ wallet: PublicWallet;
69
+ }>;
70
+ getWallets: (walletType: "solana" | "ethereum") => Promise<{
71
+ wallets: any[];
72
+ walletType: string;
73
+ }>;
74
+ getPasskeyStatus: () => Promise<{
75
+ has_passkey: boolean;
76
+ passkeys: Array<{
77
+ id: string;
78
+ credential_id: string;
79
+ created_at: string;
80
+ last_used_at: string | null;
81
+ aaguid?: string;
82
+ transports?: string[];
83
+ backup_state?: boolean;
84
+ registered_browser?: string;
85
+ registered_os?: string;
86
+ }>;
87
+ }>;
88
+ removePasskey: (credentialIdB64url: string) => Promise<void>;
89
+ registerPasskey: (params?: {
90
+ displayName?: string;
91
+ }) => Promise<{
92
+ credential_id: string;
93
+ }>;
94
+ signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
95
+ signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
96
+ signEthereumTypedDataHeadless: (params: EthereumSignTypedDataParams) => Promise<EthereumSignTypedDataResult>;
97
+ signEthereumHashHeadless: (params: EthereumSignHashParams) => Promise<EthereumSignHashResult>;
98
+ signEthereum7702AuthorizationHeadless: (params: EthereumSign7702AuthorizationParams) => Promise<EthereumSign7702AuthorizationResult>;
99
+ sendEthereumTransactionHeadless: (params: EthereumSendTransactionParams) => Promise<EthereumSendTransactionResult>;
100
+ getEthereumBalance: (params: EthereumGetBalanceParams) => Promise<EthereumGetBalanceResult>;
101
+ signSolanaMessageHeadless: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
102
+ signSolanaTransactionHeadless: (params: SolanaSignTransactionParams) => Promise<SolanaSignTransactionResult>;
103
+ sendSolanaTransactionHeadless: (params: SolanaSendTransactionParams) => Promise<SolanaSendTransactionResult>;
104
+ getSolanaBalance: (params: SolanaGetBalanceParams) => Promise<SolanaGetBalanceResult>;
105
+ }
106
+
107
+ interface MoonKeyConfig {
108
+ /**
109
+ * Iframe URL the WebView loads. Optional — defaults to the MoonX
110
+ * production iframe. Override this for staging / preview / local
111
+ * development. The iframe-app detects WebView mode at runtime via
112
+ * `window.ReactNativeWebView` and routes replies through the bridge
113
+ * automatically; no per-deployment changes needed.
114
+ */
115
+ iframeUrl?: string;
116
+ /**
117
+ * Email OTP options forwarded to the iframe-app on `sendCode`.
118
+ */
119
+ emailConfig?: {
120
+ expiresIn?: number;
121
+ };
122
+ /**
123
+ * Deep-link URI scheme used as the OAuth redirect target.
124
+ */
125
+ oauthRedirectUri?: string;
126
+ /**
127
+ * UI strings for the sensitive-flow modal chrome (close button,
128
+ * default title). Defaults are reasonable English copy.
129
+ */
130
+ sensitiveModalCopy?: {
131
+ closeLabel?: string;
132
+ };
133
+ /**
134
+ * Security-policy knobs. Safe defaults (the entire `security` object
135
+ * can be omitted for the strictest posture).
136
+ */
137
+ security?: {
138
+ /**
139
+ * TTL in milliseconds for the parent-side passkey assertion cache.
140
+ *
141
+ * Default: 0 (no cache — every sensitive op forces a fresh
142
+ * biometric prompt). This is the safe-by-default posture; the raw
143
+ * userHandle (the AES-GCM KEK that unwraps the user's DEK) never
144
+ * lingers in JS heap past the moment of use.
145
+ *
146
+ * Set to a positive number (e.g. 5 * 60 * 1000) only if the app
147
+ * has a UX that genuinely benefits from skipping the OS passkey
148
+ * prompt on routine ops within a window. Sensitive operations
149
+ * (export, addPasskey, removePasskey, and any call passing
150
+ * `requireFreshAssertion: true`) bypass the cache regardless.
151
+ */
152
+ assertionCacheTtlMs?: number;
153
+ };
154
+ }
155
+ interface MoonKeyProviderProps {
156
+ publishableKey: string;
157
+ config?: MoonKeyConfig;
158
+ children: ReactNode;
159
+ }
160
+ interface SensitiveFlowOptions {
161
+ /**
162
+ * Path-with-query the WebView navigates to for this flow, relative
163
+ * to `iframeUrl`. Example: `/export-key?wallet_id=…`.
164
+ * The iframe-app's route renders the flow UI inside the WebView.
165
+ */
166
+ flowPath: string;
167
+ /**
168
+ * Title shown in the RN modal chrome. Defaults to a generic label.
169
+ */
170
+ title?: string;
171
+ /**
172
+ * Resolves the consumer-side promise after `flowPath` completes.
173
+ * Implementations typically register a one-way bridge handler via
174
+ * `bridge.register(...)` for the iframe-app's completion postMessage,
175
+ * resolve the promise from there, and unregister on unmount.
176
+ *
177
+ * The provider takes care of:
178
+ * 1. Toggling sensitiveVisible → true
179
+ * 2. Navigating the WebView to `flowPath`
180
+ * 3. Toggling sensitiveVisible → false on resolve / cancel
181
+ * 4. Navigating the WebView back to the main `iframeUrl`
182
+ */
183
+ onMount: (api: SensitiveFlowMountApi) => Promise<void> | void;
184
+ }
185
+ interface SensitiveFlowMountApi {
186
+ bridge: WebViewBridge;
187
+ cancel: () => void;
188
+ }
189
+ interface MoonKeyContextValue {
190
+ sdk: RNAuthSDK;
191
+ _bridge: WebViewBridge;
192
+ _runSensitiveFlow: (options: SensitiveFlowOptions) => Promise<void>;
193
+ _oauthRedirectUri?: string;
194
+ }
195
+ declare const MoonKeyProvider: React.FC<MoonKeyProviderProps>;
196
+ declare const useMoonKeyContext: () => MoonKeyContextValue;
197
+
198
+ type State$1 = {
199
+ status: "idle";
200
+ } | {
201
+ status: "starting";
202
+ } | {
203
+ status: "redirecting";
204
+ } | {
205
+ status: "verifying";
206
+ } | {
207
+ status: "complete";
208
+ } | {
209
+ status: "error";
210
+ error: Error;
211
+ };
212
+ declare const useAttachOAuth: (params?: {
213
+ redirectUri?: string;
214
+ }) => {
215
+ state: State$1;
216
+ attachOAuth: (provider: "google" | "apple") => Promise<void>;
217
+ reset: () => void;
218
+ };
219
+
220
+ declare const useDetachOAuth: () => {
221
+ detachOAuth: (idpUserId: string) => Promise<void>;
222
+ };
223
+
224
+ /**
225
+ * Trigger the export-key flow. The plaintext private key never leaves
226
+ * the WebView's DOM — the iframe-app's `/export-key` route renders the
227
+ * UI inside the WebView, which is presented full-screen during the
228
+ * flow. The RN-side promise resolves when the user dismisses the
229
+ * modal (the only v1 completion signal — an iframe-app-emitted
230
+ * EXPORT_COMPLETE one-way is a planned enhancement).
231
+ *
232
+ * Sensitive op: forces a fresh biometric prompt regardless of the
233
+ * parent-side warm-cache state, matching the web SDK's posture.
234
+ */
235
+ declare const useExportKey: () => {
236
+ exportKey: (wallet: PublicWallet) => Promise<void>;
237
+ };
238
+
239
+ type State = {
240
+ status: "idle";
241
+ } | {
242
+ status: "starting";
243
+ } | {
244
+ status: "redirecting";
245
+ } | {
246
+ status: "verifying";
247
+ } | {
248
+ status: "complete";
249
+ user: any;
250
+ } | {
251
+ status: "error";
252
+ error: Error;
253
+ };
254
+ declare const useLoginWithOAuth: (params?: {
255
+ /**
256
+ * Override the provider's `oauthRedirectUri` config for this hook.
257
+ * Useful when one app supports multiple deep-link schemes.
258
+ */
259
+ redirectUri?: string;
260
+ }) => {
261
+ state: State;
262
+ loginWithOAuth: (provider: "google" | "apple") => Promise<void>;
263
+ reset: () => void;
264
+ };
265
+
266
+ /**
267
+ * Returns the active RN AuthSDK instance. Mirrors the web SDK's
268
+ * `useMoonKey()` shape so app code can be moved between web and RN
269
+ * with a 1-line import swap.
270
+ */
271
+ declare const useMoonKey: () => RNAuthSDK;
272
+
273
+ export { type MoonKeyConfig, MoonKeyProvider, type MoonKeyProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonKey, useMoonKeyContext };
@@ -0,0 +1,273 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { PostMessageType, PostMessageMethod } from '@moon-x/core/utils';
3
+ export { PostMessageMethod, PostMessageType } from '@moon-x/core/utils';
4
+ import { PublicWallet, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult } from '@moon-x/core/types';
5
+ export { Chain, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, Network, PublicWallet, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, WalletConnectConfig } from '@moon-x/core/types';
6
+ export { useAddPasskey, useCreateWallet, useImportKey, useLoginWithEmail, useLogout, usePasskeyStatus, useRegisterPasskey, useRemovePasskey, useUser, useWallets } from '@moon-x/core/react';
7
+
8
+ interface WebViewRefLike {
9
+ injectJavaScript: (script: string) => void;
10
+ }
11
+ interface WebViewMessageEventLike {
12
+ nativeEvent: {
13
+ data: string;
14
+ };
15
+ }
16
+ type IncomingMessageHandler<Payload, Response = unknown> = (payload: Payload) => Response | Promise<Response> | void | Promise<void>;
17
+ declare class WebViewBridge {
18
+ private webViewRef;
19
+ private pending;
20
+ private oneWayHandlers;
21
+ constructor(webViewRef: {
22
+ current: WebViewRefLike | null;
23
+ });
24
+ handleMessage: (event: WebViewMessageEventLike) => void;
25
+ register<Payload>(type: PostMessageType, method: PostMessageMethod | string, handler: IncomingMessageHandler<Payload>): () => void;
26
+ isReady(): boolean;
27
+ send<Payload, Response>(type: PostMessageType, method: PostMessageMethod | string, payload?: Payload): Promise<Response>;
28
+ sendOneWay<Payload>(type: PostMessageType, method: PostMessageMethod | string, payload?: Payload): void;
29
+ cleanup(reason?: string): void;
30
+ }
31
+
32
+ interface RNAuthSDK {
33
+ publishableKey: string;
34
+ ready: boolean;
35
+ sendCode: (params: {
36
+ email: string;
37
+ disableSignup?: boolean;
38
+ }) => Promise<void>;
39
+ loginWithCode: (params: {
40
+ code: string;
41
+ }) => Promise<void>;
42
+ verifyOAuth: (params: {
43
+ provider: "google" | "apple";
44
+ code?: string;
45
+ token?: string;
46
+ state?: string;
47
+ }) => Promise<any>;
48
+ isAuthenticated: boolean;
49
+ user: any | null;
50
+ getCurrentSession: () => Promise<any>;
51
+ getUser: () => Promise<any>;
52
+ refreshUser: () => Promise<void>;
53
+ getSessionTokens: () => Promise<{
54
+ refreshToken: string;
55
+ accessToken: string;
56
+ } | null>;
57
+ logout: () => Promise<{
58
+ success: boolean;
59
+ message: string;
60
+ }>;
61
+ createWallet: (walletType: "solana" | "ethereum", options?: {
62
+ createAdditional?: boolean;
63
+ walletIndex?: number;
64
+ }) => Promise<{
65
+ wallet: PublicWallet;
66
+ }>;
67
+ importKey: (walletType: "solana" | "ethereum", key: string) => Promise<{
68
+ wallet: PublicWallet;
69
+ }>;
70
+ getWallets: (walletType: "solana" | "ethereum") => Promise<{
71
+ wallets: any[];
72
+ walletType: string;
73
+ }>;
74
+ getPasskeyStatus: () => Promise<{
75
+ has_passkey: boolean;
76
+ passkeys: Array<{
77
+ id: string;
78
+ credential_id: string;
79
+ created_at: string;
80
+ last_used_at: string | null;
81
+ aaguid?: string;
82
+ transports?: string[];
83
+ backup_state?: boolean;
84
+ registered_browser?: string;
85
+ registered_os?: string;
86
+ }>;
87
+ }>;
88
+ removePasskey: (credentialIdB64url: string) => Promise<void>;
89
+ registerPasskey: (params?: {
90
+ displayName?: string;
91
+ }) => Promise<{
92
+ credential_id: string;
93
+ }>;
94
+ signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
95
+ signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
96
+ signEthereumTypedDataHeadless: (params: EthereumSignTypedDataParams) => Promise<EthereumSignTypedDataResult>;
97
+ signEthereumHashHeadless: (params: EthereumSignHashParams) => Promise<EthereumSignHashResult>;
98
+ signEthereum7702AuthorizationHeadless: (params: EthereumSign7702AuthorizationParams) => Promise<EthereumSign7702AuthorizationResult>;
99
+ sendEthereumTransactionHeadless: (params: EthereumSendTransactionParams) => Promise<EthereumSendTransactionResult>;
100
+ getEthereumBalance: (params: EthereumGetBalanceParams) => Promise<EthereumGetBalanceResult>;
101
+ signSolanaMessageHeadless: (params: SolanaSignMessageParams) => Promise<SolanaSignMessageResult>;
102
+ signSolanaTransactionHeadless: (params: SolanaSignTransactionParams) => Promise<SolanaSignTransactionResult>;
103
+ sendSolanaTransactionHeadless: (params: SolanaSendTransactionParams) => Promise<SolanaSendTransactionResult>;
104
+ getSolanaBalance: (params: SolanaGetBalanceParams) => Promise<SolanaGetBalanceResult>;
105
+ }
106
+
107
+ interface MoonKeyConfig {
108
+ /**
109
+ * Iframe URL the WebView loads. Optional — defaults to the MoonX
110
+ * production iframe. Override this for staging / preview / local
111
+ * development. The iframe-app detects WebView mode at runtime via
112
+ * `window.ReactNativeWebView` and routes replies through the bridge
113
+ * automatically; no per-deployment changes needed.
114
+ */
115
+ iframeUrl?: string;
116
+ /**
117
+ * Email OTP options forwarded to the iframe-app on `sendCode`.
118
+ */
119
+ emailConfig?: {
120
+ expiresIn?: number;
121
+ };
122
+ /**
123
+ * Deep-link URI scheme used as the OAuth redirect target.
124
+ */
125
+ oauthRedirectUri?: string;
126
+ /**
127
+ * UI strings for the sensitive-flow modal chrome (close button,
128
+ * default title). Defaults are reasonable English copy.
129
+ */
130
+ sensitiveModalCopy?: {
131
+ closeLabel?: string;
132
+ };
133
+ /**
134
+ * Security-policy knobs. Safe defaults (the entire `security` object
135
+ * can be omitted for the strictest posture).
136
+ */
137
+ security?: {
138
+ /**
139
+ * TTL in milliseconds for the parent-side passkey assertion cache.
140
+ *
141
+ * Default: 0 (no cache — every sensitive op forces a fresh
142
+ * biometric prompt). This is the safe-by-default posture; the raw
143
+ * userHandle (the AES-GCM KEK that unwraps the user's DEK) never
144
+ * lingers in JS heap past the moment of use.
145
+ *
146
+ * Set to a positive number (e.g. 5 * 60 * 1000) only if the app
147
+ * has a UX that genuinely benefits from skipping the OS passkey
148
+ * prompt on routine ops within a window. Sensitive operations
149
+ * (export, addPasskey, removePasskey, and any call passing
150
+ * `requireFreshAssertion: true`) bypass the cache regardless.
151
+ */
152
+ assertionCacheTtlMs?: number;
153
+ };
154
+ }
155
+ interface MoonKeyProviderProps {
156
+ publishableKey: string;
157
+ config?: MoonKeyConfig;
158
+ children: ReactNode;
159
+ }
160
+ interface SensitiveFlowOptions {
161
+ /**
162
+ * Path-with-query the WebView navigates to for this flow, relative
163
+ * to `iframeUrl`. Example: `/export-key?wallet_id=…`.
164
+ * The iframe-app's route renders the flow UI inside the WebView.
165
+ */
166
+ flowPath: string;
167
+ /**
168
+ * Title shown in the RN modal chrome. Defaults to a generic label.
169
+ */
170
+ title?: string;
171
+ /**
172
+ * Resolves the consumer-side promise after `flowPath` completes.
173
+ * Implementations typically register a one-way bridge handler via
174
+ * `bridge.register(...)` for the iframe-app's completion postMessage,
175
+ * resolve the promise from there, and unregister on unmount.
176
+ *
177
+ * The provider takes care of:
178
+ * 1. Toggling sensitiveVisible → true
179
+ * 2. Navigating the WebView to `flowPath`
180
+ * 3. Toggling sensitiveVisible → false on resolve / cancel
181
+ * 4. Navigating the WebView back to the main `iframeUrl`
182
+ */
183
+ onMount: (api: SensitiveFlowMountApi) => Promise<void> | void;
184
+ }
185
+ interface SensitiveFlowMountApi {
186
+ bridge: WebViewBridge;
187
+ cancel: () => void;
188
+ }
189
+ interface MoonKeyContextValue {
190
+ sdk: RNAuthSDK;
191
+ _bridge: WebViewBridge;
192
+ _runSensitiveFlow: (options: SensitiveFlowOptions) => Promise<void>;
193
+ _oauthRedirectUri?: string;
194
+ }
195
+ declare const MoonKeyProvider: React.FC<MoonKeyProviderProps>;
196
+ declare const useMoonKeyContext: () => MoonKeyContextValue;
197
+
198
+ type State$1 = {
199
+ status: "idle";
200
+ } | {
201
+ status: "starting";
202
+ } | {
203
+ status: "redirecting";
204
+ } | {
205
+ status: "verifying";
206
+ } | {
207
+ status: "complete";
208
+ } | {
209
+ status: "error";
210
+ error: Error;
211
+ };
212
+ declare const useAttachOAuth: (params?: {
213
+ redirectUri?: string;
214
+ }) => {
215
+ state: State$1;
216
+ attachOAuth: (provider: "google" | "apple") => Promise<void>;
217
+ reset: () => void;
218
+ };
219
+
220
+ declare const useDetachOAuth: () => {
221
+ detachOAuth: (idpUserId: string) => Promise<void>;
222
+ };
223
+
224
+ /**
225
+ * Trigger the export-key flow. The plaintext private key never leaves
226
+ * the WebView's DOM — the iframe-app's `/export-key` route renders the
227
+ * UI inside the WebView, which is presented full-screen during the
228
+ * flow. The RN-side promise resolves when the user dismisses the
229
+ * modal (the only v1 completion signal — an iframe-app-emitted
230
+ * EXPORT_COMPLETE one-way is a planned enhancement).
231
+ *
232
+ * Sensitive op: forces a fresh biometric prompt regardless of the
233
+ * parent-side warm-cache state, matching the web SDK's posture.
234
+ */
235
+ declare const useExportKey: () => {
236
+ exportKey: (wallet: PublicWallet) => Promise<void>;
237
+ };
238
+
239
+ type State = {
240
+ status: "idle";
241
+ } | {
242
+ status: "starting";
243
+ } | {
244
+ status: "redirecting";
245
+ } | {
246
+ status: "verifying";
247
+ } | {
248
+ status: "complete";
249
+ user: any;
250
+ } | {
251
+ status: "error";
252
+ error: Error;
253
+ };
254
+ declare const useLoginWithOAuth: (params?: {
255
+ /**
256
+ * Override the provider's `oauthRedirectUri` config for this hook.
257
+ * Useful when one app supports multiple deep-link schemes.
258
+ */
259
+ redirectUri?: string;
260
+ }) => {
261
+ state: State;
262
+ loginWithOAuth: (provider: "google" | "apple") => Promise<void>;
263
+ reset: () => void;
264
+ };
265
+
266
+ /**
267
+ * Returns the active RN AuthSDK instance. Mirrors the web SDK's
268
+ * `useMoonKey()` shape so app code can be moved between web and RN
269
+ * with a 1-line import swap.
270
+ */
271
+ declare const useMoonKey: () => RNAuthSDK;
272
+
273
+ export { type MoonKeyConfig, MoonKeyProvider, type MoonKeyProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonKey, useMoonKeyContext };