@moon-x/react-native-sdk 0.9.0 → 0.10.0

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/README.md CHANGED
@@ -70,11 +70,11 @@ opted into JSC, add `text-encoding` and `base-64` polyfills here too.
70
70
  ## Provider
71
71
 
72
72
  ```tsx
73
- import { MoonKeyProvider } from "@moon-x/react-native-sdk";
73
+ import { MoonXProvider } from "@moon-x/react-native-sdk";
74
74
 
75
75
  export default function Root() {
76
76
  return (
77
- <MoonKeyProvider
77
+ <MoonXProvider
78
78
  publishableKey={process.env.EXPO_PUBLIC_MOONKEY_PUBLISHABLE_KEY!}
79
79
  config={{
80
80
  iframeUrl: "https://iframe.moonx-dev.com",
@@ -82,7 +82,7 @@ export default function Root() {
82
82
  }}
83
83
  >
84
84
  <App />
85
- </MoonKeyProvider>
85
+ </MoonXProvider>
86
86
  );
87
87
  }
88
88
  ```
@@ -131,7 +131,7 @@ TypeScript surface. Every op is always-fresh by construction.
131
131
 
132
132
  | Hook | What it does |
133
133
  |---|---|
134
- | `useMoonKey()` | The big one. `{ ready, isAuthenticated, user, start, logout, setAppearance, getSessionTokens, refreshUser, ... }` + every SDK method on the same instance. |
134
+ | `useMoonX()` | The big one. `{ ready, isAuthenticated, user, start, logout, setAppearance, getSessionTokens, refreshUser, ... }` + every SDK method on the same instance. |
135
135
  | `useUser()` | Just `{ user, refreshUser }`. Re-subscribes to user changes. |
136
136
  | `useLoginWithEmail({ onComplete?, onError? })` | Headless email-OTP. Returns `{ state, sendCode, loginWithCode, reset }`. `state` is a discriminated union: `idle` / `sending` / `awaiting-code` / `verifying` / `complete` / `error`. |
137
137
  | `useLoginWithOAuth()` | Google + Apple flows via `expo-web-browser`. Returns `{ state, loginWithOAuth, reset }`. |
@@ -186,7 +186,7 @@ Same return shapes as the web SDK — the wire contract is identical.
186
186
  ### Mobile-specific notes
187
187
 
188
188
  - **No `useConnectWallet`.** External-wallet connection (MetaMask, Phantom, WalletConnect) is web-only — MoonX wallets are the only thing you can sign with from the RN SDK.
189
- - **`useExportKey` is a top-level hook on RN.** On web the same operation hangs off `useMoonKey().exportKey()` inside a parent-side modal; on RN it toggles the always-mounted WebView into a full-screen visible state so the iframe-app renders the key UI itself.
189
+ - **`useExportKey` is a top-level hook on RN.** On web the same operation hangs off `useMoonX().exportKey()` inside a parent-side modal; on RN it toggles the always-mounted WebView into a full-screen visible state so the iframe-app renders the key UI itself.
190
190
 
191
191
  ## Visible-WebView pattern (sensitive flows)
192
192
 
package/dist/index.d.mts CHANGED
@@ -125,7 +125,7 @@ interface RNAuthSDK {
125
125
  getSolanaBalance: (params: SolanaGetBalanceParams) => Promise<SolanaGetBalanceResult>;
126
126
  }
127
127
 
