@moon-x/react-native-sdk 0.9.0 → 0.11.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 +6 -6
- package/dist/index.d.mts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +23 -21
- package/dist/index.mjs +20 -18
- package/package.json +2 -2
- package/plugin/index.js +2 -2
package/README.md
CHANGED
|
@@ -70,19 +70,19 @@ opted into JSC, add `text-encoding` and `base-64` polyfills here too.
|
|
|
70
70
|
## Provider
|
|
71
71
|
|
|
72
72
|
```tsx
|
|
73
|
-
import {
|
|
73
|
+
import { MoonXProvider } from "@moon-x/react-native-sdk";
|
|
74
74
|
|
|
75
75
|
export default function Root() {
|
|
76
76
|
return (
|
|
77
|
-
<
|
|
78
|
-
publishableKey={process.env.
|
|
77
|
+
<MoonXProvider
|
|
78
|
+
publishableKey={process.env.EXPO_PUBLIC_MOONX_PUBLISHABLE_KEY!}
|
|
79
79
|
config={{
|
|
80
80
|
iframeUrl: "https://iframe.moonx-dev.com",
|
|
81
81
|
oauthRedirectUri: "myapp://oauth-callback",
|
|
82
82
|
}}
|
|
83
83
|
>
|
|
84
84
|
<App />
|
|
85
|
-
</
|
|
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
|
-
| `
|
|
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 `
|
|
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
|
|
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
|
|
170
|
+
interface MoonXProviderProps {
|
|
171
171
|
publishableKey: string;
|
|
172
|
-
config?:
|
|
172
|
+
config?: MoonXConfig;
|
|
173
173
|
children: ReactNode;
|
|
174
174
|
}
|
|
175
175
|
interface SensitiveFlowOptions {
|
|
@@ -201,15 +201,15 @@ interface SensitiveFlowMountApi {
|
|
|
201
201
|
bridge: WebViewBridge;
|
|
202
202
|
cancel: () => void;
|
|
203
203
|
}
|
|
204
|
-
interface
|
|
204
|
+
interface MoonXContextValue {
|
|
205
205
|
sdk: RNAuthSDK;
|
|
206
206
|
_bridge: WebViewBridge;
|
|
207
207
|
_relyingPartyOrigin: RelyingPartyOriginInput;
|
|
208
208
|
_runSensitiveFlow: (options: SensitiveFlowOptions) => Promise<void>;
|
|
209
209
|
_oauthRedirectUri?: string;
|
|
210
210
|
}
|
|
211
|
-
declare const
|
|
212
|
-
declare const
|
|
211
|
+
declare const MoonXProvider: React.FC<MoonXProviderProps>;
|
|
212
|
+
declare const useMoonXContext: () => MoonXContextValue;
|
|
213
213
|
|
|
214
214
|
type State$1 = {
|
|
215
215
|
status: "idle";
|
|
@@ -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
|
-
* `
|
|
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
|
|
284
|
+
declare const useMoonX: () => RNAuthSDK;
|
|
285
285
|
|
|
286
|
-
export { type
|
|
286
|
+
export { type MoonXConfig, MoonXProvider, type MoonXProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonX, useMoonXContext };
|
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
|
|
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
|
|
170
|
+
interface MoonXProviderProps {
|
|
171
171
|
publishableKey: string;
|
|
172
|
-
config?:
|
|
172
|
+
config?: MoonXConfig;
|
|
173
173
|
children: ReactNode;
|
|
174
174
|
}
|
|
175
175
|
interface SensitiveFlowOptions {
|
|
@@ -201,15 +201,15 @@ interface SensitiveFlowMountApi {
|
|
|
201
201
|
bridge: WebViewBridge;
|
|
202
202
|
cancel: () => void;
|
|
203
203
|
}
|
|
204
|
-
interface
|
|
204
|
+
interface MoonXContextValue {
|
|
205
205
|
sdk: RNAuthSDK;
|
|
206
206
|
_bridge: WebViewBridge;
|
|
207
207
|
_relyingPartyOrigin: RelyingPartyOriginInput;
|
|
208
208
|
_runSensitiveFlow: (options: SensitiveFlowOptions) => Promise<void>;
|
|
209
209
|
_oauthRedirectUri?: string;
|
|
210
210
|
}
|
|
211
|
-
declare const
|
|
212
|
-
declare const
|
|
211
|
+
declare const MoonXProvider: React.FC<MoonXProviderProps>;
|
|
212
|
+
declare const useMoonXContext: () => MoonXContextValue;
|
|
213
213
|
|
|
214
214
|
type State$1 = {
|
|
215
215
|
status: "idle";
|
|
@@ -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
|
-
* `
|
|
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
|
|
284
|
+
declare const useMoonX: () => RNAuthSDK;
|
|
285
285
|
|
|
286
|
-
export { type
|
|
286
|
+
export { type MoonXConfig, MoonXProvider, type MoonXProviderProps, type RNAuthSDK, useAttachOAuth, useDetachOAuth, useExportKey, useLoginWithOAuth, useMoonX, useMoonXContext };
|
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
|
-
|
|
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
|
-
|
|
47
|
-
|
|
46
|
+
useMoonX: () => useMoonX,
|
|
47
|
+
useMoonXContext: () => useMoonXContext,
|
|
48
48
|
usePasskeyStatus: () => import_react5.usePasskeyStatus,
|
|
49
49
|
useRegisterPasskey: () => import_react5.useRegisterPasskey,
|
|
50
50
|
useRemovePasskey: () => import_react5.useRemovePasskey,
|
|
@@ -75,7 +75,7 @@ var import_sdk2 = require("@moon-x/core/sdk");
|
|
|
75
75
|
|
|
76
76
|
// src/platform/async-storage-kv.ts
|
|
77
77
|
var import_async_storage = __toESM(require("@react-native-async-storage/async-storage"));
|
|
78
|
-
var createAsyncStorageKv = (prefix = "
|
|
78
|
+
var createAsyncStorageKv = (prefix = "moonx:") => ({
|
|
79
79
|
get: async (key) => import_async_storage.default.getItem(prefix + key),
|
|
80
80
|
set: async (key, value) => import_async_storage.default.setItem(prefix + key, value),
|
|
81
81
|
remove: async (key) => import_async_storage.default.removeItem(prefix + key)
|
|
@@ -581,8 +581,8 @@ var WebViewBridge = class {
|
|
|
581
581
|
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
|
-
var
|
|
585
|
-
var
|
|
584
|
+
var MoonXContext = (0, import_react.createContext)(null);
|
|
585
|
+
var MoonXProvider = ({
|
|
586
586
|
publishableKey,
|
|
587
587
|
config,
|
|
588
588
|
children
|
|
@@ -788,7 +788,7 @@ var MoonKeyProvider = ({
|
|
|
788
788
|
]
|
|
789
789
|
);
|
|
790
790
|
const closeLabel = config?.sensitiveModalCopy?.closeLabel ?? "Done";
|
|
791
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoonXContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react2.SDKProvider, { value: sdk, children: [
|
|
792
792
|
children,
|
|
793
793
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
794
794
|
import_react_native.Animated.View,
|
|
@@ -850,10 +850,10 @@ var MoonKeyProvider = ({
|
|
|
850
850
|
)
|
|
851
851
|
] }) });
|
|
852
852
|
};
|
|
853
|
-
var
|
|
854
|
-
const ctx = (0, import_react.useContext)(
|
|
853
|
+
var useMoonXContext = () => {
|
|
854
|
+
const ctx = (0, import_react.useContext)(MoonXContext);
|
|
855
855
|
if (!ctx) {
|
|
856
|
-
throw new Error("
|
|
856
|
+
throw new Error("useMoonX must be used within a MoonXProvider");
|
|
857
857
|
}
|
|
858
858
|
return ctx;
|
|
859
859
|
};
|
|
@@ -973,7 +973,7 @@ var parseOAuthRedirect = async (redirectUrl) => {
|
|
|
973
973
|
|
|
974
974
|
// src/hooks/use-attach-oauth.ts
|
|
975
975
|
var useAttachOAuth = (params) => {
|
|
976
|
-
const { sdk, _bridge, _oauthRedirectUri } =
|
|
976
|
+
const { sdk, _bridge, _oauthRedirectUri } = useMoonXContext();
|
|
977
977
|
const [state, setState] = (0, import_react3.useState)({ status: "idle" });
|
|
978
978
|
return {
|
|
979
979
|
state,
|
|
@@ -1028,7 +1028,7 @@ var useAttachOAuth = (params) => {
|
|
|
1028
1028
|
// src/hooks/use-detach-oauth.ts
|
|
1029
1029
|
var import_utils6 = require("@moon-x/core/utils");
|
|
1030
1030
|
var useDetachOAuth = () => {
|
|
1031
|
-
const { sdk, _bridge } =
|
|
1031
|
+
const { sdk, _bridge } = useMoonXContext();
|
|
1032
1032
|
return {
|
|
1033
1033
|
detachOAuth: async (idpUserId) => {
|
|
1034
1034
|
await _bridge.send(
|
|
@@ -1043,7 +1043,7 @@ var useDetachOAuth = () => {
|
|
|
1043
1043
|
// src/hooks/use-export-key.ts
|
|
1044
1044
|
var import_sdk6 = require("@moon-x/core/sdk");
|
|
1045
1045
|
var useExportKey = () => {
|
|
1046
|
-
const { sdk, _bridge, _relyingPartyOrigin, _runSensitiveFlow } =
|
|
1046
|
+
const { sdk, _bridge, _relyingPartyOrigin, _runSensitiveFlow } = useMoonXContext();
|
|
1047
1047
|
return {
|
|
1048
1048
|
exportKey: async (wallet) => {
|
|
1049
1049
|
const { userHandleB64url, credentialIdB64url, tokens } = await (0, import_sdk6.getInternalPresenceTokens)({
|
|
@@ -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
|
|
@@ -1079,7 +1081,7 @@ var useExportKey = () => {
|
|
|
1079
1081
|
var import_utils7 = require("@moon-x/core/utils");
|
|
1080
1082
|
var import_react4 = require("react");
|
|
1081
1083
|
var useLoginWithOAuth = (params) => {
|
|
1082
|
-
const { sdk, _bridge, _oauthRedirectUri } =
|
|
1084
|
+
const { sdk, _bridge, _oauthRedirectUri } = useMoonXContext();
|
|
1083
1085
|
const [state, setState] = (0, import_react4.useState)({ status: "idle" });
|
|
1084
1086
|
return {
|
|
1085
1087
|
state,
|
|
@@ -1130,14 +1132,14 @@ var useLoginWithOAuth = (params) => {
|
|
|
1130
1132
|
};
|
|
1131
1133
|
};
|
|
1132
1134
|
|
|
1133
|
-
// src/hooks/use-
|
|
1134
|
-
var
|
|
1135
|
+
// src/hooks/use-moonx.ts
|
|
1136
|
+
var useMoonX = () => useMoonXContext().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
|
-
|
|
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
|
-
|
|
1154
|
-
|
|
1155
|
+
useMoonX,
|
|
1156
|
+
useMoonXContext,
|
|
1155
1157
|
usePasskeyStatus,
|
|
1156
1158
|
useRegisterPasskey,
|
|
1157
1159
|
useRemovePasskey,
|
package/dist/index.mjs
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
|
|
39
39
|
// src/platform/async-storage-kv.ts
|
|
40
40
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
41
|
-
var createAsyncStorageKv = (prefix = "
|
|
41
|
+
var createAsyncStorageKv = (prefix = "moonx:") => ({
|
|
42
42
|
get: async (key) => AsyncStorage.getItem(prefix + key),
|
|
43
43
|
set: async (key, value) => AsyncStorage.setItem(prefix + key, value),
|
|
44
44
|
remove: async (key) => AsyncStorage.removeItem(prefix + key)
|
|
@@ -555,8 +555,8 @@ var WebViewBridge = class {
|
|
|
555
555
|
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
|
-
var
|
|
559
|
-
var
|
|
558
|
+
var MoonXContext = createContext(null);
|
|
559
|
+
var MoonXProvider = ({
|
|
560
560
|
publishableKey,
|
|
561
561
|
config,
|
|
562
562
|
children
|
|
@@ -762,7 +762,7 @@ var MoonKeyProvider = ({
|
|
|
762
762
|
]
|
|
763
763
|
);
|
|
764
764
|
const closeLabel = config?.sensitiveModalCopy?.closeLabel ?? "Done";
|
|
765
|
-
return /* @__PURE__ */ jsx(
|
|
765
|
+
return /* @__PURE__ */ jsx(MoonXContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(SDKProvider, { value: sdk, children: [
|
|
766
766
|
children,
|
|
767
767
|
/* @__PURE__ */ jsx(
|
|
768
768
|
Animated.View,
|
|
@@ -824,10 +824,10 @@ var MoonKeyProvider = ({
|
|
|
824
824
|
)
|
|
825
825
|
] }) });
|
|
826
826
|
};
|
|
827
|
-
var
|
|
828
|
-
const ctx = useContext(
|
|
827
|
+
var useMoonXContext = () => {
|
|
828
|
+
const ctx = useContext(MoonXContext);
|
|
829
829
|
if (!ctx) {
|
|
830
|
-
throw new Error("
|
|
830
|
+
throw new Error("useMoonX must be used within a MoonXProvider");
|
|
831
831
|
}
|
|
832
832
|
return ctx;
|
|
833
833
|
};
|
|
@@ -959,7 +959,7 @@ var parseOAuthRedirect = async (redirectUrl) => {
|
|
|
959
959
|
|
|
960
960
|
// src/hooks/use-attach-oauth.ts
|
|
961
961
|
var useAttachOAuth = (params) => {
|
|
962
|
-
const { sdk, _bridge, _oauthRedirectUri } =
|
|
962
|
+
const { sdk, _bridge, _oauthRedirectUri } = useMoonXContext();
|
|
963
963
|
const [state, setState] = useState2({ status: "idle" });
|
|
964
964
|
return {
|
|
965
965
|
state,
|
|
@@ -1014,7 +1014,7 @@ var useAttachOAuth = (params) => {
|
|
|
1014
1014
|
// src/hooks/use-detach-oauth.ts
|
|
1015
1015
|
import { PostMessageMethod as PostMessageMethod5, PostMessageType as PostMessageType5 } from "@moon-x/core/utils";
|
|
1016
1016
|
var useDetachOAuth = () => {
|
|
1017
|
-
const { sdk, _bridge } =
|
|
1017
|
+
const { sdk, _bridge } = useMoonXContext();
|
|
1018
1018
|
return {
|
|
1019
1019
|
detachOAuth: async (idpUserId) => {
|
|
1020
1020
|
await _bridge.send(
|
|
@@ -1029,7 +1029,7 @@ var useDetachOAuth = () => {
|
|
|
1029
1029
|
// src/hooks/use-export-key.ts
|
|
1030
1030
|
import { getInternalPresenceTokens as getInternalPresenceTokens2, SCOPES_EXPORT_KEY } from "@moon-x/core/sdk";
|
|
1031
1031
|
var useExportKey = () => {
|
|
1032
|
-
const { sdk, _bridge, _relyingPartyOrigin, _runSensitiveFlow } =
|
|
1032
|
+
const { sdk, _bridge, _relyingPartyOrigin, _runSensitiveFlow } = useMoonXContext();
|
|
1033
1033
|
return {
|
|
1034
1034
|
exportKey: async (wallet) => {
|
|
1035
1035
|
const { userHandleB64url, credentialIdB64url, tokens } = await getInternalPresenceTokens2({
|
|
@@ -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
|
|
@@ -1065,7 +1067,7 @@ var useExportKey = () => {
|
|
|
1065
1067
|
import { PostMessageMethod as PostMessageMethod6, PostMessageType as PostMessageType6 } from "@moon-x/core/utils";
|
|
1066
1068
|
import { useState as useState3 } from "react";
|
|
1067
1069
|
var useLoginWithOAuth = (params) => {
|
|
1068
|
-
const { sdk, _bridge, _oauthRedirectUri } =
|
|
1070
|
+
const { sdk, _bridge, _oauthRedirectUri } = useMoonXContext();
|
|
1069
1071
|
const [state, setState] = useState3({ status: "idle" });
|
|
1070
1072
|
return {
|
|
1071
1073
|
state,
|
|
@@ -1116,13 +1118,13 @@ var useLoginWithOAuth = (params) => {
|
|
|
1116
1118
|
};
|
|
1117
1119
|
};
|
|
1118
1120
|
|
|
1119
|
-
// src/hooks/use-
|
|
1120
|
-
var
|
|
1121
|
+
// src/hooks/use-moonx.ts
|
|
1122
|
+
var useMoonX = () => useMoonXContext().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
|
-
|
|
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
|
-
|
|
1139
|
-
|
|
1140
|
+
useMoonX,
|
|
1141
|
+
useMoonXContext,
|
|
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.
|
|
3
|
+
"version": "0.11.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.
|
|
52
|
+
"@moon-x/core": "0.13.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@expo/config-plugins": ">=10.0.0",
|
package/plugin/index.js
CHANGED
|
@@ -156,7 +156,7 @@ const withOAuthIntentFilter = (config, oauthRedirectScheme) => {
|
|
|
156
156
|
});
|
|
157
157
|
};
|
|
158
158
|
|
|
159
|
-
const
|
|
159
|
+
const withMoonX = (config, props = {}) => {
|
|
160
160
|
let next = config;
|
|
161
161
|
next = withAssociatedDomains(
|
|
162
162
|
next,
|
|
@@ -169,4 +169,4 @@ const withMoonKey = (config, props = {}) => {
|
|
|
169
169
|
return next;
|
|
170
170
|
};
|
|
171
171
|
|
|
172
|
-
module.exports =
|
|
172
|
+
module.exports = withMoonX;
|