thirdweb 5.61.7-nightly-da9f1964e4ae74ed5d33666788e2d16e4d56614d-20241015000333 → 5.62.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/dist/cjs/exports/extensions/erc1155.js +3 -1
- package/dist/cjs/exports/extensions/erc1155.js.map +1 -1
- package/dist/cjs/extensions/erc1155/write/mintToBatch.js +79 -0
- package/dist/cjs/extensions/erc1155/write/mintToBatch.js.map +1 -0
- package/dist/cjs/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js +15 -4
- package/dist/cjs/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js.map +1 -1
- package/dist/cjs/react/native/ui/components/WalletImage.js +3 -2
- package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectModal.js +6 -6
- package/dist/cjs/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js +2 -2
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +3 -3
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ReceiveScreen.js +2 -2
- package/dist/cjs/react/native/ui/connect/ReceiveScreen.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +8 -0
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -0
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js +11 -16
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/PassKeyLogin.js +7 -0
- package/dist/cjs/react/web/wallets/shared/PassKeyLogin.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +9 -12
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/generate-wallet.enclave.js +2 -2
- package/dist/cjs/wallets/in-app/core/actions/generate-wallet.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/get-enclave-user-status.js +2 -2
- package/dist/cjs/wallets/in-app/core/actions/get-enclave-user-status.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/sign-message.enclave.js +6 -5
- package/dist/cjs/wallets/in-app/core/actions/sign-message.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/sign-transaction.enclave.js +6 -5
- package/dist/cjs/wallets/in-app/core/actions/sign-transaction.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.js +6 -5
- package/dist/cjs/wallets/in-app/core/actions/sign-typed-data.enclave.js.map +1 -0
- package/dist/cjs/wallets/in-app/core/authentication/client-scoped-storage.js +9 -2
- package/dist/cjs/wallets/in-app/core/authentication/client-scoped-storage.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js +4 -8
- package/dist/cjs/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/passkeys.js +1 -1
- package/dist/cjs/wallets/in-app/native/auth/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +14 -0
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js +3 -2
- package/dist/cjs/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/constants.js +2 -1
- package/dist/cjs/wallets/in-app/native/helpers/constants.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js +133 -0
- package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js.map +1 -0
- package/dist/cjs/wallets/in-app/native/helpers/wallet/retrieval.js +2 -0
- package/dist/cjs/wallets/in-app/native/helpers/wallet/retrieval.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +50 -28
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js +2 -2
- package/dist/cjs/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +13 -13
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js +1 -1
- package/dist/cjs/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js.map +1 -1
- package/dist/esm/exports/extensions/erc1155.js +1 -0
- package/dist/esm/exports/extensions/erc1155.js.map +1 -1
- package/dist/esm/extensions/erc1155/write/mintToBatch.js +76 -0
- package/dist/esm/extensions/erc1155/write/mintToBatch.js.map +1 -0
- package/dist/esm/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js +15 -4
- package/dist/esm/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.js.map +1 -1
- package/dist/esm/react/native/ui/components/WalletImage.js +3 -2
- package/dist/esm/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectModal.js +6 -6
- package/dist/esm/react/native/ui/connect/ConnectModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js +2 -2
- package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +3 -3
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ReceiveScreen.js +2 -2
- package/dist/esm/react/native/ui/connect/ReceiveScreen.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js +8 -0
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +1 -0
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js +12 -17
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/PassKeyLogin.js +7 -0
- package/dist/esm/react/web/wallets/shared/PassKeyLogin.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +9 -12
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/generate-wallet.enclave.js +2 -2
- package/dist/esm/wallets/in-app/core/actions/generate-wallet.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/get-enclave-user-status.js +2 -2
- package/dist/esm/wallets/in-app/core/actions/get-enclave-user-status.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/sign-message.enclave.js +6 -5
- package/dist/esm/wallets/in-app/core/actions/sign-message.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/sign-transaction.enclave.js +6 -5
- package/dist/esm/wallets/in-app/core/actions/sign-transaction.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.js +6 -5
- package/dist/esm/wallets/in-app/core/actions/sign-typed-data.enclave.js.map +1 -0
- package/dist/esm/wallets/in-app/core/authentication/client-scoped-storage.js +9 -2
- package/dist/esm/wallets/in-app/core/authentication/client-scoped-storage.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js +4 -8
- package/dist/esm/wallets/in-app/core/wallet/enclave-wallet.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/passkeys.js +1 -1
- package/dist/esm/wallets/in-app/native/auth/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +14 -0
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js +3 -2
- package/dist/esm/wallets/in-app/native/helpers/auth/middleware.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/constants.js +1 -0
- package/dist/esm/wallets/in-app/native/helpers/constants.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js +130 -0
- package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js.map +1 -0
- package/dist/esm/wallets/in-app/native/helpers/wallet/retrieval.js +2 -2
- package/dist/esm/wallets/in-app/native/helpers/wallet/retrieval.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +50 -28
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js +2 -2
- package/dist/esm/wallets/in-app/web/lib/auth/iframe-auth.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +13 -13
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js +1 -1
- package/dist/esm/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.js.map +1 -1
- package/dist/types/exports/extensions/erc1155.d.ts +1 -0
- package/dist/types/exports/extensions/erc1155.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/write/mintToBatch.d.ts +72 -0
- package/dist/types/extensions/erc1155/write/mintToBatch.d.ts.map +1 -0
- package/dist/types/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/WalletImage.d.ts +2 -0
- package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedButton.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ReceiveScreen.d.ts +2 -0
- package/dist/types/react/native/ui/connect/ReceiveScreen.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/OTPLoginUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/actions/generate-wallet.enclave.d.ts +13 -0
- package/dist/types/wallets/in-app/core/actions/generate-wallet.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/actions/get-enclave-user-status.d.ts +14 -0
- package/dist/types/wallets/in-app/core/actions/get-enclave-user-status.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/actions/sign-message.enclave.d.ts +17 -0
- package/dist/types/wallets/in-app/core/actions/sign-message.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/actions/sign-transaction.enclave.d.ts +9 -0
- package/dist/types/wallets/in-app/core/actions/sign-transaction.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.d.ts +3 -5
- package/dist/types/wallets/in-app/core/actions/sign-typed-data.enclave.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/authentication/client-scoped-storage.d.ts +4 -3
- package/dist/types/wallets/in-app/core/authentication/client-scoped-storage.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/enclave-wallet.d.ts +6 -7
- package/dist/types/wallets/in-app/core/wallet/enclave-wallet.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/constants.d.ts +1 -0
- package/dist/types/wallets/in-app/native/helpers/constants.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/wallet/migration.d.ts +17 -0
- package/dist/types/wallets/in-app/native/helpers/wallet/migration.d.ts.map +1 -0
- package/dist/types/wallets/in-app/native/helpers/wallet/retrieval.d.ts +27 -0
- package/dist/types/wallets/in-app/native/helpers/wallet/retrieval.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/native-connector.d.ts +2 -2
- package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/iframe-auth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/package.json +5 -1
- package/src/exports/extensions/erc1155.ts +5 -0
- package/src/extensions/erc1155/write/mintToBatch.test.ts +74 -0
- package/src/extensions/erc1155/write/mintToBatch.ts +117 -0
- package/src/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.test.ts +75 -80
- package/src/extensions/erc721/lazyMinting/write/createDelayedRevealBatch.ts +18 -4
- package/src/react/native/ui/components/WalletImage.tsx +5 -2
- package/src/react/native/ui/connect/ConnectModal.tsx +19 -2
- package/src/react/native/ui/connect/ConnectedButton.tsx +8 -2
- package/src/react/native/ui/connect/ConnectedModal.tsx +9 -2
- package/src/react/native/ui/connect/ReceiveScreen.tsx +5 -2
- package/src/react/web/wallets/in-app/WalletAuth.tsx +8 -0
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +1 -0
- package/src/react/web/wallets/shared/OTPLoginUI.tsx +12 -18
- package/src/react/web/wallets/shared/PassKeyLogin.tsx +7 -0
- package/src/react/web/wallets/shared/SocialLogin.tsx +9 -12
- package/src/version.ts +1 -1
- package/src/wallets/in-app/{web/lib → core}/actions/generate-wallet.enclave.ts +6 -8
- package/src/wallets/in-app/{web/lib → core}/actions/get-enclave-user-status.ts +5 -5
- package/src/wallets/in-app/{web/lib → core}/actions/sign-message.enclave.ts +7 -9
- package/src/wallets/in-app/{web/lib → core}/actions/sign-transaction.enclave.ts +8 -10
- package/src/wallets/in-app/{web/lib → core}/actions/sign-typed-data.enclave.ts +7 -9
- package/src/wallets/in-app/core/authentication/client-scoped-storage.ts +6 -4
- package/src/wallets/in-app/core/authentication/guest.ts +1 -1
- package/src/wallets/in-app/core/wallet/enclave-wallet.ts +11 -17
- package/src/wallets/in-app/native/auth/passkeys.ts +1 -1
- package/src/wallets/in-app/native/helpers/api/fetchers.ts +14 -0
- package/src/wallets/in-app/native/helpers/auth/middleware.ts +3 -2
- package/src/wallets/in-app/native/helpers/constants.ts +2 -0
- package/src/wallets/in-app/native/helpers/wallet/migration.ts +185 -0
- package/src/wallets/in-app/native/helpers/wallet/retrieval.ts +2 -2
- package/src/wallets/in-app/native/native-connector.ts +62 -28
- package/src/wallets/in-app/web/lib/auth/iframe-auth.ts +2 -2
- package/src/wallets/in-app/web/lib/auth/passkeys.ts +1 -1
- package/src/wallets/in-app/web/lib/web-connector.ts +13 -13
- package/src/wallets/in-app/web/utils/iFrameCommunication/InAppWalletIframeCommunicator.ts +1 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/generate-wallet.enclave.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/get-enclave-user-status.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +0 -1
- package/dist/cjs/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/generate-wallet.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/get-enclave-user-status.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-message.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-transaction.enclave.js.map +0 -1
- package/dist/esm/wallets/in-app/web/lib/actions/sign-typed-data.enclave.js.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/generate-wallet.enclave.d.ts +0 -15
- package/dist/types/wallets/in-app/web/lib/actions/generate-wallet.enclave.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts +0 -14
- package/dist/types/wallets/in-app/web/lib/actions/get-enclave-user-status.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts +0 -19
- package/dist/types/wallets/in-app/web/lib/actions/sign-message.enclave.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts +0 -11
- package/dist/types/wallets/in-app/web/lib/actions/sign-transaction.enclave.d.ts.map +0 -1
- package/dist/types/wallets/in-app/web/lib/actions/sign-typed-data.enclave.d.ts.map +0 -1
@@ -11,10 +11,10 @@ import type {
|
|
11
11
|
Account,
|
12
12
|
SendTransactionOption,
|
13
13
|
} from "../../../interfaces/wallet.js";
|
14
|
-
import { getUserStatus } from "
|
15
|
-
import { signMessage as signEnclaveMessage } from "
|
16
|
-
import { signTransaction as signEnclaveTransaction } from "
|
17
|
-
import { signTypedData as signEnclaveTypedData } from "
|
14
|
+
import { getUserStatus } from "../actions/get-enclave-user-status.js";
|
15
|
+
import { signMessage as signEnclaveMessage } from "../actions/sign-message.enclave.js";
|
16
|
+
import { signTransaction as signEnclaveTransaction } from "../actions/sign-transaction.enclave.js";
|
17
|
+
import { signTypedData as signEnclaveTypedData } from "../actions/sign-typed-data.enclave.js";
|
18
18
|
import type { ClientScopedStorage } from "../authentication/client-scoped-storage.js";
|
19
19
|
import type {
|
20
20
|
AuthDetails,
|
@@ -33,18 +33,16 @@ export type UserStatus = {
|
|
33
33
|
| { address: string; [key: string]: string }
|
34
34
|
| { id: string; [key: string]: string };
|
35
35
|
}[];
|
36
|
-
wallets:
|
37
|
-
| [
|
38
|
-
{
|
39
|
-
address: string;
|
40
|
-
createdAt: string;
|
41
|
-
type: "sharded" | "enclave";
|
42
|
-
},
|
43
|
-
]
|
44
|
-
| [];
|
36
|
+
wallets: UserWallet[];
|
45
37
|
id: string;
|
46
38
|
};
|
47
39
|
|
40
|
+
export type UserWallet = {
|
41
|
+
address: string;
|
42
|
+
createdAt: string;
|
43
|
+
type: "sharded" | "enclave";
|
44
|
+
};
|
45
|
+
|
48
46
|
export class EnclaveWallet implements IWebWallet {
|
49
47
|
private client: ThirdwebClient;
|
50
48
|
private ecosystem?: Ecosystem;
|
@@ -130,7 +128,6 @@ export class EnclaveWallet implements IWebWallet {
|
|
130
128
|
*/
|
131
129
|
async getAccount(): Promise<Account> {
|
132
130
|
const client = this.client;
|
133
|
-
const ecosystem = this.ecosystem;
|
134
131
|
const storage = this.localStorage;
|
135
132
|
|
136
133
|
const _signTransaction = async (tx: SendTransactionOption) => {
|
@@ -171,7 +168,6 @@ export class EnclaveWallet implements IWebWallet {
|
|
171
168
|
|
172
169
|
return signEnclaveTransaction({
|
173
170
|
client,
|
174
|
-
ecosystem,
|
175
171
|
storage,
|
176
172
|
payload: transaction,
|
177
173
|
});
|
@@ -218,7 +214,6 @@ export class EnclaveWallet implements IWebWallet {
|
|
218
214
|
|
219
215
|
const { signature } = await signEnclaveMessage({
|
220
216
|
client,
|
221
|
-
ecosystem,
|
222
217
|
payload: messagePayload,
|
223
218
|
storage,
|
224
219
|
});
|
@@ -228,7 +223,6 @@ export class EnclaveWallet implements IWebWallet {
|
|
228
223
|
const parsedTypedData = parseTypedData(_typedData);
|
229
224
|
const { signature } = await signEnclaveTypedData({
|
230
225
|
client,
|
231
|
-
ecosystem,
|
232
226
|
payload: parsedTypedData,
|
233
227
|
storage,
|
234
228
|
});
|
@@ -125,7 +125,7 @@ export async function hasStoredPasskey(
|
|
125
125
|
const storage = new ClientScopedStorage({
|
126
126
|
storage: nativeLocalStorage,
|
127
127
|
clientId: client.clientId,
|
128
|
-
ecosystemId: ecosystemId,
|
128
|
+
ecosystem: ecosystemId ? { id: ecosystemId } : undefined,
|
129
129
|
});
|
130
130
|
const credId = await storage.getPasskeyCredentialId();
|
131
131
|
return !!credId;
|
@@ -14,6 +14,8 @@ import { createErrorMessage } from "../errors.js";
|
|
14
14
|
|
15
15
|
const EMBEDDED_WALLET_TOKEN_HEADER = "embedded-wallet-token";
|
16
16
|
const PAPER_CLIENT_ID_HEADER = "x-thirdweb-client-id";
|
17
|
+
const ECOSYSTEM_ID_HEADER = "x-ecosystem-id";
|
18
|
+
const ECOSYSTEM_PARTNER_ID_HEADER = "x-ecosystem-partner-id";
|
17
19
|
|
18
20
|
let sessionNonce: Hex | undefined = undefined;
|
19
21
|
|
@@ -63,6 +65,12 @@ export async function authFetchEmbeddedWalletUser(args: {
|
|
63
65
|
authTokenClient || ""
|
64
66
|
}`,
|
65
67
|
[PAPER_CLIENT_ID_HEADER]: client.clientId,
|
68
|
+
...(storage.ecosystem
|
69
|
+
? {
|
70
|
+
[ECOSYSTEM_ID_HEADER]: storage.ecosystem.id,
|
71
|
+
[ECOSYSTEM_PARTNER_ID_HEADER]: storage.ecosystem?.partnerId,
|
72
|
+
}
|
73
|
+
: {}),
|
66
74
|
...getSessionHeaders(),
|
67
75
|
}
|
68
76
|
: {
|
@@ -70,6 +78,12 @@ export async function authFetchEmbeddedWalletUser(args: {
|
|
70
78
|
authTokenClient || ""
|
71
79
|
}`,
|
72
80
|
[PAPER_CLIENT_ID_HEADER]: client.clientId,
|
81
|
+
...(storage.ecosystem
|
82
|
+
? {
|
83
|
+
[ECOSYSTEM_ID_HEADER]: storage.ecosystem.id,
|
84
|
+
[ECOSYSTEM_PARTNER_ID_HEADER]: storage.ecosystem?.partnerId,
|
85
|
+
}
|
86
|
+
: {}),
|
73
87
|
...getSessionHeaders(),
|
74
88
|
};
|
75
89
|
|
@@ -102,10 +102,11 @@ async function getRecoveryCode(args: {
|
|
102
102
|
}
|
103
103
|
try {
|
104
104
|
return await getCognitoRecoveryPasswordV2({ client, storage });
|
105
|
-
} catch {
|
105
|
+
} catch (err) {
|
106
|
+
console.error("Error recovering wallet", err);
|
106
107
|
return await getCognitoRecoveryPasswordV1({ client, storage }).catch(
|
107
108
|
() => {
|
108
|
-
throw new Error("Something went wrong
|
109
|
+
throw new Error("Something went wrong while recovering wallet");
|
109
110
|
},
|
110
111
|
);
|
111
112
|
}
|
@@ -22,6 +22,8 @@ export const GENERATE_RECOVERY_PASSWORD_LAMBDA_FUNCTION_V1 =
|
|
22
22
|
"arn:aws:lambda:us-west-2:324457261097:function:recovery-share-password-GenerateRecoverySharePassw-bbE5ZbVAToil";
|
23
23
|
export const GENERATE_RECOVERY_PASSWORD_LAMBDA_FUNCTION_V2 =
|
24
24
|
"arn:aws:lambda:us-west-2:324457261097:function:lambda-thirdweb-auth-enc-key-prod-ThirdwebAuthEncKeyFunction";
|
25
|
+
export const ENCLAVE_KMS_KEY_ARN =
|
26
|
+
"arn:aws:kms:us-west-2:324457261097:key/8b2a8cd5-9b22-4ea0-a6bc-463824a78f20";
|
25
27
|
|
26
28
|
// TODO allow overriding domain
|
27
29
|
const DOMAIN_URL_2023 = getThirdwebBaseUrl("inAppWallet");
|
@@ -0,0 +1,185 @@
|
|
1
|
+
import { GenerateDataKeyCommand, KMSClient } from "@aws-sdk/client-kms";
|
2
|
+
import { fromCognitoIdentity } from "@aws-sdk/credential-providers";
|
3
|
+
import QuickCrypto from "react-native-quick-crypto";
|
4
|
+
import type { ThirdwebClient } from "../../../../../client/client.js";
|
5
|
+
import { getThirdwebBaseUrl } from "../../../../../utils/domains.js";
|
6
|
+
import { stringToBytes } from "../../../../../utils/encoding/to-bytes.js";
|
7
|
+
import { randomBytesBuffer } from "../../../../../utils/random.js";
|
8
|
+
import {
|
9
|
+
concatUint8Arrays,
|
10
|
+
uint8ArrayToBase64,
|
11
|
+
} from "../../../../../utils/uint8-array.js";
|
12
|
+
import { privateKeyToAccount } from "../../../../private-key.js";
|
13
|
+
import type { ClientScopedStorage } from "../../../core/authentication/client-scoped-storage.js";
|
14
|
+
import type { AuthStoredTokenWithCookieReturnType } from "../../../core/authentication/types.js";
|
15
|
+
import type { UserWallet } from "../../../core/wallet/enclave-wallet.js";
|
16
|
+
import { authFetchEmbeddedWalletUser } from "../api/fetchers.js";
|
17
|
+
import { postAuth } from "../auth/middleware.js";
|
18
|
+
import {
|
19
|
+
AWS_REGION,
|
20
|
+
ENCLAVE_KMS_KEY_ARN,
|
21
|
+
ROUTE_AUTH_COGNITO_ID_TOKEN_V2,
|
22
|
+
} from "../constants.js";
|
23
|
+
import { getShares, getWalletPrivateKeyFromShares } from "./retrieval.js";
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Migrate a sharded wallet to an enclave wallet.
|
27
|
+
*
|
28
|
+
* @param args - The arguments for the migration process.
|
29
|
+
* @returns The migrated user wallet.
|
30
|
+
*/
|
31
|
+
export async function migrateToEnclaveWallet(args: {
|
32
|
+
client: ThirdwebClient;
|
33
|
+
storage: ClientScopedStorage;
|
34
|
+
storedToken: AuthStoredTokenWithCookieReturnType["storedToken"];
|
35
|
+
encryptionKey?: string;
|
36
|
+
}): Promise<UserWallet> {
|
37
|
+
// setup sharded wallet first, so we have the shares available
|
38
|
+
await postAuth({
|
39
|
+
storedToken: args.storedToken,
|
40
|
+
client: args.client,
|
41
|
+
storage: args.storage,
|
42
|
+
encryptionKey: args.encryptionKey,
|
43
|
+
});
|
44
|
+
|
45
|
+
const { authShare, deviceShare } = await getShares({
|
46
|
+
client: args.client,
|
47
|
+
authShare: { toRetrieve: true },
|
48
|
+
deviceShare: { toRetrieve: true },
|
49
|
+
recoveryShare: { toRetrieve: false },
|
50
|
+
storage: args.storage,
|
51
|
+
});
|
52
|
+
|
53
|
+
// construct the sharded wallet
|
54
|
+
const privateKey = await getWalletPrivateKeyFromShares([
|
55
|
+
authShare,
|
56
|
+
deviceShare,
|
57
|
+
]);
|
58
|
+
const account = privateKeyToAccount({
|
59
|
+
client: args.client,
|
60
|
+
privateKey,
|
61
|
+
});
|
62
|
+
const address = account.address;
|
63
|
+
|
64
|
+
// get cognito identity
|
65
|
+
const idTokenResponse = await authFetchEmbeddedWalletUser({
|
66
|
+
client: args.client,
|
67
|
+
url: ROUTE_AUTH_COGNITO_ID_TOKEN_V2,
|
68
|
+
props: {
|
69
|
+
method: "GET",
|
70
|
+
},
|
71
|
+
storage: args.storage,
|
72
|
+
});
|
73
|
+
if (!idTokenResponse.ok) {
|
74
|
+
throw new Error(
|
75
|
+
`Failed to fetch id token from Cognito: ${JSON.stringify(
|
76
|
+
await idTokenResponse.json(),
|
77
|
+
null,
|
78
|
+
2,
|
79
|
+
)}`,
|
80
|
+
);
|
81
|
+
}
|
82
|
+
const idTokenResult = await idTokenResponse.json();
|
83
|
+
const { token, identityId } = idTokenResult;
|
84
|
+
|
85
|
+
const cognitoIdentity = fromCognitoIdentity({
|
86
|
+
clientConfig: {
|
87
|
+
region: AWS_REGION,
|
88
|
+
},
|
89
|
+
identityId,
|
90
|
+
logins: {
|
91
|
+
"cognito-identity.amazonaws.com": token,
|
92
|
+
},
|
93
|
+
});
|
94
|
+
|
95
|
+
// get kms key
|
96
|
+
const kmsClient = new KMSClient({
|
97
|
+
region: AWS_REGION,
|
98
|
+
credentials: cognitoIdentity,
|
99
|
+
});
|
100
|
+
const generateDataKeyCommand = new GenerateDataKeyCommand({
|
101
|
+
KeyId: ENCLAVE_KMS_KEY_ARN,
|
102
|
+
KeySpec: "AES_256",
|
103
|
+
});
|
104
|
+
const encryptedKeyResult = await kmsClient.send(generateDataKeyCommand);
|
105
|
+
const plaintextKeyBlob = encryptedKeyResult.Plaintext;
|
106
|
+
const cipherTextBlob = encryptedKeyResult.CiphertextBlob;
|
107
|
+
if (!plaintextKeyBlob || !cipherTextBlob) {
|
108
|
+
throw new Error("No migration key found. Please try again.");
|
109
|
+
}
|
110
|
+
|
111
|
+
// encrypt private key
|
112
|
+
const iv = randomBytesBuffer(16);
|
113
|
+
// @ts-ignore - default import buils but ts doesn't like it
|
114
|
+
const key = await QuickCrypto.subtle.importKey(
|
115
|
+
"raw",
|
116
|
+
plaintextKeyBlob,
|
117
|
+
"AES-CBC",
|
118
|
+
false,
|
119
|
+
["encrypt", "decrypt"],
|
120
|
+
);
|
121
|
+
|
122
|
+
// @ts-ignore - default import buils but ts doesn't like it
|
123
|
+
const encryptedPrivateKey = await QuickCrypto.subtle.encrypt(
|
124
|
+
{
|
125
|
+
name: "AES-CBC",
|
126
|
+
iv,
|
127
|
+
},
|
128
|
+
key,
|
129
|
+
stringToBytes(privateKey),
|
130
|
+
);
|
131
|
+
|
132
|
+
const encryptedData = concatUint8Arrays([
|
133
|
+
iv,
|
134
|
+
new Uint8Array(encryptedPrivateKey),
|
135
|
+
]);
|
136
|
+
|
137
|
+
const ivB64 = uint8ArrayToBase64(iv);
|
138
|
+
const cipherTextB64 = uint8ArrayToBase64(cipherTextBlob);
|
139
|
+
const encryptedPrivateKeyB64 = uint8ArrayToBase64(encryptedData);
|
140
|
+
|
141
|
+
// execute migration
|
142
|
+
const result = await executeMigration({
|
143
|
+
client: args.client,
|
144
|
+
storage: args.storage,
|
145
|
+
address,
|
146
|
+
kmsCiphertextB64: cipherTextB64,
|
147
|
+
encryptedPrivateKeyB64: encryptedPrivateKeyB64,
|
148
|
+
ivB64,
|
149
|
+
});
|
150
|
+
|
151
|
+
return result;
|
152
|
+
}
|
153
|
+
|
154
|
+
async function executeMigration(args: {
|
155
|
+
client: ThirdwebClient;
|
156
|
+
storage: ClientScopedStorage;
|
157
|
+
address: string;
|
158
|
+
kmsCiphertextB64: string;
|
159
|
+
encryptedPrivateKeyB64: string;
|
160
|
+
ivB64: string;
|
161
|
+
}): Promise<UserWallet> {
|
162
|
+
const migrationResponse = await authFetchEmbeddedWalletUser({
|
163
|
+
client: args.client,
|
164
|
+
url: `${getThirdwebBaseUrl("inAppWallet")}/api/v1/enclave-wallet/migrate`,
|
165
|
+
props: {
|
166
|
+
method: "POST",
|
167
|
+
body: JSON.stringify({
|
168
|
+
address: args.address,
|
169
|
+
kmsCiphertextB64: args.kmsCiphertextB64,
|
170
|
+
encryptedPrivateKeyB64: args.encryptedPrivateKeyB64,
|
171
|
+
ivB64: args.ivB64,
|
172
|
+
}),
|
173
|
+
},
|
174
|
+
storage: args.storage,
|
175
|
+
});
|
176
|
+
if (!migrationResponse.ok) {
|
177
|
+
throw new Error(
|
178
|
+
`Failed to migrate to enclave wallet: ${JSON.stringify(
|
179
|
+
await migrationResponse.json(),
|
180
|
+
)}`,
|
181
|
+
);
|
182
|
+
}
|
183
|
+
const migrationResult = (await migrationResponse.json()) as UserWallet;
|
184
|
+
return migrationResult;
|
185
|
+
}
|
@@ -40,7 +40,7 @@ export async function getExistingUserAccount(args: {
|
|
40
40
|
});
|
41
41
|
}
|
42
42
|
|
43
|
-
async function getWalletPrivateKeyFromShares(shares: string[]) {
|
43
|
+
export async function getWalletPrivateKeyFromShares(shares: string[]) {
|
44
44
|
const { secrets } = await import("./sss.js");
|
45
45
|
let privateKeyHex = secrets.combine(shares, 0);
|
46
46
|
if (!isHex(privateKeyHex)) {
|
@@ -86,7 +86,7 @@ async function getAccountFromShares(args: {
|
|
86
86
|
* @returns The requested shares
|
87
87
|
* @throws if attempting to get deviceShare when it's not present
|
88
88
|
*/
|
89
|
-
async function getShares<
|
89
|
+
export async function getShares<
|
90
90
|
A extends boolean,
|
91
91
|
D extends boolean,
|
92
92
|
R extends boolean,
|
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
2
2
|
import { stringify } from "../../../utils/json.js";
|
3
3
|
import { nativeLocalStorage } from "../../../utils/storage/nativeStorage.js";
|
4
4
|
import type { Account } from "../../interfaces/wallet.js";
|
5
|
+
import { getUserStatus } from "../core/actions/get-enclave-user-status.js";
|
5
6
|
import { authEndpoint } from "../core/authentication/authEndpoint.js";
|
6
7
|
import { ClientScopedStorage } from "../core/authentication/client-scoped-storage.js";
|
7
8
|
import { guestAuthenticate } from "../core/authentication/guest.js";
|
@@ -29,7 +30,6 @@ import type { InAppConnector } from "../core/interfaces/connector.js";
|
|
29
30
|
import { EnclaveWallet } from "../core/wallet/enclave-wallet.js";
|
30
31
|
import type { Ecosystem } from "../core/wallet/types.js";
|
31
32
|
import type { IWebWallet } from "../core/wallet/web-wallet.js";
|
32
|
-
import { getUserStatus } from "../web/lib/actions/get-enclave-user-status.js";
|
33
33
|
import { sendOtp, verifyOtp } from "../web/lib/auth/otp.js";
|
34
34
|
import { deleteActiveAccount, socialAuth } from "./auth/native-auth.js";
|
35
35
|
import { logoutUser } from "./helpers/auth/logout.js";
|
@@ -44,60 +44,95 @@ type NativeConnectorOptions = {
|
|
44
44
|
export class InAppNativeConnector implements InAppConnector {
|
45
45
|
private client: ThirdwebClient;
|
46
46
|
private ecosystem?: Ecosystem;
|
47
|
+
private storage: ClientScopedStorage;
|
47
48
|
private passkeyDomain?: string;
|
48
|
-
private localStorage: ClientScopedStorage;
|
49
49
|
private wallet?: IWebWallet;
|
50
50
|
|
51
51
|
constructor(options: NativeConnectorOptions) {
|
52
52
|
this.client = options.client;
|
53
|
-
this.ecosystem = options.ecosystem;
|
54
53
|
this.passkeyDomain = options.passkeyDomain;
|
55
|
-
this.
|
54
|
+
this.ecosystem = options.ecosystem;
|
55
|
+
this.storage = new ClientScopedStorage({
|
56
56
|
storage: nativeLocalStorage,
|
57
57
|
clientId: this.client.clientId,
|
58
|
-
|
58
|
+
ecosystem: options.ecosystem,
|
59
59
|
});
|
60
60
|
}
|
61
61
|
|
62
|
-
async initializeWallet(
|
63
|
-
|
64
|
-
|
62
|
+
async initializeWallet(
|
63
|
+
authResult?: AuthStoredTokenWithCookieReturnType,
|
64
|
+
encryptionKey?: string,
|
65
|
+
) {
|
66
|
+
const storedAuthToken = await this.storage.getAuthCookie();
|
67
|
+
if (!authResult && storedAuthToken === null) {
|
65
68
|
throw new Error(
|
66
69
|
"No auth token provided and no stored auth token found to initialize the wallet",
|
67
70
|
);
|
68
71
|
}
|
69
72
|
const user = await getUserStatus({
|
70
|
-
authToken:
|
73
|
+
authToken:
|
74
|
+
authResult?.storedToken.cookieString || (storedAuthToken as string),
|
71
75
|
client: this.client,
|
72
|
-
ecosystem: this.ecosystem,
|
76
|
+
ecosystem: this.storage.ecosystem,
|
73
77
|
});
|
74
78
|
if (!user) {
|
75
79
|
throw new Error("Cannot initialize wallet, no user logged in");
|
76
80
|
}
|
77
|
-
|
78
|
-
|
81
|
+
let wallet = user.wallets[0];
|
82
|
+
|
83
|
+
// TODO (enclaves): Migration to enclave wallet for in-app wallets as well
|
84
|
+
if (
|
85
|
+
authResult &&
|
86
|
+
this.storage.ecosystem &&
|
87
|
+
wallet &&
|
88
|
+
wallet.type === "sharded"
|
89
|
+
) {
|
90
|
+
const { migrateToEnclaveWallet } = await import(
|
91
|
+
"./helpers/wallet/migration.js"
|
92
|
+
);
|
93
|
+
wallet = await migrateToEnclaveWallet({
|
94
|
+
client: this.client,
|
95
|
+
storage: this.storage,
|
96
|
+
storedToken: authResult.storedToken,
|
97
|
+
encryptionKey,
|
98
|
+
});
|
99
|
+
}
|
100
|
+
|
101
|
+
if (authResult && this.ecosystem && !wallet) {
|
102
|
+
// new ecosystem user, generate enclave wallet
|
103
|
+
// TODO (enclaves): same flow for in-app wallets
|
104
|
+
const { generateWallet } = await import(
|
105
|
+
"../core/actions/generate-wallet.enclave.js"
|
106
|
+
);
|
107
|
+
wallet = await generateWallet({
|
108
|
+
authToken: authResult.storedToken.cookieString,
|
109
|
+
client: this.client,
|
110
|
+
ecosystem: this.ecosystem,
|
111
|
+
});
|
112
|
+
}
|
113
|
+
|
79
114
|
if (wallet && wallet.type === "enclave") {
|
80
115
|
this.wallet = new EnclaveWallet({
|
81
116
|
client: this.client,
|
82
117
|
ecosystem: this.ecosystem,
|
83
118
|
address: wallet.address,
|
84
|
-
storage: this.
|
119
|
+
storage: this.storage,
|
85
120
|
});
|
86
121
|
} else {
|
87
122
|
this.wallet = new ShardedWallet({
|
88
123
|
client: this.client,
|
89
|
-
storage: this.
|
124
|
+
storage: this.storage,
|
90
125
|
});
|
91
126
|
}
|
92
127
|
}
|
93
128
|
|
94
129
|
async getUser(): Promise<GetUser> {
|
95
130
|
if (!this.wallet) {
|
96
|
-
const localAuthToken = await this.
|
131
|
+
const localAuthToken = await this.storage.getAuthCookie();
|
97
132
|
if (!localAuthToken) {
|
98
133
|
return { status: "Logged Out" };
|
99
134
|
}
|
100
|
-
await this.initializeWallet(
|
135
|
+
await this.initializeWallet();
|
101
136
|
}
|
102
137
|
if (!this.wallet) {
|
103
138
|
throw new Error("Wallet not initialized");
|
@@ -164,13 +199,13 @@ export class InAppNativeConnector implements InAppConnector {
|
|
164
199
|
return customJwt({
|
165
200
|
jwt: params.jwt,
|
166
201
|
client: this.client,
|
167
|
-
storage: this.
|
202
|
+
storage: this.storage,
|
168
203
|
});
|
169
204
|
case "auth_endpoint":
|
170
205
|
return authEndpoint({
|
171
206
|
payload: params.payload,
|
172
207
|
client: this.client,
|
173
|
-
storage: this.
|
208
|
+
storage: this.storage,
|
174
209
|
});
|
175
210
|
default:
|
176
211
|
throw new Error(`Unsupported authentication type: ${strategy}`);
|
@@ -185,17 +220,16 @@ export class InAppNativeConnector implements InAppConnector {
|
|
185
220
|
client: this.client,
|
186
221
|
ecosystem: this.ecosystem,
|
187
222
|
});
|
188
|
-
await this.initializeWallet(authResult.storedToken.cookieString);
|
189
|
-
if (!this.wallet) {
|
190
|
-
throw new Error("Wallet not initialized");
|
191
|
-
}
|
192
223
|
const encryptionKey =
|
193
224
|
params.strategy === "jwt"
|
194
225
|
? params.encryptionKey
|
195
226
|
: params.strategy === "auth_endpoint"
|
196
227
|
? params.encryptionKey
|
197
228
|
: undefined;
|
198
|
-
|
229
|
+
await this.initializeWallet(authResult, encryptionKey);
|
230
|
+
if (!this.wallet) {
|
231
|
+
throw new Error("Wallet not initialized");
|
232
|
+
}
|
199
233
|
await this.wallet.postWalletSetUp({
|
200
234
|
...authResult,
|
201
235
|
encryptionKey,
|
@@ -226,7 +260,7 @@ export class InAppNativeConnector implements InAppConnector {
|
|
226
260
|
storeLastUsedPasskey = true,
|
227
261
|
} = args;
|
228
262
|
const domain = this.passkeyDomain;
|
229
|
-
const storage = this.
|
263
|
+
const storage = this.storage;
|
230
264
|
if (!domain) {
|
231
265
|
throw new Error(
|
232
266
|
"Passkey domain is required for native platforms. Please pass it in the 'auth' options when creating the inAppWallet().",
|
@@ -278,14 +312,14 @@ export class InAppNativeConnector implements InAppConnector {
|
|
278
312
|
async deleteActiveAccount() {
|
279
313
|
return deleteActiveAccount({
|
280
314
|
client: this.client,
|
281
|
-
storage: this.
|
315
|
+
storage: this.storage,
|
282
316
|
});
|
283
317
|
}
|
284
318
|
|
285
319
|
logout(): Promise<LogoutReturnType> {
|
286
320
|
return logoutUser({
|
287
321
|
client: this.client,
|
288
|
-
storage: this.
|
322
|
+
storage: this.storage,
|
289
323
|
});
|
290
324
|
}
|
291
325
|
|
@@ -294,7 +328,7 @@ export class InAppNativeConnector implements InAppConnector {
|
|
294
328
|
return await linkAccount({
|
295
329
|
client: args.client,
|
296
330
|
tokenToLink: storedToken.cookieString,
|
297
|
-
storage: this.
|
331
|
+
storage: this.storage,
|
298
332
|
ecosystem: args.ecosystem || this.ecosystem,
|
299
333
|
});
|
300
334
|
}
|
@@ -303,7 +337,7 @@ export class InAppNativeConnector implements InAppConnector {
|
|
303
337
|
return getLinkedProfilesInternal({
|
304
338
|
client: this.client,
|
305
339
|
ecosystem: this.ecosystem,
|
306
|
-
storage: this.
|
340
|
+
storage: this.storage,
|
307
341
|
});
|
308
342
|
}
|
309
343
|
}
|
@@ -1,4 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
2
|
+
import { generateWallet } from "../../../core/actions/generate-wallet.enclave.js";
|
3
|
+
import { getUserStatus } from "../../../core/actions/get-enclave-user-status.js";
|
2
4
|
import type { ClientScopedStorage } from "../../../core/authentication/client-scoped-storage.js";
|
3
5
|
import type {
|
4
6
|
AuthAndWalletRpcReturnType,
|
@@ -10,8 +12,6 @@ import type {
|
|
10
12
|
import type { Ecosystem } from "../../../core/wallet/types.js";
|
11
13
|
import type { ClientIdWithQuerierType } from "../../types.js";
|
12
14
|
import type { InAppWalletIframeCommunicator } from "../../utils/iFrameCommunication/InAppWalletIframeCommunicator.js";
|
13
|
-
import { generateWallet } from "../actions/generate-wallet.enclave.js";
|
14
|
-
import { getUserStatus } from "../actions/get-enclave-user-status.js";
|
15
15
|
import { BaseLogin } from "./base-login.js";
|
16
16
|
|
17
17
|
export type AuthQuerierTypes = {
|
@@ -86,7 +86,7 @@ export async function hasStoredPasskey(
|
|
86
86
|
const storage = new ClientScopedStorage({
|
87
87
|
storage: webLocalStorage, // TODO (passkey) react native variant of this fn
|
88
88
|
clientId: client.clientId,
|
89
|
-
ecosystemId: ecosystemId,
|
89
|
+
ecosystem: ecosystemId ? { id: ecosystemId } : undefined,
|
90
90
|
});
|
91
91
|
const credId = await storage.getPasskeyCredentialId();
|
92
92
|
return !!credId;
|