@moon-x/react-native-sdk 0.18.0 → 0.19.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 +25 -0
- package/dist/bitcoin.d.mts +1 -0
- package/dist/bitcoin.d.ts +1 -0
- package/dist/bitcoin.js +38 -0
- package/dist/bitcoin.mjs +15 -0
- package/dist/ethereum.js +7 -4
- package/dist/ethereum.mjs +11 -1
- package/dist/index.d.mts +20 -11
- package/dist/index.d.ts +20 -11
- package/dist/index.js +146 -20
- package/dist/index.mjs +146 -14
- package/dist/solana.js +7 -4
- package/dist/solana.mjs +11 -1
- package/dist/tron.js +7 -4
- package/dist/tron.mjs +11 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -275,6 +275,31 @@ const ethereumWallet = await importEthereum(privateKey);
|
|
|
275
275
|
await exportEthereum({ wallet: ethereumWallet });
|
|
276
276
|
```
|
|
277
277
|
|
|
278
|
+
### Identity-backed encryption
|
|
279
|
+
|
|
280
|
+
`useMoonX()` exposes `enableAccountRecovery()` and `disableAccountRecovery()`.
|
|
281
|
+
|
|
282
|
+
| State | `enableAccountRecovery()` |
|
|
283
|
+
|---|---|
|
|
284
|
+
| No DEK | Creates the identity-backed wrap using the signed-in session. No passkey prompt or OTP. |
|
|
285
|
+
| Usable identity-backed wrap exists | Resolves without another ceremony. |
|
|
286
|
+
| Existing passkey-protected DEK | Uses a native passkey assertion to add the identity-backed wrap. |
|
|
287
|
+
| App configuration is unavailable | Rejects with `account_recovery_unavailable`. |
|
|
288
|
+
|
|
289
|
+
The host app owns the disclosure before adding identity-backed access to an existing wallet. RN does not show the web SDK consent modal. `disableAccountRecovery()` requires a passkey assertion because it removes the identity-backed access path.
|
|
290
|
+
|
|
291
|
+
Both methods use the configured `relyingPartyOrigin` when they need a passkey assertion. Session-only setup does not require that origin.
|
|
292
|
+
|
|
293
|
+
#### Add a passkey after identity-backed setup
|
|
294
|
+
|
|
295
|
+
`registerPasskey()` and `addPasskey()` can add the first passkey to an existing identity-backed wallet. This upgrade requires email OTP presence before native registration. The SDK then stores a passkey wrap for the existing DEK. It does not replace the DEK or create another wallet.
|
|
296
|
+
|
|
297
|
+
Register the host app OTP UI with `registerPresenceOtpCodeProvider`, exported from `@moon-x/react-native-sdk`. The provider receives a `PresenceOtpCodeRequest` and returns a promise for the entered code. Reject the promise when the user cancels. Call the returned cleanup function when the provider is no longer needed.
|
|
298
|
+
|
|
299
|
+
The OTP path requires a verified email address. Initial identity-backed setup and eligible ephemeral-signer actions do not require this OTP provider. `registerPasskey({ createWallets: ... })` rejects a KMS-only upgrade with `register_create_unavailable_for_kms_upgrade`.
|
|
300
|
+
|
|
301
|
+
If a previous attempt registered a passkey but failed to store its wrap, the SDK can repair that wrap using the existing credential.
|
|
302
|
+
|
|
278
303
|
### Ephemeral signer list status
|
|
279
304
|
|
|
280
305
|
`useEphemeralSigner().signers` includes non-revoked signers with status `active`,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useGetBalance, useGetUtxos, useSendTransaction, useSignMessage, useSignTransaction } from '@moon-x/core/react/bitcoin';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useGetBalance, useGetUtxos, useSendTransaction, useSignMessage, useSignTransaction } from '@moon-x/core/react/bitcoin';
|
package/dist/bitcoin.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/bitcoin.ts
|
|
21
|
+
var bitcoin_exports = {};
|
|
22
|
+
__export(bitcoin_exports, {
|
|
23
|
+
useGetBalance: () => import_bitcoin.useGetBalance,
|
|
24
|
+
useGetUtxos: () => import_bitcoin.useGetUtxos,
|
|
25
|
+
useSendTransaction: () => import_bitcoin.useSendTransaction,
|
|
26
|
+
useSignMessage: () => import_bitcoin.useSignMessage,
|
|
27
|
+
useSignTransaction: () => import_bitcoin.useSignTransaction
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(bitcoin_exports);
|
|
30
|
+
var import_bitcoin = require("@moon-x/core/react/bitcoin");
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
useGetBalance,
|
|
34
|
+
useGetUtxos,
|
|
35
|
+
useSendTransaction,
|
|
36
|
+
useSignMessage,
|
|
37
|
+
useSignTransaction
|
|
38
|
+
});
|
package/dist/bitcoin.mjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// src/bitcoin.ts
|
|
2
|
+
import {
|
|
3
|
+
useGetBalance,
|
|
4
|
+
useGetUtxos,
|
|
5
|
+
useSendTransaction,
|
|
6
|
+
useSignMessage,
|
|
7
|
+
useSignTransaction
|
|
8
|
+
} from "@moon-x/core/react/bitcoin";
|
|
9
|
+
export {
|
|
10
|
+
useGetBalance,
|
|
11
|
+
useGetUtxos,
|
|
12
|
+
useSendTransaction,
|
|
13
|
+
useSignMessage,
|
|
14
|
+
useSignTransaction
|
|
15
|
+
};
|
package/dist/ethereum.js
CHANGED
|
@@ -47,7 +47,7 @@ module.exports = __toCommonJS(ethereum_exports);
|
|
|
47
47
|
var import_ethereum = require("@moon-x/core/react/ethereum");
|
|
48
48
|
|
|
49
49
|
// src/hooks/use-export-key.ts
|
|
50
|
-
var
|
|
50
|
+
var import_sdk9 = require("@moon-x/core/sdk");
|
|
51
51
|
var import_utils5 = require("@moon-x/core/utils");
|
|
52
52
|
|
|
53
53
|
// src/provider.tsx
|
|
@@ -154,9 +154,12 @@ var import_sdk5 = require("@moon-x/core/sdk");
|
|
|
154
154
|
// src/sdk/sdk-solana-methods.ts
|
|
155
155
|
var import_sdk6 = require("@moon-x/core/sdk");
|
|
156
156
|
|
|
157
|
-
// src/sdk/sdk-
|
|
157
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
158
158
|
var import_sdk7 = require("@moon-x/core/sdk");
|
|
159
159
|
|
|
160
|
+
// src/sdk/sdk-tron-methods.ts
|
|
161
|
+
var import_sdk8 = require("@moon-x/core/sdk");
|
|
162
|
+
|
|
160
163
|
// src/provider.tsx
|
|
161
164
|
var import_utils4 = require("@moon-x/core/utils");
|
|
162
165
|
|
|
@@ -265,12 +268,12 @@ var useExportKey = () => {
|
|
|
265
268
|
return {
|
|
266
269
|
exportKey: async (wallet) => {
|
|
267
270
|
try {
|
|
268
|
-
const { userHandleB64url, credentialIdB64url, tokens } = await (0,
|
|
271
|
+
const { userHandleB64url, credentialIdB64url, tokens } = await (0, import_sdk9.getInternalPresenceTokens)({
|
|
269
272
|
transport: _bridge,
|
|
270
273
|
passkey: createRNPasskey(),
|
|
271
274
|
publishableKey: sdk.publishableKey,
|
|
272
275
|
relyingPartyOrigin: _relyingPartyOrigin,
|
|
273
|
-
scopes:
|
|
276
|
+
scopes: import_sdk9.SCOPES_EXPORT_KEY
|
|
274
277
|
});
|
|
275
278
|
const keyshareReadToken = tokens.keyshare_read?.token ?? "";
|
|
276
279
|
const params = new URLSearchParams({
|
package/dist/ethereum.mjs
CHANGED
|
@@ -135,11 +135,16 @@ import {
|
|
|
135
135
|
flattenPresenceTokens,
|
|
136
136
|
getInternalPresenceTokens,
|
|
137
137
|
getPresenceToken,
|
|
138
|
+
resolveRelyingPartyOrigin,
|
|
138
139
|
scopeCountsForRegisterCreate,
|
|
139
140
|
SCOPES_ADD_PASSKEY,
|
|
140
141
|
validateRegisterCreateWallets
|
|
141
142
|
} from "@moon-x/core/sdk";
|
|
142
|
-
import {
|
|
143
|
+
import {
|
|
144
|
+
kmsWrapConfigUsable,
|
|
145
|
+
PostMessageMethod,
|
|
146
|
+
PostMessageType
|
|
147
|
+
} from "@moon-x/core/utils";
|
|
143
148
|
import { create as passkeyCreate } from "react-native-passkeys";
|
|
144
149
|
|
|
145
150
|
// src/sdk/sdk-methods.ts
|
|
@@ -152,6 +157,11 @@ import {
|
|
|
152
157
|
getHeadlessSolanaMethods
|
|
153
158
|
} from "@moon-x/core/sdk";
|
|
154
159
|
|
|
160
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
161
|
+
import {
|
|
162
|
+
getHeadlessBitcoinMethods
|
|
163
|
+
} from "@moon-x/core/sdk";
|
|
164
|
+
|
|
155
165
|
// src/sdk/sdk-tron-methods.ts
|
|
156
166
|
import {
|
|
157
167
|
getHeadlessTronMethods
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { LoginWithMoonPayCustomerTokenResult, BulkImportFailure, RegisterCreateWalletSpec, RegisterCreatedWallet, RelyingPartyOriginInput } from '@moon-x/core/sdk';
|
|
3
|
-
export { LoginWithMoonPayCustomerTokenResult, MOONPAY_CONSUMER_SESSION_ERROR_CODES, MoonPayConsumerSessionError, MoonPayConsumerSessionErrorCode, RegisterCreateWalletSpec, RegisterCreatedWallet } from '@moon-x/core/sdk';
|
|
2
|
+
import { LoginWithMoonPayCustomerTokenResult, BulkImportKeySpec, BulkImportFailure, RegisterCreateWalletSpec, RegisterCreatedWallet, RelyingPartyOriginInput } from '@moon-x/core/sdk';
|
|
3
|
+
export { LoginWithMoonPayCustomerTokenResult, MOONPAY_CONSUMER_SESSION_ERROR_CODES, MoonPayConsumerSessionError, MoonPayConsumerSessionErrorCode, PresenceOtpCodeProvider, PresenceOtpCodeRequest, RegisterCreateWalletSpec, RegisterCreatedWallet, registerPresenceOtpCodeProvider } from '@moon-x/core/sdk';
|
|
4
4
|
import { PostMessageType, PostMessageMethod } from '@moon-x/core/utils';
|
|
5
5
|
export { PostMessageMethod, PostMessageType } from '@moon-x/core/utils';
|
|
6
6
|
import * as _moon_x_core_types from '@moon-x/core/types';
|
|
7
|
-
import { PublicWallet, WalletImportSource, PrepareFundingParams, FundingSession, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronSendTransactionParams, TronSendTransactionResult, TronGetBalanceParams, TronGetBalanceResult, AppConfigResponse } from '@moon-x/core/types';
|
|
8
|
-
export { Chain, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, FundingSession, ListEphemeralSignersResult, Network, PrepareFundingParams, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicWallet, RevokeEphemeralSignerParams, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, TronGetBalanceParams, TronGetBalanceResult, TronSendTransactionParams, TronSendTransactionResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronTransactionJson, WalletConnectConfig } from '@moon-x/core/types';
|
|
7
|
+
import { PublicWallet, WalletImportSource, PrepareFundingParams, FundingSession, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronSendTransactionParams, TronSendTransactionResult, TronGetBalanceParams, TronGetBalanceResult, BitcoinSignMessageParams, BitcoinSignMessageResult, BitcoinSignTransactionParams, BitcoinSignTransactionResult, BitcoinSendTransactionParams, BitcoinSendTransactionResult, BitcoinGetBalanceParams, BitcoinGetBalanceResult, BitcoinGetUtxosParams, BitcoinGetUtxosResult, AppConfigResponse } from '@moon-x/core/types';
|
|
8
|
+
export { BitcoinGetBalanceParams, BitcoinGetBalanceResult, BitcoinGetUtxosParams, BitcoinGetUtxosResult, BitcoinSendTransactionParams, BitcoinSendTransactionResult, BitcoinSignMessageParams, BitcoinSignMessageResult, BitcoinSignTransactionParams, BitcoinSignTransactionResult, BitcoinTransactionPreview, BitcoinUtxo, Chain, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, FundingSession, ListEphemeralSignersResult, Network, PrepareFundingParams, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicWallet, RevokeEphemeralSignerParams, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, TronGetBalanceParams, TronGetBalanceResult, TronSendTransactionParams, TronSendTransactionResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronTransactionJson, WalletConnectConfig } from '@moon-x/core/types';
|
|
9
9
|
import * as _moon_x_core_react from '@moon-x/core/react';
|
|
10
10
|
import { UseLoginWithEmailCallbacks } from '@moon-x/core/react';
|
|
11
11
|
export { LinkEmailResult, LinkEmailState, LoginWithEmailState, UseEphemeralSignerResult, UseLinkEmailCallbacks, UseLoginWithEmailCallbacks, useAddPasskey, useBulkImport, useCreateWallet, useEphemeralSigner, useImportKey, useLinkEmail, useLogout, usePasskeyStatus, useRegisterPasskey, useRemovePasskey, useUser, useWallets } from '@moon-x/core/react';
|
|
@@ -111,23 +111,23 @@ interface RNAuthSDK {
|
|
|
111
111
|
success: boolean;
|
|
112
112
|
message: string;
|
|
113
113
|
}>;
|
|
114
|
-
createWallet: (walletType: "solana" | "ethereum" | "tron", options?: {
|
|
114
|
+
createWallet: (walletType: "solana" | "ethereum" | "tron" | "bitcoin", options?: {
|
|
115
115
|
createAdditional?: boolean;
|
|
116
116
|
walletIndex?: number;
|
|
117
|
+
addressType?: "p2tr" | "p2wpkh" | "p2pkh";
|
|
117
118
|
}) => Promise<{
|
|
118
119
|
wallet: PublicWallet;
|
|
119
120
|
}>;
|
|
120
|
-
importKey: (walletType: "solana" | "ethereum" | "tron", source: string | WalletImportSource
|
|
121
|
+
importKey: (walletType: "solana" | "ethereum" | "tron" | "bitcoin", source: string | WalletImportSource, options?: {
|
|
122
|
+
addressType?: "p2tr" | "p2wpkh" | "p2pkh";
|
|
123
|
+
}) => Promise<{
|
|
121
124
|
wallet: PublicWallet;
|
|
122
125
|
}>;
|
|
123
|
-
bulkImport: (keys:
|
|
124
|
-
chain: "solana" | "ethereum" | "tron";
|
|
125
|
-
source: string | WalletImportSource;
|
|
126
|
-
}>) => Promise<{
|
|
126
|
+
bulkImport: (keys: BulkImportKeySpec[]) => Promise<{
|
|
127
127
|
wallets: PublicWallet[];
|
|
128
128
|
failures: BulkImportFailure[];
|
|
129
129
|
}>;
|
|
130
|
-
getWallets: (walletType: "solana" | "ethereum" | "tron") => Promise<{
|
|
130
|
+
getWallets: (walletType: "solana" | "ethereum" | "tron" | "bitcoin") => Promise<{
|
|
131
131
|
wallets: any[];
|
|
132
132
|
walletType: string;
|
|
133
133
|
}>;
|
|
@@ -163,6 +163,10 @@ interface RNAuthSDK {
|
|
|
163
163
|
credential_id: string;
|
|
164
164
|
passkey_registered: true;
|
|
165
165
|
}>;
|
|
166
|
+
enableAccountRecovery: () => Promise<{
|
|
167
|
+
enabled: true;
|
|
168
|
+
}>;
|
|
169
|
+
disableAccountRecovery: () => Promise<void>;
|
|
166
170
|
prepareFunding: (params: PrepareFundingParams) => Promise<FundingSession>;
|
|
167
171
|
signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
|
|
168
172
|
signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
|
|
@@ -180,6 +184,11 @@ interface RNAuthSDK {
|
|
|
180
184
|
signTronTransactionHeadless: (params: TronSignTransactionParams) => Promise<TronSignTransactionResult>;
|
|
181
185
|
sendTronTransactionHeadless: (params: TronSendTransactionParams) => Promise<TronSendTransactionResult>;
|
|
182
186
|
getTronBalance: (params: TronGetBalanceParams) => Promise<TronGetBalanceResult>;
|
|
187
|
+
signBitcoinMessageHeadless: (params: BitcoinSignMessageParams) => Promise<BitcoinSignMessageResult>;
|
|
188
|
+
signBitcoinTransactionHeadless: (params: BitcoinSignTransactionParams) => Promise<BitcoinSignTransactionResult>;
|
|
189
|
+
sendBitcoinTransactionHeadless: (params: BitcoinSendTransactionParams) => Promise<BitcoinSendTransactionResult>;
|
|
190
|
+
getBitcoinBalance: (params: BitcoinGetBalanceParams) => Promise<BitcoinGetBalanceResult>;
|
|
191
|
+
getBitcoinUtxos: (params: BitcoinGetUtxosParams) => Promise<BitcoinGetUtxosResult>;
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
interface MoonXConfig {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
|
-
import { LoginWithMoonPayCustomerTokenResult, BulkImportFailure, RegisterCreateWalletSpec, RegisterCreatedWallet, RelyingPartyOriginInput } from '@moon-x/core/sdk';
|
|
3
|
-
export { LoginWithMoonPayCustomerTokenResult, MOONPAY_CONSUMER_SESSION_ERROR_CODES, MoonPayConsumerSessionError, MoonPayConsumerSessionErrorCode, RegisterCreateWalletSpec, RegisterCreatedWallet } from '@moon-x/core/sdk';
|
|
2
|
+
import { LoginWithMoonPayCustomerTokenResult, BulkImportKeySpec, BulkImportFailure, RegisterCreateWalletSpec, RegisterCreatedWallet, RelyingPartyOriginInput } from '@moon-x/core/sdk';
|
|
3
|
+
export { LoginWithMoonPayCustomerTokenResult, MOONPAY_CONSUMER_SESSION_ERROR_CODES, MoonPayConsumerSessionError, MoonPayConsumerSessionErrorCode, PresenceOtpCodeProvider, PresenceOtpCodeRequest, RegisterCreateWalletSpec, RegisterCreatedWallet, registerPresenceOtpCodeProvider } from '@moon-x/core/sdk';
|
|
4
4
|
import { PostMessageType, PostMessageMethod } from '@moon-x/core/utils';
|
|
5
5
|
export { PostMessageMethod, PostMessageType } from '@moon-x/core/utils';
|
|
6
6
|
import * as _moon_x_core_types from '@moon-x/core/types';
|
|
7
|
-
import { PublicWallet, WalletImportSource, PrepareFundingParams, FundingSession, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronSendTransactionParams, TronSendTransactionResult, TronGetBalanceParams, TronGetBalanceResult, AppConfigResponse } from '@moon-x/core/types';
|
|
8
|
-
export { Chain, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, FundingSession, ListEphemeralSignersResult, Network, PrepareFundingParams, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicWallet, RevokeEphemeralSignerParams, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, TronGetBalanceParams, TronGetBalanceResult, TronSendTransactionParams, TronSendTransactionResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronTransactionJson, WalletConnectConfig } from '@moon-x/core/types';
|
|
7
|
+
import { PublicWallet, WalletImportSource, PrepareFundingParams, FundingSession, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumGetBalanceParams, EthereumGetBalanceResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronSendTransactionParams, TronSendTransactionResult, TronGetBalanceParams, TronGetBalanceResult, BitcoinSignMessageParams, BitcoinSignMessageResult, BitcoinSignTransactionParams, BitcoinSignTransactionResult, BitcoinSendTransactionParams, BitcoinSendTransactionResult, BitcoinGetBalanceParams, BitcoinGetBalanceResult, BitcoinGetUtxosParams, BitcoinGetUtxosResult, AppConfigResponse } from '@moon-x/core/types';
|
|
8
|
+
export { BitcoinGetBalanceParams, BitcoinGetBalanceResult, BitcoinGetUtxosParams, BitcoinGetUtxosResult, BitcoinSendTransactionParams, BitcoinSendTransactionResult, BitcoinSignMessageParams, BitcoinSignMessageResult, BitcoinSignTransactionParams, BitcoinSignTransactionResult, BitcoinTransactionPreview, BitcoinUtxo, Chain, EphemeralSigner, EphemeralSignerChain, EphemeralSignerScheme, EphemeralSignerWallet, EthereumGetBalanceParams, EthereumGetBalanceResult, EthereumSendTransactionParams, EthereumSendTransactionResult, EthereumSign7702AuthorizationParams, EthereumSign7702AuthorizationResult, EthereumSignHashParams, EthereumSignHashResult, EthereumSignMessageParams, EthereumSignMessageResult, EthereumSignTransactionParams, EthereumSignTransactionResult, EthereumSignTypedDataParams, EthereumSignTypedDataResult, FundingSession, ListEphemeralSignersResult, Network, PrepareFundingParams, ProvisionEphemeralSignerParams, ProvisionEphemeralSignerResult, PublicWallet, RevokeEphemeralSignerParams, SolanaGetBalanceParams, SolanaGetBalanceResult, SolanaGetTokenAccountsByOwnerParams, SolanaGetTokenAccountsByOwnerResult, SolanaSendTransactionParams, SolanaSendTransactionResult, SolanaSignMessageParams, SolanaSignMessageResult, SolanaSignTransactionParams, SolanaSignTransactionResult, TronGetBalanceParams, TronGetBalanceResult, TronSendTransactionParams, TronSendTransactionResult, TronSignMessageParams, TronSignMessageResult, TronSignTransactionParams, TronSignTransactionResult, TronTransactionJson, WalletConnectConfig } from '@moon-x/core/types';
|
|
9
9
|
import * as _moon_x_core_react from '@moon-x/core/react';
|
|
10
10
|
import { UseLoginWithEmailCallbacks } from '@moon-x/core/react';
|
|
11
11
|
export { LinkEmailResult, LinkEmailState, LoginWithEmailState, UseEphemeralSignerResult, UseLinkEmailCallbacks, UseLoginWithEmailCallbacks, useAddPasskey, useBulkImport, useCreateWallet, useEphemeralSigner, useImportKey, useLinkEmail, useLogout, usePasskeyStatus, useRegisterPasskey, useRemovePasskey, useUser, useWallets } from '@moon-x/core/react';
|
|
@@ -111,23 +111,23 @@ interface RNAuthSDK {
|
|
|
111
111
|
success: boolean;
|
|
112
112
|
message: string;
|
|
113
113
|
}>;
|
|
114
|
-
createWallet: (walletType: "solana" | "ethereum" | "tron", options?: {
|
|
114
|
+
createWallet: (walletType: "solana" | "ethereum" | "tron" | "bitcoin", options?: {
|
|
115
115
|
createAdditional?: boolean;
|
|
116
116
|
walletIndex?: number;
|
|
117
|
+
addressType?: "p2tr" | "p2wpkh" | "p2pkh";
|
|
117
118
|
}) => Promise<{
|
|
118
119
|
wallet: PublicWallet;
|
|
119
120
|
}>;
|
|
120
|
-
importKey: (walletType: "solana" | "ethereum" | "tron", source: string | WalletImportSource
|
|
121
|
+
importKey: (walletType: "solana" | "ethereum" | "tron" | "bitcoin", source: string | WalletImportSource, options?: {
|
|
122
|
+
addressType?: "p2tr" | "p2wpkh" | "p2pkh";
|
|
123
|
+
}) => Promise<{
|
|
121
124
|
wallet: PublicWallet;
|
|
122
125
|
}>;
|
|
123
|
-
bulkImport: (keys:
|
|
124
|
-
chain: "solana" | "ethereum" | "tron";
|
|
125
|
-
source: string | WalletImportSource;
|
|
126
|
-
}>) => Promise<{
|
|
126
|
+
bulkImport: (keys: BulkImportKeySpec[]) => Promise<{
|
|
127
127
|
wallets: PublicWallet[];
|
|
128
128
|
failures: BulkImportFailure[];
|
|
129
129
|
}>;
|
|
130
|
-
getWallets: (walletType: "solana" | "ethereum" | "tron") => Promise<{
|
|
130
|
+
getWallets: (walletType: "solana" | "ethereum" | "tron" | "bitcoin") => Promise<{
|
|
131
131
|
wallets: any[];
|
|
132
132
|
walletType: string;
|
|
133
133
|
}>;
|
|
@@ -163,6 +163,10 @@ interface RNAuthSDK {
|
|
|
163
163
|
credential_id: string;
|
|
164
164
|
passkey_registered: true;
|
|
165
165
|
}>;
|
|
166
|
+
enableAccountRecovery: () => Promise<{
|
|
167
|
+
enabled: true;
|
|
168
|
+
}>;
|
|
169
|
+
disableAccountRecovery: () => Promise<void>;
|
|
166
170
|
prepareFunding: (params: PrepareFundingParams) => Promise<FundingSession>;
|
|
167
171
|
signEthereumMessageHeadless: (params: EthereumSignMessageParams) => Promise<EthereumSignMessageResult>;
|
|
168
172
|
signEthereumTransactionHeadless: (params: EthereumSignTransactionParams) => Promise<EthereumSignTransactionResult>;
|
|
@@ -180,6 +184,11 @@ interface RNAuthSDK {
|
|
|
180
184
|
signTronTransactionHeadless: (params: TronSignTransactionParams) => Promise<TronSignTransactionResult>;
|
|
181
185
|
sendTronTransactionHeadless: (params: TronSendTransactionParams) => Promise<TronSendTransactionResult>;
|
|
182
186
|
getTronBalance: (params: TronGetBalanceParams) => Promise<TronGetBalanceResult>;
|
|
187
|
+
signBitcoinMessageHeadless: (params: BitcoinSignMessageParams) => Promise<BitcoinSignMessageResult>;
|
|
188
|
+
signBitcoinTransactionHeadless: (params: BitcoinSignTransactionParams) => Promise<BitcoinSignTransactionResult>;
|
|
189
|
+
sendBitcoinTransactionHeadless: (params: BitcoinSendTransactionParams) => Promise<BitcoinSendTransactionResult>;
|
|
190
|
+
getBitcoinBalance: (params: BitcoinGetBalanceParams) => Promise<BitcoinGetBalanceResult>;
|
|
191
|
+
getBitcoinUtxos: (params: BitcoinGetUtxosParams) => Promise<BitcoinGetUtxosResult>;
|
|
183
192
|
}
|
|
184
193
|
|
|
185
194
|
interface MoonXConfig {
|
package/dist/index.js
CHANGED
|
@@ -30,13 +30,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
MOONPAY_CONSUMER_SESSION_ERROR_CODES: () =>
|
|
33
|
+
MOONPAY_CONSUMER_SESSION_ERROR_CODES: () => import_sdk10.MOONPAY_CONSUMER_SESSION_ERROR_CODES,
|
|
34
34
|
MoonKeyProvider: () => MoonXProvider,
|
|
35
35
|
MoonXProvider: () => MoonXProvider,
|
|
36
36
|
PostMessageMethod: () => import_utils10.PostMessageMethod,
|
|
37
37
|
PostMessageType: () => import_utils10.PostMessageType,
|
|
38
38
|
connectWalletConnect: () => connectWalletConnect,
|
|
39
39
|
listWalletConnectSessions: () => listWalletConnectSessions,
|
|
40
|
+
registerPresenceOtpCodeProvider: () => import_sdk11.registerPresenceOtpCodeProvider,
|
|
40
41
|
restoreWalletConnectSession: () => restoreWalletConnectSession,
|
|
41
42
|
useAddPasskey: () => import_react8.useAddPasskey,
|
|
42
43
|
useAppConfig: () => useAppConfig,
|
|
@@ -196,7 +197,26 @@ var import_lib = require("@moon-x/core/lib");
|
|
|
196
197
|
var import_sdk4 = require("@moon-x/core/sdk");
|
|
197
198
|
var import_utils = require("@moon-x/core/utils");
|
|
198
199
|
var import_react_native_passkeys2 = require("react-native-passkeys");
|
|
199
|
-
var
|
|
200
|
+
var selectAccountRecoveryRoute = ({
|
|
201
|
+
sdkSettings,
|
|
202
|
+
dekInfo
|
|
203
|
+
}) => {
|
|
204
|
+
if (!(0, import_utils.kmsWrapConfigUsable)(sdkSettings)) return "unavailable";
|
|
205
|
+
if (dekInfo.has_kms_wrap === true) return "already_wrapped";
|
|
206
|
+
if (dekInfo.has_dek !== true) return "bootstrap";
|
|
207
|
+
return "passkey_rewrap";
|
|
208
|
+
};
|
|
209
|
+
var isDekAlreadyExistsError = (error) => (error instanceof Error ? error.message : String(error)).includes(
|
|
210
|
+
"dek_already_exists"
|
|
211
|
+
);
|
|
212
|
+
var getPasskeyMethods = (bridge, publishableKey, configuredRelyingPartyOrigin) => {
|
|
213
|
+
const resolveOrigin = async (dekInfo) => {
|
|
214
|
+
if (configuredRelyingPartyOrigin) {
|
|
215
|
+
return (0, import_sdk4.resolveRelyingPartyOrigin)(configuredRelyingPartyOrigin);
|
|
216
|
+
}
|
|
217
|
+
if (!dekInfo.rp_id) throw new Error("webauthn_rp_id_not_configured");
|
|
218
|
+
return `https://${dekInfo.rp_id}`;
|
|
219
|
+
};
|
|
200
220
|
const enrollPasskey = async (params) => {
|
|
201
221
|
const requestedWallets = (0, import_sdk4.validateRegisterCreateWallets)(
|
|
202
222
|
params?.createWallets
|
|
@@ -206,13 +226,18 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
206
226
|
import_utils.PostMessageMethod.GET_DEK_INFO,
|
|
207
227
|
{ publishableKey }
|
|
208
228
|
);
|
|
209
|
-
|
|
210
|
-
|
|
229
|
+
const allowList = dekInfo.allow_credential_ids_b64url ?? [];
|
|
230
|
+
const hasPasskeyWrap = dekInfo.has_passkey_wrap ?? (dekInfo.passkey_wrap_credential_ids_b64url?.length ?? allowList.length) > 0;
|
|
231
|
+
const isKmsUpgrade = dekInfo.has_dek === true && !hasPasskeyWrap && dekInfo.has_kms_wrap === true && dekInfo.kms_wrap_enabled === true;
|
|
232
|
+
if (dekInfo.has_dek === true && !hasPasskeyWrap && !isKmsUpgrade) {
|
|
233
|
+
throw new Error("passkey_upgrade_unavailable");
|
|
211
234
|
}
|
|
212
|
-
const rpId = dekInfo.rp_id;
|
|
213
|
-
const relyingPartyOrigin = `https://${rpId}`;
|
|
214
|
-
const isAdditional = (dekInfo.allow_credential_ids_b64url ?? []).length > 0;
|
|
215
235
|
const wantsCreate = requestedWallets.length > 0;
|
|
236
|
+
if (isKmsUpgrade && wantsCreate) {
|
|
237
|
+
throw new Error("register_create_unavailable_for_kms_upgrade");
|
|
238
|
+
}
|
|
239
|
+
const isAdditional = dekInfo.has_dek === true || allowList.length > 0;
|
|
240
|
+
const relyingPartyOrigin = await resolveOrigin(dekInfo);
|
|
216
241
|
let unlock = null;
|
|
217
242
|
if (isAdditional) {
|
|
218
243
|
const result = await (0, import_sdk4.getInternalPresenceTokens)({
|
|
@@ -222,8 +247,7 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
222
247
|
relyingPartyOrigin,
|
|
223
248
|
scopes: import_sdk4.SCOPES_ADD_PASSKEY
|
|
224
249
|
});
|
|
225
|
-
|
|
226
|
-
if (!allowList.includes(result.credentialIdB64url)) {
|
|
250
|
+
if (result.credentialIdB64url && !allowList.includes(result.credentialIdB64url)) {
|
|
227
251
|
throw new Error("unknown_passkey_for_this_account");
|
|
228
252
|
}
|
|
229
253
|
unlock = {
|
|
@@ -231,6 +255,31 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
231
255
|
credentialIdB64url: result.credentialIdB64url,
|
|
232
256
|
presenceTokens: (0, import_sdk4.flattenPresenceTokens)(result)
|
|
233
257
|
};
|
|
258
|
+
if (!unlock.presenceTokens.passkey_enroll || !unlock.presenceTokens.wrap_add) {
|
|
259
|
+
throw new Error("missing_presence_tokens");
|
|
260
|
+
}
|
|
261
|
+
if (isKmsUpgrade && result.credentialIdB64url && (dekInfo.active_passkey_credential_ids_b64url ?? []).includes(
|
|
262
|
+
result.credentialIdB64url
|
|
263
|
+
) && !(dekInfo.passkey_wrap_credential_ids_b64url ?? []).includes(
|
|
264
|
+
result.credentialIdB64url
|
|
265
|
+
)) {
|
|
266
|
+
await bridge.send(
|
|
267
|
+
import_utils.PostMessageType.AUTH,
|
|
268
|
+
import_utils.PostMessageMethod.ADD_PASSKEY_WRAP,
|
|
269
|
+
{
|
|
270
|
+
publishableKey,
|
|
271
|
+
unlockUserHandleB64url: result.userHandleB64url,
|
|
272
|
+
unlockCredentialIdB64url: result.credentialIdB64url,
|
|
273
|
+
newUserHandleB64url: result.userHandleB64url,
|
|
274
|
+
newCredentialIdB64url: result.credentialIdB64url,
|
|
275
|
+
presenceTokens: unlock.presenceTokens
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
return {
|
|
279
|
+
credential_id: result.credentialIdB64url,
|
|
280
|
+
passkey_registered: true
|
|
281
|
+
};
|
|
282
|
+
}
|
|
234
283
|
}
|
|
235
284
|
const beginResult = await bridge.send(
|
|
236
285
|
import_utils.PostMessageType.AUTH,
|
|
@@ -302,8 +351,76 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
302
351
|
...wallets ? { wallets } : {}
|
|
303
352
|
};
|
|
304
353
|
};
|
|
354
|
+
const rewrapDekUnderKms = async (dekInfo) => {
|
|
355
|
+
if ((dekInfo.allow_credential_ids_b64url ?? []).length === 0) {
|
|
356
|
+
throw new Error("passkey_required");
|
|
357
|
+
}
|
|
358
|
+
const result = await (0, import_sdk4.getInternalPresenceTokens)({
|
|
359
|
+
transport: bridge,
|
|
360
|
+
passkey: createRNPasskey(),
|
|
361
|
+
publishableKey,
|
|
362
|
+
relyingPartyOrigin: await resolveOrigin(dekInfo),
|
|
363
|
+
// presence-scopes.ts owns every multi-scope set, but there is no
|
|
364
|
+
// constant for this single one and web's kms-recovery passes it
|
|
365
|
+
// inline the same way. Kept literal rather than declaring a rival
|
|
366
|
+
// source of truth for one scope.
|
|
367
|
+
scopes: ["wrap_add"]
|
|
368
|
+
});
|
|
369
|
+
await bridge.send(import_utils.PostMessageType.AUTH, import_utils.PostMessageMethod.ADD_KMS_WRAP, {
|
|
370
|
+
publishableKey,
|
|
371
|
+
userHandleB64url: result.userHandleB64url,
|
|
372
|
+
credentialIdB64url: result.credentialIdB64url,
|
|
373
|
+
presenceTokens: (0, import_sdk4.flattenPresenceTokens)(result),
|
|
374
|
+
consentGranted: true
|
|
375
|
+
});
|
|
376
|
+
return { enabled: true };
|
|
377
|
+
};
|
|
378
|
+
const enableAccountRecovery = async () => {
|
|
379
|
+
const [appConfig, dekInfo] = await Promise.all([
|
|
380
|
+
bridge.send(import_utils.PostMessageType.AUTH, import_utils.PostMessageMethod.GET_APP_CONFIG, {
|
|
381
|
+
publishableKey
|
|
382
|
+
}),
|
|
383
|
+
bridge.send(import_utils.PostMessageType.AUTH, import_utils.PostMessageMethod.GET_DEK_INFO, {
|
|
384
|
+
publishableKey
|
|
385
|
+
})
|
|
386
|
+
]);
|
|
387
|
+
const sdkSettings = appConfig?.sdk_settings;
|
|
388
|
+
const route = selectAccountRecoveryRoute({ sdkSettings, dekInfo });
|
|
389
|
+
if (route === "unavailable") {
|
|
390
|
+
throw new Error("account_recovery_unavailable");
|
|
391
|
+
}
|
|
392
|
+
if (route === "already_wrapped") {
|
|
393
|
+
return { enabled: true };
|
|
394
|
+
}
|
|
395
|
+
if (route === "bootstrap") {
|
|
396
|
+
try {
|
|
397
|
+
await bridge.send(
|
|
398
|
+
import_utils.PostMessageType.AUTH,
|
|
399
|
+
import_utils.PostMessageMethod.BOOTSTRAP_KMS_DEK,
|
|
400
|
+
{ publishableKey, consentGranted: true }
|
|
401
|
+
);
|
|
402
|
+
return { enabled: true };
|
|
403
|
+
} catch (error) {
|
|
404
|
+
if (!isDekAlreadyExistsError(error)) throw error;
|
|
405
|
+
const freshDekInfo = await bridge.send(
|
|
406
|
+
import_utils.PostMessageType.AUTH,
|
|
407
|
+
import_utils.PostMessageMethod.GET_DEK_INFO,
|
|
408
|
+
{ publishableKey }
|
|
409
|
+
);
|
|
410
|
+
if (selectAccountRecoveryRoute({
|
|
411
|
+
sdkSettings,
|
|
412
|
+
dekInfo: freshDekInfo
|
|
413
|
+
}) === "already_wrapped") {
|
|
414
|
+
return { enabled: true };
|
|
415
|
+
}
|
|
416
|
+
return rewrapDekUnderKms(freshDekInfo);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
return rewrapDekUnderKms(dekInfo);
|
|
420
|
+
};
|
|
305
421
|
return {
|
|
306
422
|
registerPasskey: enrollPasskey,
|
|
423
|
+
enableAccountRecovery,
|
|
307
424
|
// Additional and first-time enrollment share the same implementation.
|
|
308
425
|
// The SDK derives which branch is required from GET_DEK_INFO, so exposing
|
|
309
426
|
// both public method names does not duplicate ceremony logic.
|
|
@@ -327,14 +444,11 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
327
444
|
import_utils.PostMessageMethod.GET_DEK_INFO,
|
|
328
445
|
{ publishableKey }
|
|
329
446
|
);
|
|
330
|
-
if (!dekInfo.rp_id) {
|
|
331
|
-
throw new Error("webauthn_rp_id_not_configured");
|
|
332
|
-
}
|
|
333
447
|
return (0, import_sdk4.getPresenceToken)({
|
|
334
448
|
transport: bridge,
|
|
335
449
|
passkey: createRNPasskey(),
|
|
336
450
|
publishableKey,
|
|
337
|
-
relyingPartyOrigin:
|
|
451
|
+
relyingPartyOrigin: await resolveOrigin(dekInfo),
|
|
338
452
|
expiresInSecs: options?.expiresInSecs
|
|
339
453
|
});
|
|
340
454
|
}
|
|
@@ -362,9 +476,18 @@ var getSolanaSDKMethods = (bridge, publishableKey, relyingPartyOrigin) => (0, im
|
|
|
362
476
|
relyingPartyOrigin
|
|
363
477
|
});
|
|
364
478
|
|
|
365
|
-
// src/sdk/sdk-
|
|
479
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
366
480
|
var import_sdk7 = require("@moon-x/core/sdk");
|
|
367
|
-
var
|
|
481
|
+
var getBitcoinSDKMethods = (bridge, publishableKey, relyingPartyOrigin) => (0, import_sdk7.getHeadlessBitcoinMethods)({
|
|
482
|
+
transport: bridge,
|
|
483
|
+
passkey: createRNPasskey(),
|
|
484
|
+
publishableKey,
|
|
485
|
+
relyingPartyOrigin
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// src/sdk/sdk-tron-methods.ts
|
|
489
|
+
var import_sdk8 = require("@moon-x/core/sdk");
|
|
490
|
+
var getTronSDKMethods = (bridge, publishableKey, relyingPartyOrigin) => (0, import_sdk8.getHeadlessTronMethods)({
|
|
368
491
|
transport: bridge,
|
|
369
492
|
passkey: createRNPasskey(),
|
|
370
493
|
publishableKey,
|
|
@@ -419,10 +542,11 @@ var createSdkInstance = ({
|
|
|
419
542
|
setIsAuthenticated,
|
|
420
543
|
setUser
|
|
421
544
|
),
|
|
422
|
-
...getPasskeyMethods(bridge, publishableKey),
|
|
545
|
+
...getPasskeyMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
423
546
|
...getEthereumSDKMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
424
547
|
...getFundingSDKMethods(bridge, publishableKey),
|
|
425
548
|
...getSolanaSDKMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
549
|
+
...getBitcoinSDKMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
426
550
|
...getTronSDKMethods(bridge, publishableKey, relyingPartyOrigin)
|
|
427
551
|
});
|
|
428
552
|
|
|
@@ -1361,7 +1485,7 @@ var useDetachOAuth = () => {
|
|
|
1361
1485
|
};
|
|
1362
1486
|
|
|
1363
1487
|
// src/hooks/use-export-key.ts
|
|
1364
|
-
var
|
|
1488
|
+
var import_sdk9 = require("@moon-x/core/sdk");
|
|
1365
1489
|
var import_utils8 = require("@moon-x/core/utils");
|
|
1366
1490
|
var parseExportKeyResult = (value) => {
|
|
1367
1491
|
if (!value || typeof value !== "object" || !("status" in value)) {
|
|
@@ -1381,12 +1505,12 @@ var useExportKey = () => {
|
|
|
1381
1505
|
return {
|
|
1382
1506
|
exportKey: async (wallet) => {
|
|
1383
1507
|
try {
|
|
1384
|
-
const { userHandleB64url, credentialIdB64url, tokens } = await (0,
|
|
1508
|
+
const { userHandleB64url, credentialIdB64url, tokens } = await (0, import_sdk9.getInternalPresenceTokens)({
|
|
1385
1509
|
transport: _bridge,
|
|
1386
1510
|
passkey: createRNPasskey(),
|
|
1387
1511
|
publishableKey: sdk.publishableKey,
|
|
1388
1512
|
relyingPartyOrigin: _relyingPartyOrigin,
|
|
1389
|
-
scopes:
|
|
1513
|
+
scopes: import_sdk9.SCOPES_EXPORT_KEY
|
|
1390
1514
|
});
|
|
1391
1515
|
const keyshareReadToken = tokens.keyshare_read?.token ?? "";
|
|
1392
1516
|
const params = new URLSearchParams({
|
|
@@ -1866,7 +1990,8 @@ var restoreWalletConnectSession = (options) => {
|
|
|
1866
1990
|
};
|
|
1867
1991
|
|
|
1868
1992
|
// src/index.ts
|
|
1869
|
-
var
|
|
1993
|
+
var import_sdk10 = require("@moon-x/core/sdk");
|
|
1994
|
+
var import_sdk11 = require("@moon-x/core/sdk");
|
|
1870
1995
|
var import_utils10 = require("@moon-x/core/utils");
|
|
1871
1996
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1872
1997
|
0 && (module.exports = {
|
|
@@ -1877,6 +2002,7 @@ var import_utils10 = require("@moon-x/core/utils");
|
|
|
1877
2002
|
PostMessageType,
|
|
1878
2003
|
connectWalletConnect,
|
|
1879
2004
|
listWalletConnectSessions,
|
|
2005
|
+
registerPresenceOtpCodeProvider,
|
|
1880
2006
|
restoreWalletConnectSession,
|
|
1881
2007
|
useAddPasskey,
|
|
1882
2008
|
useAppConfig,
|
package/dist/index.mjs
CHANGED
|
@@ -152,13 +152,37 @@ import {
|
|
|
152
152
|
flattenPresenceTokens,
|
|
153
153
|
getInternalPresenceTokens,
|
|
154
154
|
getPresenceToken,
|
|
155
|
+
resolveRelyingPartyOrigin,
|
|
155
156
|
scopeCountsForRegisterCreate,
|
|
156
157
|
SCOPES_ADD_PASSKEY,
|
|
157
158
|
validateRegisterCreateWallets
|
|
158
159
|
} from "@moon-x/core/sdk";
|
|
159
|
-
import {
|
|
160
|
+
import {
|
|
161
|
+
kmsWrapConfigUsable,
|
|
162
|
+
PostMessageMethod,
|
|
163
|
+
PostMessageType
|
|
164
|
+
} from "@moon-x/core/utils";
|
|
160
165
|
import { create as passkeyCreate } from "react-native-passkeys";
|
|
161
|
-
var
|
|
166
|
+
var selectAccountRecoveryRoute = ({
|
|
167
|
+
sdkSettings,
|
|
168
|
+
dekInfo
|
|
169
|
+
}) => {
|
|
170
|
+
if (!kmsWrapConfigUsable(sdkSettings)) return "unavailable";
|
|
171
|
+
if (dekInfo.has_kms_wrap === true) return "already_wrapped";
|
|
172
|
+
if (dekInfo.has_dek !== true) return "bootstrap";
|
|
173
|
+
return "passkey_rewrap";
|
|
174
|
+
};
|
|
175
|
+
var isDekAlreadyExistsError = (error) => (error instanceof Error ? error.message : String(error)).includes(
|
|
176
|
+
"dek_already_exists"
|
|
177
|
+
);
|
|
178
|
+
var getPasskeyMethods = (bridge, publishableKey, configuredRelyingPartyOrigin) => {
|
|
179
|
+
const resolveOrigin = async (dekInfo) => {
|
|
180
|
+
if (configuredRelyingPartyOrigin) {
|
|
181
|
+
return resolveRelyingPartyOrigin(configuredRelyingPartyOrigin);
|
|
182
|
+
}
|
|
183
|
+
if (!dekInfo.rp_id) throw new Error("webauthn_rp_id_not_configured");
|
|
184
|
+
return `https://${dekInfo.rp_id}`;
|
|
185
|
+
};
|
|
162
186
|
const enrollPasskey = async (params) => {
|
|
163
187
|
const requestedWallets = validateRegisterCreateWallets(
|
|
164
188
|
params?.createWallets
|
|
@@ -168,13 +192,18 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
168
192
|
PostMessageMethod.GET_DEK_INFO,
|
|
169
193
|
{ publishableKey }
|
|
170
194
|
);
|
|
171
|
-
|
|
172
|
-
|
|
195
|
+
const allowList = dekInfo.allow_credential_ids_b64url ?? [];
|
|
196
|
+
const hasPasskeyWrap = dekInfo.has_passkey_wrap ?? (dekInfo.passkey_wrap_credential_ids_b64url?.length ?? allowList.length) > 0;
|
|
197
|
+
const isKmsUpgrade = dekInfo.has_dek === true && !hasPasskeyWrap && dekInfo.has_kms_wrap === true && dekInfo.kms_wrap_enabled === true;
|
|
198
|
+
if (dekInfo.has_dek === true && !hasPasskeyWrap && !isKmsUpgrade) {
|
|
199
|
+
throw new Error("passkey_upgrade_unavailable");
|
|
173
200
|
}
|
|
174
|
-
const rpId = dekInfo.rp_id;
|
|
175
|
-
const relyingPartyOrigin = `https://${rpId}`;
|
|
176
|
-
const isAdditional = (dekInfo.allow_credential_ids_b64url ?? []).length > 0;
|
|
177
201
|
const wantsCreate = requestedWallets.length > 0;
|
|
202
|
+
if (isKmsUpgrade && wantsCreate) {
|
|
203
|
+
throw new Error("register_create_unavailable_for_kms_upgrade");
|
|
204
|
+
}
|
|
205
|
+
const isAdditional = dekInfo.has_dek === true || allowList.length > 0;
|
|
206
|
+
const relyingPartyOrigin = await resolveOrigin(dekInfo);
|
|
178
207
|
let unlock = null;
|
|
179
208
|
if (isAdditional) {
|
|
180
209
|
const result = await getInternalPresenceTokens({
|
|
@@ -184,8 +213,7 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
184
213
|
relyingPartyOrigin,
|
|
185
214
|
scopes: SCOPES_ADD_PASSKEY
|
|
186
215
|
});
|
|
187
|
-
|
|
188
|
-
if (!allowList.includes(result.credentialIdB64url)) {
|
|
216
|
+
if (result.credentialIdB64url && !allowList.includes(result.credentialIdB64url)) {
|
|
189
217
|
throw new Error("unknown_passkey_for_this_account");
|
|
190
218
|
}
|
|
191
219
|
unlock = {
|
|
@@ -193,6 +221,31 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
193
221
|
credentialIdB64url: result.credentialIdB64url,
|
|
194
222
|
presenceTokens: flattenPresenceTokens(result)
|
|
195
223
|
};
|
|
224
|
+
if (!unlock.presenceTokens.passkey_enroll || !unlock.presenceTokens.wrap_add) {
|
|
225
|
+
throw new Error("missing_presence_tokens");
|
|
226
|
+
}
|
|
227
|
+
if (isKmsUpgrade && result.credentialIdB64url && (dekInfo.active_passkey_credential_ids_b64url ?? []).includes(
|
|
228
|
+
result.credentialIdB64url
|
|
229
|
+
) && !(dekInfo.passkey_wrap_credential_ids_b64url ?? []).includes(
|
|
230
|
+
result.credentialIdB64url
|
|
231
|
+
)) {
|
|
232
|
+
await bridge.send(
|
|
233
|
+
PostMessageType.AUTH,
|
|
234
|
+
PostMessageMethod.ADD_PASSKEY_WRAP,
|
|
235
|
+
{
|
|
236
|
+
publishableKey,
|
|
237
|
+
unlockUserHandleB64url: result.userHandleB64url,
|
|
238
|
+
unlockCredentialIdB64url: result.credentialIdB64url,
|
|
239
|
+
newUserHandleB64url: result.userHandleB64url,
|
|
240
|
+
newCredentialIdB64url: result.credentialIdB64url,
|
|
241
|
+
presenceTokens: unlock.presenceTokens
|
|
242
|
+
}
|
|
243
|
+
);
|
|
244
|
+
return {
|
|
245
|
+
credential_id: result.credentialIdB64url,
|
|
246
|
+
passkey_registered: true
|
|
247
|
+
};
|
|
248
|
+
}
|
|
196
249
|
}
|
|
197
250
|
const beginResult = await bridge.send(
|
|
198
251
|
PostMessageType.AUTH,
|
|
@@ -264,8 +317,76 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
264
317
|
...wallets ? { wallets } : {}
|
|
265
318
|
};
|
|
266
319
|
};
|
|
320
|
+
const rewrapDekUnderKms = async (dekInfo) => {
|
|
321
|
+
if ((dekInfo.allow_credential_ids_b64url ?? []).length === 0) {
|
|
322
|
+
throw new Error("passkey_required");
|
|
323
|
+
}
|
|
324
|
+
const result = await getInternalPresenceTokens({
|
|
325
|
+
transport: bridge,
|
|
326
|
+
passkey: createRNPasskey(),
|
|
327
|
+
publishableKey,
|
|
328
|
+
relyingPartyOrigin: await resolveOrigin(dekInfo),
|
|
329
|
+
// presence-scopes.ts owns every multi-scope set, but there is no
|
|
330
|
+
// constant for this single one and web's kms-recovery passes it
|
|
331
|
+
// inline the same way. Kept literal rather than declaring a rival
|
|
332
|
+
// source of truth for one scope.
|
|
333
|
+
scopes: ["wrap_add"]
|
|
334
|
+
});
|
|
335
|
+
await bridge.send(PostMessageType.AUTH, PostMessageMethod.ADD_KMS_WRAP, {
|
|
336
|
+
publishableKey,
|
|
337
|
+
userHandleB64url: result.userHandleB64url,
|
|
338
|
+
credentialIdB64url: result.credentialIdB64url,
|
|
339
|
+
presenceTokens: flattenPresenceTokens(result),
|
|
340
|
+
consentGranted: true
|
|
341
|
+
});
|
|
342
|
+
return { enabled: true };
|
|
343
|
+
};
|
|
344
|
+
const enableAccountRecovery = async () => {
|
|
345
|
+
const [appConfig, dekInfo] = await Promise.all([
|
|
346
|
+
bridge.send(PostMessageType.AUTH, PostMessageMethod.GET_APP_CONFIG, {
|
|
347
|
+
publishableKey
|
|
348
|
+
}),
|
|
349
|
+
bridge.send(PostMessageType.AUTH, PostMessageMethod.GET_DEK_INFO, {
|
|
350
|
+
publishableKey
|
|
351
|
+
})
|
|
352
|
+
]);
|
|
353
|
+
const sdkSettings = appConfig?.sdk_settings;
|
|
354
|
+
const route = selectAccountRecoveryRoute({ sdkSettings, dekInfo });
|
|
355
|
+
if (route === "unavailable") {
|
|
356
|
+
throw new Error("account_recovery_unavailable");
|
|
357
|
+
}
|
|
358
|
+
if (route === "already_wrapped") {
|
|
359
|
+
return { enabled: true };
|
|
360
|
+
}
|
|
361
|
+
if (route === "bootstrap") {
|
|
362
|
+
try {
|
|
363
|
+
await bridge.send(
|
|
364
|
+
PostMessageType.AUTH,
|
|
365
|
+
PostMessageMethod.BOOTSTRAP_KMS_DEK,
|
|
366
|
+
{ publishableKey, consentGranted: true }
|
|
367
|
+
);
|
|
368
|
+
return { enabled: true };
|
|
369
|
+
} catch (error) {
|
|
370
|
+
if (!isDekAlreadyExistsError(error)) throw error;
|
|
371
|
+
const freshDekInfo = await bridge.send(
|
|
372
|
+
PostMessageType.AUTH,
|
|
373
|
+
PostMessageMethod.GET_DEK_INFO,
|
|
374
|
+
{ publishableKey }
|
|
375
|
+
);
|
|
376
|
+
if (selectAccountRecoveryRoute({
|
|
377
|
+
sdkSettings,
|
|
378
|
+
dekInfo: freshDekInfo
|
|
379
|
+
}) === "already_wrapped") {
|
|
380
|
+
return { enabled: true };
|
|
381
|
+
}
|
|
382
|
+
return rewrapDekUnderKms(freshDekInfo);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
return rewrapDekUnderKms(dekInfo);
|
|
386
|
+
};
|
|
267
387
|
return {
|
|
268
388
|
registerPasskey: enrollPasskey,
|
|
389
|
+
enableAccountRecovery,
|
|
269
390
|
// Additional and first-time enrollment share the same implementation.
|
|
270
391
|
// The SDK derives which branch is required from GET_DEK_INFO, so exposing
|
|
271
392
|
// both public method names does not duplicate ceremony logic.
|
|
@@ -289,14 +410,11 @@ var getPasskeyMethods = (bridge, publishableKey) => {
|
|
|
289
410
|
PostMessageMethod.GET_DEK_INFO,
|
|
290
411
|
{ publishableKey }
|
|
291
412
|
);
|
|
292
|
-
if (!dekInfo.rp_id) {
|
|
293
|
-
throw new Error("webauthn_rp_id_not_configured");
|
|
294
|
-
}
|
|
295
413
|
return getPresenceToken({
|
|
296
414
|
transport: bridge,
|
|
297
415
|
passkey: createRNPasskey(),
|
|
298
416
|
publishableKey,
|
|
299
|
-
relyingPartyOrigin:
|
|
417
|
+
relyingPartyOrigin: await resolveOrigin(dekInfo),
|
|
300
418
|
expiresInSecs: options?.expiresInSecs
|
|
301
419
|
});
|
|
302
420
|
}
|
|
@@ -328,6 +446,17 @@ var getSolanaSDKMethods = (bridge, publishableKey, relyingPartyOrigin) => getHea
|
|
|
328
446
|
relyingPartyOrigin
|
|
329
447
|
});
|
|
330
448
|
|
|
449
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
450
|
+
import {
|
|
451
|
+
getHeadlessBitcoinMethods
|
|
452
|
+
} from "@moon-x/core/sdk";
|
|
453
|
+
var getBitcoinSDKMethods = (bridge, publishableKey, relyingPartyOrigin) => getHeadlessBitcoinMethods({
|
|
454
|
+
transport: bridge,
|
|
455
|
+
passkey: createRNPasskey(),
|
|
456
|
+
publishableKey,
|
|
457
|
+
relyingPartyOrigin
|
|
458
|
+
});
|
|
459
|
+
|
|
331
460
|
// src/sdk/sdk-tron-methods.ts
|
|
332
461
|
import {
|
|
333
462
|
getHeadlessTronMethods
|
|
@@ -387,10 +516,11 @@ var createSdkInstance = ({
|
|
|
387
516
|
setIsAuthenticated,
|
|
388
517
|
setUser
|
|
389
518
|
),
|
|
390
|
-
...getPasskeyMethods(bridge, publishableKey),
|
|
519
|
+
...getPasskeyMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
391
520
|
...getEthereumSDKMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
392
521
|
...getFundingSDKMethods(bridge, publishableKey),
|
|
393
522
|
...getSolanaSDKMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
523
|
+
...getBitcoinSDKMethods(bridge, publishableKey, relyingPartyOrigin),
|
|
394
524
|
...getTronSDKMethods(bridge, publishableKey, relyingPartyOrigin)
|
|
395
525
|
});
|
|
396
526
|
|
|
@@ -1860,6 +1990,7 @@ var restoreWalletConnectSession = (options) => {
|
|
|
1860
1990
|
|
|
1861
1991
|
// src/index.ts
|
|
1862
1992
|
import { MOONPAY_CONSUMER_SESSION_ERROR_CODES } from "@moon-x/core/sdk";
|
|
1993
|
+
import { registerPresenceOtpCodeProvider } from "@moon-x/core/sdk";
|
|
1863
1994
|
import { PostMessageMethod as PostMessageMethod9, PostMessageType as PostMessageType9 } from "@moon-x/core/utils";
|
|
1864
1995
|
export {
|
|
1865
1996
|
MOONPAY_CONSUMER_SESSION_ERROR_CODES,
|
|
@@ -1869,6 +2000,7 @@ export {
|
|
|
1869
2000
|
PostMessageType9 as PostMessageType,
|
|
1870
2001
|
connectWalletConnect,
|
|
1871
2002
|
listWalletConnectSessions,
|
|
2003
|
+
registerPresenceOtpCodeProvider,
|
|
1872
2004
|
restoreWalletConnectSession,
|
|
1873
2005
|
useAddPasskey,
|
|
1874
2006
|
useAppConfig,
|
package/dist/solana.js
CHANGED
|
@@ -45,7 +45,7 @@ module.exports = __toCommonJS(solana_exports);
|
|
|
45
45
|
var import_solana = require("@moon-x/core/react/solana");
|
|
46
46
|
|
|
47
47
|
// src/hooks/use-export-key.ts
|
|
48
|
-
var
|
|
48
|
+
var import_sdk9 = require("@moon-x/core/sdk");
|
|
49
49
|
var import_utils5 = require("@moon-x/core/utils");
|
|
50
50
|
|
|
51
51
|
// src/provider.tsx
|
|
@@ -152,9 +152,12 @@ var import_sdk5 = require("@moon-x/core/sdk");
|
|
|
152
152
|
// src/sdk/sdk-solana-methods.ts
|
|
153
153
|
var import_sdk6 = require("@moon-x/core/sdk");
|
|
154
154
|
|
|
155
|
-
// src/sdk/sdk-
|
|
155
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
156
156
|
var import_sdk7 = require("@moon-x/core/sdk");
|
|
157
157
|
|
|
158
|
+
// src/sdk/sdk-tron-methods.ts
|
|
159
|
+
var import_sdk8 = require("@moon-x/core/sdk");
|
|
160
|
+
|
|
158
161
|
// src/provider.tsx
|
|
159
162
|
var import_utils4 = require("@moon-x/core/utils");
|
|
160
163
|
|
|
@@ -263,12 +266,12 @@ var useExportKey = () => {
|
|
|
263
266
|
return {
|
|
264
267
|
exportKey: async (wallet) => {
|
|
265
268
|
try {
|
|
266
|
-
const { userHandleB64url, credentialIdB64url, tokens } = await (0,
|
|
269
|
+
const { userHandleB64url, credentialIdB64url, tokens } = await (0, import_sdk9.getInternalPresenceTokens)({
|
|
267
270
|
transport: _bridge,
|
|
268
271
|
passkey: createRNPasskey(),
|
|
269
272
|
publishableKey: sdk.publishableKey,
|
|
270
273
|
relyingPartyOrigin: _relyingPartyOrigin,
|
|
271
|
-
scopes:
|
|
274
|
+
scopes: import_sdk9.SCOPES_EXPORT_KEY
|
|
272
275
|
});
|
|
273
276
|
const keyshareReadToken = tokens.keyshare_read?.token ?? "";
|
|
274
277
|
const params = new URLSearchParams({
|
package/dist/solana.mjs
CHANGED
|
@@ -133,11 +133,16 @@ import {
|
|
|
133
133
|
flattenPresenceTokens,
|
|
134
134
|
getInternalPresenceTokens,
|
|
135
135
|
getPresenceToken,
|
|
136
|
+
resolveRelyingPartyOrigin,
|
|
136
137
|
scopeCountsForRegisterCreate,
|
|
137
138
|
SCOPES_ADD_PASSKEY,
|
|
138
139
|
validateRegisterCreateWallets
|
|
139
140
|
} from "@moon-x/core/sdk";
|
|
140
|
-
import {
|
|
141
|
+
import {
|
|
142
|
+
kmsWrapConfigUsable,
|
|
143
|
+
PostMessageMethod,
|
|
144
|
+
PostMessageType
|
|
145
|
+
} from "@moon-x/core/utils";
|
|
141
146
|
import { create as passkeyCreate } from "react-native-passkeys";
|
|
142
147
|
|
|
143
148
|
// src/sdk/sdk-methods.ts
|
|
@@ -150,6 +155,11 @@ import {
|
|
|
150
155
|
getHeadlessSolanaMethods
|
|
151
156
|
} from "@moon-x/core/sdk";
|
|
152
157
|
|
|
158
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
159
|
+
import {
|
|
160
|
+
getHeadlessBitcoinMethods
|
|
161
|
+
} from "@moon-x/core/sdk";
|
|
162
|
+
|
|
153
163
|
// src/sdk/sdk-tron-methods.ts
|
|
154
164
|
import {
|
|
155
165
|
getHeadlessTronMethods
|
package/dist/tron.js
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = __toCommonJS(tron_exports);
|
|
|
44
44
|
var import_tron = require("@moon-x/core/react/tron");
|
|
45
45
|
|
|
46
46
|
// src/hooks/use-export-key.ts
|
|
47
|
-
var
|
|
47
|
+
var import_sdk9 = require("@moon-x/core/sdk");
|
|
48
48
|
var import_utils5 = require("@moon-x/core/utils");
|
|
49
49
|
|
|
50
50
|
// src/provider.tsx
|
|
@@ -151,9 +151,12 @@ var import_sdk5 = require("@moon-x/core/sdk");
|
|
|
151
151
|
// src/sdk/sdk-solana-methods.ts
|
|
152
152
|
var import_sdk6 = require("@moon-x/core/sdk");
|
|
153
153
|
|
|
154
|
-
// src/sdk/sdk-
|
|
154
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
155
155
|
var import_sdk7 = require("@moon-x/core/sdk");
|
|
156
156
|
|
|
157
|
+
// src/sdk/sdk-tron-methods.ts
|
|
158
|
+
var import_sdk8 = require("@moon-x/core/sdk");
|
|
159
|
+
|
|
157
160
|
// src/provider.tsx
|
|
158
161
|
var import_utils4 = require("@moon-x/core/utils");
|
|
159
162
|
|
|
@@ -262,12 +265,12 @@ var useExportKey = () => {
|
|
|
262
265
|
return {
|
|
263
266
|
exportKey: async (wallet) => {
|
|
264
267
|
try {
|
|
265
|
-
const { userHandleB64url, credentialIdB64url, tokens } = await (0,
|
|
268
|
+
const { userHandleB64url, credentialIdB64url, tokens } = await (0, import_sdk9.getInternalPresenceTokens)({
|
|
266
269
|
transport: _bridge,
|
|
267
270
|
passkey: createRNPasskey(),
|
|
268
271
|
publishableKey: sdk.publishableKey,
|
|
269
272
|
relyingPartyOrigin: _relyingPartyOrigin,
|
|
270
|
-
scopes:
|
|
273
|
+
scopes: import_sdk9.SCOPES_EXPORT_KEY
|
|
271
274
|
});
|
|
272
275
|
const keyshareReadToken = tokens.keyshare_read?.token ?? "";
|
|
273
276
|
const params = new URLSearchParams({
|
package/dist/tron.mjs
CHANGED
|
@@ -132,11 +132,16 @@ import {
|
|
|
132
132
|
flattenPresenceTokens,
|
|
133
133
|
getInternalPresenceTokens,
|
|
134
134
|
getPresenceToken,
|
|
135
|
+
resolveRelyingPartyOrigin,
|
|
135
136
|
scopeCountsForRegisterCreate,
|
|
136
137
|
SCOPES_ADD_PASSKEY,
|
|
137
138
|
validateRegisterCreateWallets
|
|
138
139
|
} from "@moon-x/core/sdk";
|
|
139
|
-
import {
|
|
140
|
+
import {
|
|
141
|
+
kmsWrapConfigUsable,
|
|
142
|
+
PostMessageMethod,
|
|
143
|
+
PostMessageType
|
|
144
|
+
} from "@moon-x/core/utils";
|
|
140
145
|
import { create as passkeyCreate } from "react-native-passkeys";
|
|
141
146
|
|
|
142
147
|
// src/sdk/sdk-methods.ts
|
|
@@ -149,6 +154,11 @@ import {
|
|
|
149
154
|
getHeadlessSolanaMethods
|
|
150
155
|
} from "@moon-x/core/sdk";
|
|
151
156
|
|
|
157
|
+
// src/sdk/sdk-bitcoin-methods.ts
|
|
158
|
+
import {
|
|
159
|
+
getHeadlessBitcoinMethods
|
|
160
|
+
} from "@moon-x/core/sdk";
|
|
161
|
+
|
|
152
162
|
// src/sdk/sdk-tron-methods.ts
|
|
153
163
|
import {
|
|
154
164
|
getHeadlessTronMethods
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moon-x/react-native-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Headless MoonX React Native SDK with WebView-backed transport, native passkeys, and app-owned UI.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
"import": "./dist/solana.mjs",
|
|
23
23
|
"require": "./dist/solana.js"
|
|
24
24
|
},
|
|
25
|
+
"./bitcoin": {
|
|
26
|
+
"types": "./dist/bitcoin.d.ts",
|
|
27
|
+
"import": "./dist/bitcoin.mjs",
|
|
28
|
+
"require": "./dist/bitcoin.js"
|
|
29
|
+
},
|
|
25
30
|
"./tron": {
|
|
26
31
|
"types": "./dist/tron.d.ts",
|
|
27
32
|
"import": "./dist/tron.mjs",
|
|
@@ -57,7 +62,7 @@
|
|
|
57
62
|
"vitest": "4.1.0"
|
|
58
63
|
},
|
|
59
64
|
"dependencies": {
|
|
60
|
-
"@moon-x/core": "0.
|
|
65
|
+
"@moon-x/core": "0.26.0"
|
|
61
66
|
},
|
|
62
67
|
"peerDependencies": {
|
|
63
68
|
"@expo/config-plugins": ">=10.0.0",
|