128
- interface MoonKeyConfig {
128
+ interface MoonXConfig {
129
129
  /**
130
130
  * Iframe URL the WebView loads. Optional — defaults to the MoonX
131
131
  * production iframe. Override this for staging / preview / local
@@ -167,9 +167,9 @@ interface MoonKeyConfig {
167
167
  */
168
168
  security?: Record<string, never>;
169
169
  }
170
- interface MoonKeyProviderProps {
170
+ interface MoonXProviderProps {
171
171
  publishableKey: string;
172
- config?: MoonKeyConfig;
172
+ config?: MoonXConfig;
173
173
  children: ReactNode;
174
174
  }
175
175
  interface SensitiveFlowOptions {
@@ -208,7 +208,7 @@ interface MoonKeyContextValue {
208
208
  _runSensitiveFlow: (options: SensitiveFlowOptions) => Promise<void>;
209
209
  _oauthRedirectUri?: string;
210
210
  }
211
- declare const MoonKeyProvider: React.FC<MoonKeyProviderProps>;
211
+ declare const MoonXProvider: React.FC<MoonXProviderProps>;
212
212
  declare const useMoonKeyContext: () => MoonKeyContextValue;
213
213
 
214
214
  type State$1 = {
@@ -278,9 +278,9 @@ declare const useLoginWithOAuth: (params?: {
278
278
 
279
279
  /**
280
280
  * Returns the active RN AuthSDK instance. Mirrors the web SDK's
281
- * `useMoonKey()` shape so app code can be moved between web and RN
281
+ * `useMoonX()` shape so app code can be moved between web and RN
282
282
  * with a 1-line import swap.
283
283
  */
284
- declare const useMoonKey: () => RNAuthSDK;
284
+ declare const useMoonX: () => RNAuthSDK;
285
285
 
286
- export { type MoonKeyConfig, MoonKeyProvider, type MoonKeyProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonKey, useMoonKeyContext };
286
+ export { type MoonXConfig, MoonXProvider, type MoonXProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonKeyContext, useMoonX };
package/dist/index.d.ts CHANGED
@@ -125,7 +125,7 @@ interface RNAuthSDK {
125
125
  getSolanaBalance: (params: SolanaGetBalanceParams) => Promise<SolanaGetBalanceResult>;
126
126
  }
127
127
 
128
- interface MoonKeyConfig {
128
+ interface MoonXConfig {
129
129
  /**
130
130
  * Iframe URL the WebView loads. Optional — defaults to the MoonX
131
131
  * production iframe. Override this for staging / preview / local
@@ -167,9 +167,9 @@ interface MoonKeyConfig {
167
167
  */
168
168
  security?: Record<string, never>;
169
169
  }
170
- interface MoonKeyProviderProps {
170
+ interface MoonXProviderProps {
171
171
  publishableKey: string;
172
- config?: MoonKeyConfig;
172
+ config?: MoonXConfig;
173
173
  children: ReactNode;
174
174
  }
175
175
  interface SensitiveFlowOptions {
@@ -208,7 +208,7 @@ interface MoonKeyContextValue {
208
208
  _runSensitiveFlow: (options: SensitiveFlowOptions) => Promise<void>;
209
209
  _oauthRedirectUri?: string;
210
210
  }
211
- declare const MoonKeyProvider: React.FC<MoonKeyProviderProps>;
211
+ declare const MoonXProvider: React.FC<MoonXProviderProps>;
212
212
  declare const useMoonKeyContext: () => MoonKeyContextValue;
213
213
 
214
214
  type State$1 = {
@@ -278,9 +278,9 @@ declare const useLoginWithOAuth: (params?: {
278
278
 
279
279
  /**
280
280
  * Returns the active RN AuthSDK instance. Mirrors the web SDK's
281
- * `useMoonKey()` shape so app code can be moved between web and RN
281
+ * `useMoonX()` shape so app code can be moved between web and RN
282
282
  * with a 1-line import swap.
283
283
  */
284
- declare const useMoonKey: () => RNAuthSDK;
284
+ declare const useMoonX: () => RNAuthSDK;
285
285
 
286
- export { type MoonKeyConfig, MoonKeyProvider, type MoonKeyProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonKey, useMoonKeyContext };
286
+ export { type MoonXConfig, MoonXProvider, type MoonXProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonKeyContext, useMoonX };
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
- MoonKeyProvider: () => MoonKeyProvider,
33
+ MoonXProvider: () => MoonXProvider,
34
34
  PostMessageMethod: () => import_utils8.PostMessageMethod,
35
35
  PostMessageType: () => import_utils8.PostMessageType,
36
36
  useAddPasskey: () => import_react5.useAddPasskey,
@@ -43,8 +43,8 @@ __export(index_exports, {
43
43
  useLoginWithEmail: () => import_react5.useLoginWithEmail,
44
44
  useLoginWithOAuth: () => useLoginWithOAuth,
45
45
  useLogout: () => import_react5.useLogout,
46
- useMoonKey: () => useMoonKey,
47
46
  useMoonKeyContext: () => useMoonKeyContext,
47
+ useMoonX: () => useMoonX,
48
48
  usePasskeyStatus: () => import_react5.usePasskeyStatus,
49
49
  useRegisterPasskey: () => import_react5.useRegisterPasskey,
50
50
  useRemovePasskey: () => import_react5.useRemovePasskey,
@@ -582,7 +582,7 @@ var import_react2 = require("@moon-x/core/react");
582
582
  var import_jsx_runtime = require("react/jsx-runtime");
583
583
  var DEFAULT_IFRAME_URL = "https://iframe.moonx-dev.com";
584
584
  var MoonKeyContext = (0, import_react.createContext)(null);
585
- var MoonKeyProvider = ({
585
+ var MoonXProvider = ({
586
586
  publishableKey,
587
587
  config,
588
588
  children
@@ -853,7 +853,7 @@ var MoonKeyProvider = ({
853
853
  var useMoonKeyContext = () => {
854
854
  const ctx = (0, import_react.useContext)(MoonKeyContext);
855
855
  if (!ctx) {
856
- throw new Error("useMoonKey must be used within a MoonKeyProvider");
856
+ throw new Error("useMoonX must be used within a MoonXProvider");
857
857
  }
858
858
  return ctx;
859
859
  };
@@ -1057,14 +1057,16 @@ var useExportKey = () => {
1057
1057
  const params = new URLSearchParams({
1058
1058
  publishableKey: sdk.publishableKey,
1059
1059
  wallet_id: wallet.id ?? "",
1060
- wallet_type: wallet.wallet_type ?? "",
1060
+ wallet_type: wallet.wallet_type ?? ""
1061
+ });
1062
+ const secrets = new URLSearchParams({
1061
1063
  user_handle_b64url: userHandleB64url,
1062
1064
  credential_id_b64url: credentialIdB64url,
1063
1065
  keyshare_read_token: keyshareReadToken
1064
1066
  });
1065
1067
  await _runSensitiveFlow({
1066
1068
  title: "Export key",
1067
- flowPath: `/export-key?${params.toString()}`,
1069
+ flowPath: `/export-key?${params.toString()}#${secrets.toString()}`,
1068
1070
  // No completion postMessage in v1 — the user-tap-Done path
1069
1071
  // resolves the promise via the modal's cancel handler. The
1070
1072
  // promise simply waits for runSensitiveFlow to settle, which
@@ -1131,13 +1133,13 @@ var useLoginWithOAuth = (params) => {
1131
1133
  };
1132
1134
 
1133
1135
  // src/hooks/use-moonkey.ts
1134
- var useMoonKey = () => useMoonKeyContext().sdk;
1136
+ var useMoonX = () => useMoonKeyContext().sdk;
1135
1137
 
1136
1138
  // src/index.ts
1137
1139
  var import_utils8 = require("@moon-x/core/utils");
1138
1140
  // Annotate the CommonJS export names for ESM import in node:
1139
1141
  0 && (module.exports = {
1140
- MoonKeyProvider,
1142
+ MoonXProvider,
1141
1143
  PostMessageMethod,
1142
1144
  PostMessageType,
1143
1145
  useAddPasskey,
@@ -1150,8 +1152,8 @@ var import_utils8 = require("@moon-x/core/utils");
1150
1152
  useLoginWithEmail,
1151
1153
  useLoginWithOAuth,
1152
1154
  useLogout,
1153
- useMoonKey,
1154
1155
  useMoonKeyContext,
1156
+ useMoonX,
1155
1157
  usePasskeyStatus,
1156
1158
  useRegisterPasskey,
1157
1159
  useRemovePasskey,
package/dist/index.mjs CHANGED
@@ -556,7 +556,7 @@ import { SDKProvider } from "@moon-x/core/react";
556
556
  import { jsx, jsxs } from "react/jsx-runtime";
557
557
  var DEFAULT_IFRAME_URL = "https://iframe.moonx-dev.com";
558
558
  var MoonKeyContext = createContext(null);
559
- var MoonKeyProvider = ({
559
+ var MoonXProvider = ({
560
560
  publishableKey,
561
561
  config,
562
562
  children
@@ -827,7 +827,7 @@ var MoonKeyProvider = ({
827
827
  var useMoonKeyContext = () => {
828
828
  const ctx = useContext(MoonKeyContext);
829
829
  if (!ctx) {
830
- throw new Error("useMoonKey must be used within a MoonKeyProvider");
830
+ throw new Error("useMoonX must be used within a MoonXProvider");
831
831
  }
832
832
  return ctx;
833
833
  };
@@ -1043,14 +1043,16 @@ var useExportKey = () => {
1043
1043
  const params = new URLSearchParams({
1044
1044
  publishableKey: sdk.publishableKey,
1045
1045
  wallet_id: wallet.id ?? "",
1046
- wallet_type: wallet.wallet_type ?? "",
1046
+ wallet_type: wallet.wallet_type ?? ""
1047
+ });
1048
+ const secrets = new URLSearchParams({
1047
1049
  user_handle_b64url: userHandleB64url,
1048
1050
  credential_id_b64url: credentialIdB64url,
1049
1051
  keyshare_read_token: keyshareReadToken
1050
1052
  });
1051
1053
  await _runSensitiveFlow({
1052
1054
  title: "Export key",
1053
- flowPath: `/export-key?${params.toString()}`,
1055
+ flowPath: `/export-key?${params.toString()}#${secrets.toString()}`,
1054
1056
  // No completion postMessage in v1 — the user-tap-Done path
1055
1057
  // resolves the promise via the modal's cancel handler. The
1056
1058
  // promise simply waits for runSensitiveFlow to settle, which
@@ -1117,12 +1119,12 @@ var useLoginWithOAuth = (params) => {
1117
1119
  };
1118
1120
 
1119
1121
  // src/hooks/use-moonkey.ts
1120
- var useMoonKey = () => useMoonKeyContext().sdk;
1122
+ var useMoonX = () => useMoonKeyContext().sdk;
1121
1123
 
1122
1124
  // src/index.ts
1123
1125
  import { PostMessageMethod as PostMessageMethod7, PostMessageType as PostMessageType7 } from "@moon-x/core/utils";
1124
1126
  export {
1125
- MoonKeyProvider,
1127
+ MoonXProvider,
1126
1128
  PostMessageMethod7 as PostMessageMethod,
1127
1129
  PostMessageType7 as PostMessageType,
1128
1130
  useAddPasskey,
@@ -1135,8 +1137,8 @@ export {
1135
1137
  useLoginWithEmail,
1136
1138
  useLoginWithOAuth,
1137
1139
  useLogout,
1138
- useMoonKey,
1139
1140
  useMoonKeyContext,
1141
+ useMoonX,
1140
1142
  usePasskeyStatus,
1141
1143
  useRegisterPasskey,
1142
1144
  useRemovePasskey,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moon-x/react-native-sdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "MoonX React Native SDK — WebView-backed transport, react-native-passkeys, AsyncStorage. Mobile parity with @moon-x/react-sdk + @moon-x/core-sdk.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "typescript": "5.9.3"
50
50
  },
51
51
  "dependencies": {
52
- "@moon-x/core": "0.11.0"
52
+ "@moon-x/core": "0.12.0"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@expo/config-plugins": ">=10.0.0",