diff --git a/examples/delegated-access/CHANGELOG.md b/examples/delegated-access/CHANGELOG.md index 07abc89b2..cac94d52e 100644 --- a/examples/delegated-access/CHANGELOG.md +++ b/examples/delegated-access/CHANGELOG.md @@ -36,8 +36,36 @@ ### Patch Changes -- Updated dependencies [[`5d8be2d`](https://github.com/tkhq/sdk/commit/5d8be2d0329070c7aa025dddb1b28f04257ae4e6)]: - - @turnkey/sdk-server@4.7.0 +- Updated dependencies []: + - @turnkey/sdk-server@4.7.0-beta.1 + +## 0.0.15-beta.3 + +### Patch Changes + +- Updated dependencies []: + - @turnkey/sdk-server@4.7.0-beta.0 + +## 0.0.15-beta.2 + +### Patch Changes + +- Updated dependencies []: + - @turnkey/sdk-server@4.5.1-beta.2 + +## 0.0.15-beta.1 + +### Patch Changes + +- Updated dependencies []: + - @turnkey/sdk-server@4.5.1-beta.1 + +## 0.0.15-beta.0 + +### Patch Changes + +- Updated dependencies []: + - @turnkey/sdk-server@4.5.1-beta.0 ## 0.0.15-beta.4 diff --git a/examples/react-components/src/app/dashboard/OnRamp.tsx b/examples/react-components/src/app/dashboard/OnRamp.tsx index 1ddb12f9c..fdc580fb8 100644 --- a/examples/react-components/src/app/dashboard/OnRamp.tsx +++ b/examples/react-components/src/app/dashboard/OnRamp.tsx @@ -13,12 +13,21 @@ interface OnRampProps { ethAddress: string; } +type DisplayOption = "iframe" | "popup" | "newTab"; + +const displayOptions = ["iframe", "popup", "newTab"] as const; + export const OnRamp = ({ ethAddress }: OnRampProps) => { const { turnkey, indexedDbClient } = useTurnkey(); - const [isSignModalOpen, setSignModalOpen] = useState(false); + const [isOnrampModalOpen, setIsOnrampModalOpen] = useState(false); + const [onrampDisplayOption, setOnrampDisplayOption] = + useState("popup"); + + const [moonpayUrl, setMoonpayUrl] = useState(null); + const [coinbaseUrl, setCoinbaseUrl] = useState(null); - const handleModalOpen = () => setSignModalOpen(true); - const handleModalClose = () => setSignModalOpen(false); + const handleModalOpen = () => setIsOnrampModalOpen(true); + const handleModalClose = () => setIsOnrampModalOpen(false); const generateCoinbaseUrl = async () => { try { @@ -39,11 +48,20 @@ export const OnRamp = ({ ethAddress }: OnRampProps) => { }); if (response?.onRampUrl) { - window.open( - response.onRampUrl, - "_blank", - "popup,width=500,height=700,scrollbars=yes,resizable=yes", - ); + if (onrampDisplayOption === "iframe") { + setCoinbaseUrl(response.onRampUrl); + return; + } else if (onrampDisplayOption === "popup") { + window.open( + response.onRampUrl, + "_blank", + "popup,width=500,height=700,scrollbars=yes,resizable=yes", + ); + return; + } else if (onrampDisplayOption === "newTab") { + window.open(response.onRampUrl, "_blank", "noopener,noreferrer"); + return; + } } } catch (error) { console.error("Failed to init Coinbase on-ramp:", error); @@ -67,11 +85,20 @@ export const OnRamp = ({ ethAddress }: OnRampProps) => { }); if (response?.onRampUrl) { - window.open( - response.onRampUrl, - "_blank", - "popup,width=500,height=700,scrollbars=yes,resizable=yes", - ); + if (onrampDisplayOption === "iframe") { + setMoonpayUrl(response.onRampUrl); + return; + } else if (onrampDisplayOption === "popup") { + window.open( + response.onRampUrl, + "_blank", + "popup,width=500,height=700,scrollbars=yes,resizable=yes", + ); + return; + } else if (onrampDisplayOption === "newTab") { + window.open(response.onRampUrl, "_blank", "noopener,noreferrer"); + return; + } } } catch (error) { console.error("Failed to init MoonPay on-ramp:", error); @@ -96,7 +123,7 @@ export const OnRamp = ({ ethAddress }: OnRampProps) => { Add Funds - + { Your crypto will be deposited directly into your Turnkey wallet + {displayOptions.map((displayOption) => { + const id = `plan-${displayOption}`; + return ( + + ); + })}
+ {moonpayUrl && ( + + )}
diff --git a/examples/react-components/src/app/dashboard/page.tsx b/examples/react-components/src/app/dashboard/page.tsx index 7a8977760..37f07f4e8 100644 --- a/examples/react-components/src/app/dashboard/page.tsx +++ b/examples/react-components/src/app/dashboard/page.tsx @@ -45,9 +45,6 @@ import Navbar from "../components/Navbar"; import { Toaster, toast } from "sonner"; import { jwtDecode } from "jwt-decode"; import { useSessionExpiry } from "../providers/SessionExpiryProvider"; -import { MoonPayBuyWidget } from "@moonpay/moonpay-react"; -import { loadMoonPay } from "@moonpay/moonpay-js"; -import crypto from "crypto"; import { OnRamp } from "./OnRamp"; diff --git a/examples/react-wallet-kit/package.json b/examples/react-wallet-kit/package.json index 25f209874..9056833fd 100644 --- a/examples/react-wallet-kit/package.json +++ b/examples/react-wallet-kit/package.json @@ -19,6 +19,7 @@ "@fortawesome/react-fontawesome": "^0.2.2", "@headlessui/react": "^2.2.4", "@hello-pangea/dnd": "^17.0.0", + "@moonpay/moonpay-js": "^0.7.0", "@noble/hashes": "1.4.0", "@react-three/drei": "^10.6.1", "@react-three/fiber": "^8.18.0", diff --git a/examples/react-wallet-kit/public/coinbase.png b/examples/react-wallet-kit/public/coinbase.png new file mode 100644 index 000000000..4f86621ba Binary files /dev/null and b/examples/react-wallet-kit/public/coinbase.png differ diff --git a/examples/react-wallet-kit/public/coinbase.svg b/examples/react-wallet-kit/public/coinbase.svg new file mode 100644 index 000000000..8ff71fe83 --- /dev/null +++ b/examples/react-wallet-kit/public/coinbase.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/examples/react-wallet-kit/public/moonpay.jpg b/examples/react-wallet-kit/public/moonpay.jpg new file mode 100644 index 000000000..6f56b7a81 Binary files /dev/null and b/examples/react-wallet-kit/public/moonpay.jpg differ diff --git a/examples/react-wallet-kit/public/moonpay.svg b/examples/react-wallet-kit/public/moonpay.svg new file mode 100644 index 000000000..d0789adf2 --- /dev/null +++ b/examples/react-wallet-kit/public/moonpay.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/examples/react-wallet-kit/src/components/Svg.tsx b/examples/react-wallet-kit/src/components/Svg.tsx index e8fe300bf..8bde732dd 100644 --- a/examples/react-wallet-kit/src/components/Svg.tsx +++ b/examples/react-wallet-kit/src/components/Svg.tsx @@ -348,3 +348,46 @@ export function ImportSVG(props: SVGProps) { ); } + +export function MoonPaySVG(props: SVGProps) { + return ( + + + + + + + + + + + + + + + + ); +} + +export function CoinbaseSVG(props: SVGProps) { + return ( + + + + ); +} diff --git a/examples/react-wallet-kit/src/components/demo/DemoPanel.tsx b/examples/react-wallet-kit/src/components/demo/DemoPanel.tsx index 6ff9fa4bb..b07cbb604 100644 --- a/examples/react-wallet-kit/src/components/demo/DemoPanel.tsx +++ b/examples/react-wallet-kit/src/components/demo/DemoPanel.tsx @@ -40,6 +40,7 @@ import { } from "@/utils"; import SignatureVerification from "./SignatureVerification"; import Image from "next/image"; +import OnrampSelector from "./OnrampSelector"; export default function DemoPanel() { const { @@ -361,6 +362,26 @@ export default function DemoPanel() { > Sign Message + + + {selectedWallet?.source === WalletSource.Embedded && ( <>
diff --git a/examples/react-wallet-kit/src/components/demo/OnrampSelector.tsx b/examples/react-wallet-kit/src/components/demo/OnrampSelector.tsx new file mode 100644 index 000000000..6b3982517 --- /dev/null +++ b/examples/react-wallet-kit/src/components/demo/OnrampSelector.tsx @@ -0,0 +1,350 @@ +"use client"; + +import { useEffect, useRef, useState } from "react"; +import { Button, RadioGroup, Radio } from "@headlessui/react"; +import { useTurnkey, WalletAccount } from "@turnkey/react-wallet-kit"; + +import { + FiatOnRampBlockchainNetwork, + FiatOnRampCryptoCurrency, + FiatOnRampCurrency, + FiatOnRampPaymentMethod, + FiatOnRampProvider, +} from "@turnkey/sdk-types"; +import { loadMoonPay } from "@moonpay/moonpay-js"; +import { CoinbaseSVG, MoonPaySVG } from "../Svg"; +import { toast } from "react-toastify"; + +type FiatCurrency = { + /** The identifier of the fiat currency */ + id: string; + /** The human readable name of the currency such as "US Dollar" */ + name: string; + /** The code of the currency such as "usd" */ + code: string; +}; +/** Represents a Crypto currency such as ETH */ +type CryptoCurrency = { + /** The identifier of the crypto currency */ + id: string; + /** The human readable name of the currency such as "Ethereum" */ + name: string; + /** The code of the currency such as "eth" */ + code: string; + /** The address location of the token contract on the blockchain */ + contractAddress: string | null; + /** The chain's Chain ID */ + chainId: string | null; + /** The coin type as defined in SLIP-0044 */ + coinType: string | null; + /** The currency's network such as "bitcoin" or "ethereum" */ + networkCode: string | null; +}; +type TransactionStatus = + | "completed" + | "failed" + | "pending" + | "waitingAuthorization" + | "waitingPayment"; + +type OnTransactionCompletedProps = { + /** The identifier of the transaction */ + id: string; + /** When the transaction was created */ + createdAt: string; + /** The base (fiat) currency */ + baseCurrency: FiatCurrency; + /** The quote (crypto) currency */ + quoteCurrency: CryptoCurrency; + /** The spent fiat amount */ + baseCurrencyAmount: number; + /** The expected or received quote amount */ + quoteCurrencyAmount: number; + /** The MoonPay fee amount, in the fiat currency */ + feeAmount: number; + /** The partner's fee amount, in the fiat currency */ + extraFeeAmount: number; + /** The network fees incurred in this transaction, in the fiat currency */ + networkFeeAmount: number; + /** Whether the base currency amount includes fees */ + areFeesIncluded: boolean; + /** The customer's destination wallet address */ + walletAddress: string; + /** The customer's destination wallet address tag */ + walletAddressTag: string | null; + /** The current status of the transaction */ + status: TransactionStatus; +}; + +type DisplayOption = "iframe" | "popup" | "new tab"; +const displayOptions = ["iframe", "popup", "new tab"] as const; + +export default function OnrampSelector({ + selectedWalletAccount, +}: { + selectedWalletAccount: WalletAccount; +}) { + const { initFiatOnramp, session } = useTurnkey(); + + const [blockchainNetwork, setBlockchainNetwork] = + useState(FiatOnRampBlockchainNetwork.ETHEREUM); + const [cryptoCurrency, setCryptoCurrency] = + useState(FiatOnRampCryptoCurrency.ETHEREUM); + const [cryptoCurrencyCode, setCryptoCurrencyCode] = useState("eth"); + + const [onrampDisplayOption, setOnrampDisplayOption] = + useState("popup"); + + useEffect(() => { + console.log("Selected wallet account changed:", selectedWalletAccount); + switch (selectedWalletAccount?.addressFormat) { + case "ADDRESS_FORMAT_SOLANA": + setBlockchainNetwork(FiatOnRampBlockchainNetwork.SOLANA); + setCryptoCurrency(FiatOnRampCryptoCurrency.SOLANA); + setCryptoCurrencyCode("sol"); + break; + case "ADDRESS_FORMAT_BITCOIN_MAINNET_P2PKH": + case "ADDRESS_FORMAT_BITCOIN_MAINNET_P2SH": + case "ADDRESS_FORMAT_BITCOIN_MAINNET_P2WPKH": + case "ADDRESS_FORMAT_BITCOIN_MAINNET_P2WSH": + case "ADDRESS_FORMAT_BITCOIN_MAINNET_P2TR": + setBlockchainNetwork(FiatOnRampBlockchainNetwork.BITCOIN); + setCryptoCurrency(FiatOnRampCryptoCurrency.BITCOIN); + setCryptoCurrencyCode("btc"); + break; + case "ADDRESS_FORMAT_ETHEREUM": + default: + setBlockchainNetwork(FiatOnRampBlockchainNetwork.ETHEREUM); + setCryptoCurrency(FiatOnRampCryptoCurrency.ETHEREUM); + setCryptoCurrencyCode("eth"); + break; + } + }, []); + + // Controls whether the SDK container is visible + const [showMoonpayIframe, setShowMoonpayIframe] = useState(false); + const moonpaySdkRef = useRef(null); + + const handleOnrampSuccess = async (payload: OnTransactionCompletedProps) => { + console.log("Onramp success:", payload); + toast.success("Onramp completed successfully!"); + }; + + const handleOnrampError = async (errorMessage: string) => { + console.log("Onramp error:", errorMessage); + toast.error("Onramp failed. Please try again."); + }; + + const generateCoinbase = async () => { + if (!session) { + console.error("Session not found"); + return; + } + try { + const res = await initFiatOnramp({ + organizationId: session.organizationId!, + onrampProvider: FiatOnRampProvider.COINBASE, + walletAddress: selectedWalletAccount.address, + network: blockchainNetwork, + cryptoCurrencyCode: cryptoCurrency, + fiatCurrencyCode: FiatOnRampCurrency.USD, + fiatCurrencyAmount: "10", + paymentMethod: FiatOnRampPaymentMethod.CREDIT_DEBIT_CARD, + countryCode: "US", + countrySubdivisionCode: "ME", + sandboxMode: true, + }); + + if (!res?.onRampUrl) return; + + if (onrampDisplayOption === "popup") { + window.open( + res.onRampUrl, + "_blank", + "popup,width=500,height=700,scrollbars=yes,resizable=yes", + ); + } else if (onrampDisplayOption === "new tab") { + window.open(res.onRampUrl, "_blank", "noopener,noreferrer"); + } + } catch (err) { + console.error("Failed to init Coinbase on-ramp:", err); + } + }; + + const generateMoonPay = async () => { + if (!session) { + console.error("Session not found"); + return; + } + + const baseRequest = { + organizationId: session.organizationId!, + onrampProvider: FiatOnRampProvider.MOONPAY, + walletAddress: selectedWalletAccount.address, + network: blockchainNetwork, + cryptoCurrencyCode: cryptoCurrency, + fiatCurrencyCode: FiatOnRampCurrency.USD, + fiatCurrencyAmount: "10", + paymentMethod: FiatOnRampPaymentMethod.CREDIT_DEBIT_CARD, + sandboxMode: true, + } as const; + + try { + if (onrampDisplayOption === "iframe") { + try { + moonpaySdkRef.current?.close?.(); + } catch {} + moonpaySdkRef.current = null; + + setShowMoonpayIframe(true); + + await Promise.resolve(); + + const moonPay = await loadMoonPay(); + if (!moonPay) throw new Error("MoonPay SDK failed to load"); + + const sdkParams = { + apiKey: process.env.NEXT_PUBLIC_MOONPAY_API_KEY!, + currencyCode: cryptoCurrencyCode, + baseCurrencyAmount: "10", + walletAddress: selectedWalletAccount.address, + paymentMethod: "credit_debit_card", + } as const; + + const sdk = moonPay({ + flow: "buy", + environment: "sandbox", + variant: "embedded", + containerNodeSelector: "#moonpay-container", + params: sdkParams as any, + handlers: { + onClose: async () => { + console.log("onClose"); + setShowMoonpayIframe(false); + try { + moonpaySdkRef.current?.close?.(); + } catch {} + moonpaySdkRef.current = null; + }, + onLogin: async (payload) => console.log("onLogin", payload), + onTransactionCreated: async (payload) => + console.log("onTransactionCreated", payload), + onTransactionCompleted: async (payload) => { + handleOnrampSuccess(payload); + setShowMoonpayIframe(false); + }, + onUnsupportedRegion: async () => { + handleOnrampError("Unsupported region"); + }, + }, + }); + moonpaySdkRef.current = sdk; + + const urlForSignature = sdk?.generateUrlForSigning(); + + const res = await initFiatOnramp({ + ...baseRequest, + urlForSignature, + } as any); + + if (!res?.onRampUrlSignature) { + throw new Error("Backend did not return onRampUrlSignature"); + } + + sdk?.updateSignature(res.onRampUrlSignature); + sdk?.show(); + return; + } + + const res = await initFiatOnramp(baseRequest as any); + if (!res?.onRampUrl) return; + + if (onrampDisplayOption === "popup") { + window.open( + res.onRampUrl, + "_blank", + "popup,width=500,height=700,scrollbars=yes,resizable=yes", + ); + } else if (onrampDisplayOption === "new tab") { + window.open(res.onRampUrl, "_blank", "noopener,noreferrer"); + } + } catch (err) { + console.error("Failed to init MoonPay on-ramp:", err); + setShowMoonpayIframe(false); + try { + moonpaySdkRef.current?.close?.(); + } catch {} + moonpaySdkRef.current = null; + } + }; + + // Cleanup MoonPay SDK on unmount + useEffect(() => { + return () => { + try { + moonpaySdkRef.current?.close?.(); + } catch {} + moonpaySdkRef.current = null; + }; + }, []); + + return ( + <> + {onrampDisplayOption === "iframe" && showMoonpayIframe && ( +
+ )} + + {!showMoonpayIframe && ( +
+
+

+ Your crypto will be deposited directly into your Turnkey wallet +

+ + Onramp Widget Display Option + +
+ {displayOptions.map((opt) => ( + + {opt} + + ))} +
+
+ +
+ + + {onrampDisplayOption !== "iframe" && ( + + )} +
+
+
+ )} + + ); +} diff --git a/examples/react-wallet-kit/tsconfig.json b/examples/react-wallet-kit/tsconfig.json index 06f3d9aad..e8cabc2ff 100644 --- a/examples/react-wallet-kit/tsconfig.json +++ b/examples/react-wallet-kit/tsconfig.json @@ -25,5 +25,5 @@ } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] + "exclude": ["node_modules", ".next/**"] } diff --git a/generated-docs/changelogs/api-key-stamper/readme.mdx b/generated-docs/changelogs/api-key-stamper/readme.mdx index 6527c4842..e61cb5927 100644 --- a/generated-docs/changelogs/api-key-stamper/readme.mdx +++ b/generated-docs/changelogs/api-key-stamper/readme.mdx @@ -139,4 +139,4 @@ mode: wide ## 0.1.0 -Initial release \ No newline at end of file +Initial release diff --git a/generated-docs/changelogs/core/readme.mdx b/generated-docs/changelogs/core/readme.mdx index 04202b290..6e475f84e 100644 --- a/generated-docs/changelogs/core/readme.mdx +++ b/generated-docs/changelogs/core/readme.mdx @@ -148,4 +148,4 @@ mode: wide - @turnkey/api-key-stamper@0.4.8 - @turnkey/crypto@2.5.1 - @turnkey/http@3.8.1 - - @turnkey/react-native-passkey-stamper@1.1.2 \ No newline at end of file + - @turnkey/react-native-passkey-stamper@1.1.2 diff --git a/generated-docs/changelogs/cosmjs/readme.mdx b/generated-docs/changelogs/cosmjs/readme.mdx index ef0a975ac..a57efe0bc 100644 --- a/generated-docs/changelogs/cosmjs/readme.mdx +++ b/generated-docs/changelogs/cosmjs/readme.mdx @@ -796,4 +796,4 @@ mode: wide ## 0.1.0 -- Initial release \ No newline at end of file +- Initial release diff --git a/generated-docs/changelogs/crypto/readme.mdx b/generated-docs/changelogs/crypto/readme.mdx index d467bf60e..fb9e11297 100644 --- a/generated-docs/changelogs/crypto/readme.mdx +++ b/generated-docs/changelogs/crypto/readme.mdx @@ -179,4 +179,4 @@ mode: wide ## 0.1.0 -Initial release \ No newline at end of file +Initial release diff --git a/generated-docs/changelogs/eip-1193-provider/readme.mdx b/generated-docs/changelogs/eip-1193-provider/readme.mdx index 700d8b051..07d07c9e3 100644 --- a/generated-docs/changelogs/eip-1193-provider/readme.mdx +++ b/generated-docs/changelogs/eip-1193-provider/readme.mdx @@ -510,4 +510,4 @@ mode: wide ## 0.1.0 -Initial release! \ No newline at end of file +Initial release! diff --git a/generated-docs/changelogs/encoding/readme.mdx b/generated-docs/changelogs/encoding/readme.mdx index e20d43184..da63b0aca 100644 --- a/generated-docs/changelogs/encoding/readme.mdx +++ b/generated-docs/changelogs/encoding/readme.mdx @@ -79,4 +79,4 @@ mode: wide ## 0.1.0 -Initial release \ No newline at end of file +Initial release diff --git a/generated-docs/changelogs/ethers/readme.mdx b/generated-docs/changelogs/ethers/readme.mdx index c51824ac8..030fc064f 100644 --- a/generated-docs/changelogs/ethers/readme.mdx +++ b/generated-docs/changelogs/ethers/readme.mdx @@ -856,7 +856,7 @@ const turnkeyClient = new TurnkeyClient( new ApiKeyStamper({ apiPublicKey: "...", apiPrivateKey: "...", - }), + }) ); // Initialize a Turnkey Signer @@ -1199,4 +1199,4 @@ const turnkeySigner = new TurnkeySigner({ - Initial release - Updated dependencies - - @turnkey/http@0.1.1 \ No newline at end of file + - @turnkey/http@0.1.1 diff --git a/generated-docs/changelogs/http/readme.mdx b/generated-docs/changelogs/http/readme.mdx index 2eb28405f..edae8a888 100644 --- a/generated-docs/changelogs/http/readme.mdx +++ b/generated-docs/changelogs/http/readme.mdx @@ -818,4 +818,4 @@ Signing is now performed through Turnkey stampers. New dependencies: - Initial release - Updated dependencies - - @turnkey/jest-config@0.1.1 \ No newline at end of file + - @turnkey/jest-config@0.1.1 diff --git a/generated-docs/changelogs/react-native-passkey-stamper/readme.mdx b/generated-docs/changelogs/react-native-passkey-stamper/readme.mdx index 7012551cf..61fbd2739 100644 --- a/generated-docs/changelogs/react-native-passkey-stamper/readme.mdx +++ b/generated-docs/changelogs/react-native-passkey-stamper/readme.mdx @@ -374,4 +374,4 @@ This is a major change because the `transports` property, previously a string ar ## 0.1.0 -Initial release \ No newline at end of file +Initial release diff --git a/generated-docs/changelogs/react-wallet-kit/readme.mdx b/generated-docs/changelogs/react-wallet-kit/readme.mdx index f851bc687..4f6b36c69 100644 --- a/generated-docs/changelogs/react-wallet-kit/readme.mdx +++ b/generated-docs/changelogs/react-wallet-kit/readme.mdx @@ -112,4 +112,4 @@ mode: wide - Updated dependencies []: - @turnkey/core@1.0.0 - - @turnkey/sdk-types@0.4.0 \ No newline at end of file + - @turnkey/sdk-types@0.4.0 diff --git a/generated-docs/changelogs/sdk-browser/readme.mdx b/generated-docs/changelogs/sdk-browser/readme.mdx index 227d5b771..99248ce90 100644 --- a/generated-docs/changelogs/sdk-browser/readme.mdx +++ b/generated-docs/changelogs/sdk-browser/readme.mdx @@ -948,4 +948,4 @@ These enhancements simplify integrations, improve UX, and deliver a more robust ## 0.0.1 -Initial (experimental) release! This is an alpha release and subject to change. \ No newline at end of file +Initial (experimental) release! This is an alpha release and subject to change. diff --git a/generated-docs/changelogs/sdk-react-native/readme.mdx b/generated-docs/changelogs/sdk-react-native/readme.mdx index 92231ca8b..543bf079b 100644 --- a/generated-docs/changelogs/sdk-react-native/readme.mdx +++ b/generated-docs/changelogs/sdk-react-native/readme.mdx @@ -345,4 +345,4 @@ handleGoogleOAuth({ - Updated dependencies [3c44c4a] - @turnkey/http@2.20.0 - - @turnkey/crypto@2.3.1 \ No newline at end of file + - @turnkey/crypto@2.3.1 diff --git a/generated-docs/changelogs/sdk-react/readme.mdx b/generated-docs/changelogs/sdk-react/readme.mdx index 082b5e0ac..4e4e1bbe1 100644 --- a/generated-docs/changelogs/sdk-react/readme.mdx +++ b/generated-docs/changelogs/sdk-react/readme.mdx @@ -891,4 +891,4 @@ This release significantly enhances authentication by integrating the new `index ## 0.0.1 -Initial (experimental) release! This is an alpha release and subject to change. \ No newline at end of file +Initial (experimental) release! This is an alpha release and subject to change. diff --git a/generated-docs/changelogs/sdk-server/readme.mdx b/generated-docs/changelogs/sdk-server/readme.mdx index a80605183..99ea256f1 100644 --- a/generated-docs/changelogs/sdk-server/readme.mdx +++ b/generated-docs/changelogs/sdk-server/readme.mdx @@ -679,4 +679,4 @@ These changes standardize authentication processes, simplify integration, and st ## 0.0.1 -Initial (experimental) release! This is an alpha release and subject to change. \ No newline at end of file +Initial (experimental) release! This is an alpha release and subject to change. diff --git a/generated-docs/changelogs/solana/readme.mdx b/generated-docs/changelogs/solana/readme.mdx index 6adcbba6f..22781330a 100644 --- a/generated-docs/changelogs/solana/readme.mdx +++ b/generated-docs/changelogs/solana/readme.mdx @@ -635,4 +635,4 @@ Add support for signing Solana versioned transactions (#216) ## 0.1.0 -- Initial release \ No newline at end of file +- Initial release diff --git a/generated-docs/changelogs/telegram-cloud-storage-stamper/readme.mdx b/generated-docs/changelogs/telegram-cloud-storage-stamper/readme.mdx index 9c5de65be..3fe1d0049 100644 --- a/generated-docs/changelogs/telegram-cloud-storage-stamper/readme.mdx +++ b/generated-docs/changelogs/telegram-cloud-storage-stamper/readme.mdx @@ -127,4 +127,4 @@ mode: wide ### Major Changes -- Initial release of the telegram-cloud-storage-stamper package. This package is to be used alongside Telegram mini-app development and provides a stamping utility and an interface into Telegram Cloud Storage. More can be read in the [readme](../packages/telegram-cloud-storage-stamper/readme.md). \ No newline at end of file +- Initial release of the telegram-cloud-storage-stamper package. This package is to be used alongside Telegram mini-app development and provides a stamping utility and an interface into Telegram Cloud Storage. More can be read in the [readme](../packages/telegram-cloud-storage-stamper/readme.md). diff --git a/generated-docs/changelogs/viem/readme.mdx b/generated-docs/changelogs/viem/readme.mdx index 183a94c24..809c11fae 100644 --- a/generated-docs/changelogs/viem/readme.mdx +++ b/generated-docs/changelogs/viem/readme.mdx @@ -861,7 +861,7 @@ const httpClient = new TurnkeyClient( new ApiKeyStamper({ apiPublicKey: "...", apiPrivateKey: "...", - }), + }) ); // Create the Viem custom account @@ -944,4 +944,4 @@ const turnkeyAccount = await createAccount({ ## 0.1.0 -Initial release! \ No newline at end of file +Initial release! diff --git a/generated-docs/changelogs/wallet-stamper/readme.mdx b/generated-docs/changelogs/wallet-stamper/readme.mdx index d8de139bc..e489558b7 100644 --- a/generated-docs/changelogs/wallet-stamper/readme.mdx +++ b/generated-docs/changelogs/wallet-stamper/readme.mdx @@ -194,4 +194,4 @@ mode: wide ### Patch Changes -- 68a14dd: Initial release! 🎉 \ No newline at end of file +- 68a14dd: Initial release! 🎉 diff --git a/generated-docs/changelogs/webauthn-stamper/readme.mdx b/generated-docs/changelogs/webauthn-stamper/readme.mdx index 879b274e2..59e375ce0 100644 --- a/generated-docs/changelogs/webauthn-stamper/readme.mdx +++ b/generated-docs/changelogs/webauthn-stamper/readme.mdx @@ -62,4 +62,4 @@ mode: wide ## 0.1.0 -Initial release \ No newline at end of file +Initial release diff --git a/generated-docs/docs.json b/generated-docs/docs.json index 99bec2d4c..bbfe0027b 100644 --- a/generated-docs/docs.json +++ b/generated-docs/docs.json @@ -62,6 +62,7 @@ { "group": "Products", "pages": [ + "sdks/introduction", { "group": "Embedded wallets", "pages": [ diff --git a/generated-docs/formatted/core/turnkey-client-add-oauth-provider.mdx b/generated-docs/formatted/core/turnkey-client-add-oauth-provider.mdx index ea642a377..8c8a0d3fa 100644 --- a/generated-docs/formatted/core/turnkey-client-add-oauth-provider.mdx +++ b/generated-docs/formatted/core/turnkey-client-add-oauth-provider.mdx @@ -10,40 +10,86 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Adds an OAuth provider to the user.
    -
  • This function adds an OAuth provider (e.g., Google, Apple) to the user account.
  • -
  • If a userId is provided, it adds the provider for that specific user; otherwise, it uses the current session's userId.
  • -
  • Automatically checks if an account already exists for the provided OIDC token and prevents duplicate associations.
  • -
  • If the user's email is not set or not verified, attempts to update and verify the email using the email from the OIDC token.
  • -
  • Handles session management and error reporting for the add provider flow.
  • -
  • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
  • +
  • + This function adds an OAuth provider (e.g., Google, Apple) to the user + account. +
  • +
  • + If a userId is provided, it adds the provider for that specific user; + otherwise, it uses the current session's userId. +
  • +
  • + Automatically checks if an account already exists for the provided OIDC + token and prevents duplicate associations. +
  • +
  • + If the user's email is not set or not verified, attempts to update and + verify the email using the email from the OIDC token. +
  • +
  • + Handles session management and error reporting for the add provider flow. +
  • +
  • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:2982

+

+ Defined in:{" "} + + core.ts:2982 + +

- + - -OIDC token for the OAuth provider. - - -name of the OAuth provider to add (e.g., "Google", "Apple"). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to add the provider for a specific user (defaults to current session's userId). - + + OIDC token for the OAuth provider. + + + name of the OAuth provider to add (e.g., "Google", "Apple"). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to add the provider for a specific user (defaults to current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to an array of provider IDs associated with the user. diff --git a/generated-docs/formatted/core/turnkey-client-add-passkey.mdx b/generated-docs/formatted/core/turnkey-client-add-passkey.mdx index f931d4754..4a42710ed 100644 --- a/generated-docs/formatted/core/turnkey-client-add-passkey.mdx +++ b/generated-docs/formatted/core/turnkey-client-add-passkey.mdx @@ -10,39 +10,84 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Adds a new passkey authenticator for the user.
    -
  • This function prompts the user to create a new passkey (WebAuthn/FIDO2) and adds it as an authenticator for the user.
  • -
  • Handles both web and React Native environments, automatically selecting the appropriate passkey creation flow.
  • -
  • If a userId is provided, the passkey is added for that specific user; otherwise, it uses the current session's userId.
  • -
  • The passkey's name and display name can be customized; if not provided, defaults are generated.
  • -
  • The resulting passkey attestation and challenge are registered with Turnkey as a new authenticator.
  • +
  • + This function prompts the user to create a new passkey (WebAuthn/FIDO2) and + adds it as an authenticator for the user. +
  • +
  • + Handles both web and React Native environments, automatically selecting the + appropriate passkey creation flow. +
  • +
  • + If a userId is provided, the passkey is added for that specific user; + otherwise, it uses the current session's userId. +
  • +
  • + The passkey's name and display name can be customized; if not provided, + defaults are generated. +
  • +
  • + The resulting passkey attestation and challenge are registered with Turnkey + as a new authenticator. +
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:3141

+

+ Defined in:{" "} + + core.ts:3141 + +

- + - -display name of the passkey (defaults to the value of `name`). - - -name of the passkey (defaults to "Turnkey Passkey-`timestamp`"). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to add the passkey for a specific user (defaults to the current session's userId). - + + display name of the passkey (defaults to the value of `name`). + + + name of the passkey (defaults to "Turnkey Passkey-`timestamp`"). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to add the passkey for a specific user (defaults to the current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an array of authenticator IDs for the newly added passkey(s). + + A promise that resolves to an array of authenticator IDs for the newly added + passkey(s). diff --git a/generated-docs/formatted/core/turnkey-client-clear-all-sessions.mdx b/generated-docs/formatted/core/turnkey-client-clear-all-sessions.mdx index e6f822c40..8870f88fb 100644 --- a/generated-docs/formatted/core/turnkey-client-clear-all-sessions.mdx +++ b/generated-docs/formatted/core/turnkey-client-clear-all-sessions.mdx @@ -10,23 +10,42 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Clears all sessions and resets the active session state.
    -
  • This function removes all session data from the client and persistent storage, including all associated key pairs.
  • -
  • Iterates through all stored session keys, clearing each session and deleting its corresponding API key pair.
  • -
  • After clearing, there will be no active session, and all session-related data will be removed from local storage.
  • -
  • Throws an error if no sessions exist or if there is an error during the clearing process.
  • +
  • + This function removes all session data from the client and persistent + storage, including all associated key pairs. +
  • +
  • + Iterates through all stored session keys, clearing each session and deleting + its corresponding API key pair. +
  • +
  • + After clearing, there will be no active session, and all session-related + data will be removed from local storage. +
  • +
  • + Throws an error if no sessions exist or if there is an error during the + clearing process. +
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:3844

+

+ Defined in:{" "} + + core.ts:3844 + +

No parameters.

- -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves when all sessions are successfully cleared. diff --git a/generated-docs/formatted/core/turnkey-client-clear-session.mdx b/generated-docs/formatted/core/turnkey-client-clear-session.mdx index 718e4fa3f..c6e11c94a 100644 --- a/generated-docs/formatted/core/turnkey-client-clear-session.mdx +++ b/generated-docs/formatted/core/turnkey-client-clear-session.mdx @@ -10,29 +10,53 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Clears the session associated with the specified session key, or the active session by default.
    -
  • This function deletes the session and its associated key pair from storage.
  • -
  • If a sessionKey is provided, it will clear the session under that key; otherwise, it will clear the default (active) session.
  • -
  • Removes the session data from local storage and deletes the corresponding API key pair from the key store.
  • -
  • Throws an error if the session does not exist or if there is an error during the clearing process.
  • +
  • + This function deletes the session and its associated key pair from storage. +
  • +
  • + If a sessionKey is provided, it will clear the session under that key; + otherwise, it will clear the default (active) session. +
  • +
  • + Removes the session data from local storage and deletes the corresponding + API key pair from the key store. +
  • +
  • + Throws an error if the session does not exist or if there is an error during + the clearing process. +
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:3811

+

+ Defined in:{" "} + + core.ts:3811 + +

- + - -session key to clear the session under (defaults to the default session key). - + + session key to clear the session under (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves when the session is successfully cleared. diff --git a/generated-docs/formatted/core/turnkey-client-clear-unused-key-pairs.mdx b/generated-docs/formatted/core/turnkey-client-clear-unused-key-pairs.mdx index 1b0441c3b..cb6ebf557 100644 --- a/generated-docs/formatted/core/turnkey-client-clear-unused-key-pairs.mdx +++ b/generated-docs/formatted/core/turnkey-client-clear-unused-key-pairs.mdx @@ -10,23 +10,42 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Clears any unused API key pairs from persistent storage.
    -
  • This function scans all API key pairs stored in indexedDB and removes any key pairs that are not associated with a session in persistent storage.
  • -
  • Ensures that only key pairs referenced by existing sessions are retained, preventing orphaned or stale key pairs from accumulating.
  • -
  • Iterates through all stored session keys and builds a map of in-use public keys, then deletes any key pairs not present in this map.
  • -
  • Intended to be called after session changes (e.g., login, logout, session replacement) to keep key storage clean and secure.
  • +
  • + This function scans all API key pairs stored in indexedDB and removes any + key pairs that are not associated with a session in persistent storage. +
  • +
  • + Ensures that only key pairs referenced by existing sessions are retained, + preventing orphaned or stale key pairs from accumulating. +
  • +
  • + Iterates through all stored session keys and builds a map of in-use public + keys, then deletes any key pairs not present in this map. +
  • +
  • + Intended to be called after session changes (e.g., login, logout, session + replacement) to keep key storage clean and secure. +
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:4073

+

+ Defined in:{" "} + + core.ts:4073 + +

No parameters.

- -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves when all unused key pairs are successfully cleared. diff --git a/generated-docs/formatted/core/turnkey-client-complete-oauth.mdx b/generated-docs/formatted/core/turnkey-client-complete-oauth.mdx index b6687bd43..5e07deba4 100644 --- a/generated-docs/formatted/core/turnkey-client-complete-oauth.mdx +++ b/generated-docs/formatted/core/turnkey-client-complete-oauth.mdx @@ -10,47 +10,102 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Completes the OAuth authentication flow by either signing up or logging in the user, depending on whether a sub-organization already exists for the provided OIDC token.
    -
  • This function first checks if there is an existing sub-organization associated with the OIDC token.
  • +
  • + This function first checks if there is an existing sub-organization + associated with the OIDC token. +
  • If a sub-organization exists, it proceeds with the OAuth login flow.
  • -
  • If no sub-organization exists, it creates a new sub-organization and completes the sign-up flow.
  • -
  • Optionally accepts a custom OAuth provider name, session key, and additional sub-organization creation parameters.
  • -
  • Handles session storage and management, and supports invalidating existing sessions if specified.
  • +
  • + If no sub-organization exists, it creates a new sub-organization and + completes the sign-up flow. +
  • +
  • + Optionally accepts a custom OAuth provider name, session key, and additional + sub-organization creation parameters. +
  • +
  • + Handles session storage and management, and supports invalidating existing + sessions if specified. +
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:1528

+

+ Defined in:{" "} + + core.ts:1528 + +

- + - -parameters for sub-organization creation (e.g., authenticators, user metadata). - - -flag to invalidate existing sessions for the user. - - -OIDC token received after successful authentication with the OAuth provider. - - -name of the OAuth provider (defaults to a generated name with a timestamp). - - -public key to use for authentication. Must be generated prior to calling this function, this is because the OIDC nonce has to be set to `sha256(publicKey)`. - - -session key to use for session creation (defaults to the default session key). - + + parameters for sub-organization creation (e.g., authenticators, user + metadata). + + + flag to invalidate existing sessions for the user. + + + OIDC token received after successful authentication with the OAuth + provider. + + + name of the OAuth provider (defaults to a generated name with a + timestamp). + + + public key to use for authentication. Must be generated prior to calling + this function, this is because the OIDC nonce has to be set to + `sha256(publicKey)`. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an object containing: - - `sessionToken`: the signed JWT session token. - - `action`: whether the flow resulted in a login or signup (AuthAction). + + A promise that resolves to an object containing: - `sessionToken`: the signed + JWT session token. - `action`: whether the flow resulted in a login or signup + (AuthAction). diff --git a/generated-docs/formatted/core/turnkey-client-complete-otp.mdx b/generated-docs/formatted/core/turnkey-client-complete-otp.mdx index f432a09ee..49f0e4493 100644 --- a/generated-docs/formatted/core/turnkey-client-complete-otp.mdx +++ b/generated-docs/formatted/core/turnkey-client-complete-otp.mdx @@ -10,54 +10,116 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Completes the OTP authentication flow by verifying the OTP code and then either signing up or logging in the user.
    -
  • This function first verifies the OTP code for the provided contact and OTP type.
  • -
  • If the contact is not associated with an existing sub-organization, it will automatically create a new sub-organization and complete the sign-up flow.
  • -
  • If the contact is already associated with a sub-organization, it will complete the login flow.
  • -
  • Supports passing a custom public key for authentication, invalidating existing session, specifying a session key, and providing additional sub-organization creation parameters.
  • +
  • + This function first verifies the OTP code for the provided contact and OTP + type. +
  • +
  • + If the contact is not associated with an existing sub-organization, it will + automatically create a new sub-organization and complete the sign-up flow. +
  • +
  • + If the contact is already associated with a sub-organization, it will + complete the login flow. +
  • +
  • + Supports passing a custom public key for authentication, invalidating + existing session, specifying a session key, and providing additional + sub-organization creation parameters. +
  • Handles both email and SMS OTP types.
-

Package: core

+

+ Package: core +

-

Defined in: core.ts:1432

+

+ Defined in:{" "} + + core.ts:1432 + +

- + - -contact information for the user (e.g., email address or phone number). - - -parameters for sub-organization creation (e.g., authenticators, user metadata). - - -flag to invalidate existing sessions for the user. - - -OTP code entered by the user. - - -ID of the OTP to complete (returned from `initOtp`). - - -type of OTP being completed (OtpType.Email or OtpType.Sms). - - -public key to use for authentication. If not provided, a new key pair may be generated. - - -session key to use for session creation (defaults to the default session key). - + + contact information for the user (e.g., email address or phone number). + + + parameters for sub-organization creation (e.g., authenticators, user + metadata). + + + flag to invalidate existing sessions for the user. + + + OTP code entered by the user. + + + ID of the OTP to complete (returned from `initOtp`). + + + type of OTP being completed (OtpType.Email or OtpType.Sms). + + + public key to use for authentication. If not provided, a new key pair may + be generated. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an object containing: - - `sessionToken`: the signed JWT session token. - - `verificationToken`: the OTP verification token. - - `action`: whether the flow resulted in a login or signup (AuthAction). + + A promise that resolves to an object containing: - `sessionToken`: the signed + JWT session token. - `verificationToken`: the OTP verification token. - + `action`: whether the flow resulted in a login or signup (AuthAction). diff --git a/generated-docs/formatted/core/turnkey-client-connect-wallet-account.mdx b/generated-docs/formatted/core/turnkey-client-connect-wallet-account.mdx index 5bca3d850..cdcdad41a 100644 --- a/generated-docs/formatted/core/turnkey-client-connect-wallet-account.mdx +++ b/generated-docs/formatted/core/turnkey-client-connect-wallet-account.mdx @@ -13,19 +13,26 @@ Connects the specified wallet account.
  • Requires the wallet manager and its connector to be initialized.
  • -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:561

    +

    + Defined in:{" "} + + core.ts:561 + +

    - + wallet provider to connect. - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves once the wallet account is connected. diff --git a/generated-docs/formatted/core/turnkey-client-constructor.mdx b/generated-docs/formatted/core/turnkey-client-constructor.mdx index bf2e23b2c..3255fdbd2 100644 --- a/generated-docs/formatted/core/turnkey-client-constructor.mdx +++ b/generated-docs/formatted/core/turnkey-client-constructor.mdx @@ -5,21 +5,36 @@ title: "constructor()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:120

    +

    + Defined in:{" "} + + core.ts:120 + +

    - + - + - + - + - -A successful response returns the following fields: +A successful response returns the following +fields: diff --git a/generated-docs/formatted/core/turnkey-client-create-api-key-pair.mdx b/generated-docs/formatted/core/turnkey-client-create-api-key-pair.mdx index 2ef4a90da..4c7af3829 100644 --- a/generated-docs/formatted/core/turnkey-client-create-api-key-pair.mdx +++ b/generated-docs/formatted/core/turnkey-client-create-api-key-pair.mdx @@ -10,32 +10,62 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Creates a new API key pair and returns the public key.
      -
    • This function generates a new API key pair and stores it in the underlying key store (IndexedDB).
    • -
    • If an external key pair is provided, it will use that key pair for creation instead of generating a new one.
    • -
    • If ``storeOverride`` is set to true, the generated or provided public key will be set as the override key in the API key stamper, making it the active key for subsequent signing operations.
    • +
    • + This function generates a new API key pair and stores it in the underlying + key store (IndexedDB). +
    • +
    • + If an external key pair is provided, it will use that key pair for creation + instead of generating a new one. +
    • +
    • + If ``storeOverride`` is set to true, the generated or provided public key + will be set as the override key in the API key stamper, making it the active + key for subsequent signing operations. +
    • Ensures the API key stamper is initialized before proceeding.
    • Handles both native CryptoKeyPair objects and raw key material.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:4125

    +

    + Defined in:{" "} + + core.ts:4125 + +

    - + - -An externally generated key pair (either a CryptoKeyPair or an object with publicKey/privateKey strings) to use instead of generating a new one. - - -If true, sets the generated or provided public key as the override key in the API key stamper (defaults to false). -@returnparams.s A promise that resolves to the public key of the created or provided API key pair as a string. - + + An externally generated key pair (either a CryptoKeyPair or an object with + publicKey/privateKey strings) to use instead of generating a new one. + + + If true, sets the generated or provided public key as the override key in + the API key stamper (defaults to false). @returnparams.s A promise that + resolves to the public key of the created or provided API key pair as a + string. + - -A successful response returns the following fields: +A successful response returns the following +fields: diff --git a/generated-docs/formatted/core/turnkey-client-create-passkey.mdx b/generated-docs/formatted/core/turnkey-client-create-passkey.mdx index 4adf5a456..d728b195b 100644 --- a/generated-docs/formatted/core/turnkey-client-create-passkey.mdx +++ b/generated-docs/formatted/core/turnkey-client-create-passkey.mdx @@ -10,40 +10,84 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Creates a new passkey authenticator for the user.
      -
    • This function generates a new passkey attestation and challenge, suitable for registration with the user's device.
    • -
    • Handles both web and React Native environments, automatically selecting the appropriate passkey creation flow.
    • -
    • The resulting attestation and challenge can be used to register the passkey with Turnkey.
    • +
    • + This function generates a new passkey attestation and challenge, suitable + for registration with the user's device. +
    • +
    • + Handles both web and React Native environments, automatically selecting the + appropriate passkey creation flow. +
    • +
    • + The resulting attestation and challenge can be used to register the passkey + with Turnkey. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:193

    +

    + Defined in:{" "} + + core.ts:193 + +

    - + - -challenge string to use for passkey registration. If not provided, a new challenge will be generated. - - -display name for the passkey (defaults to a generated name based on the current timestamp). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - + + challenge string to use for passkey registration. If not provided, a new + challenge will be generated. + + + display name for the passkey (defaults to a generated name based on the + current timestamp). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an object containing: - - attestation: attestation object returned from the passkey creation process. - - encodedChallenge: encoded challenge string used for passkey registration. + + A promise that resolves to an object containing: - attestation: attestation + object returned from the passkey creation process. - encodedChallenge: encoded + challenge string used for passkey registration. - - + + diff --git a/generated-docs/formatted/core/turnkey-client-create-wallet-accounts.mdx b/generated-docs/formatted/core/turnkey-client-create-wallet-accounts.mdx index d416e7ff2..f1cedc0d9 100644 --- a/generated-docs/formatted/core/turnkey-client-create-wallet-accounts.mdx +++ b/generated-docs/formatted/core/turnkey-client-create-wallet-accounts.mdx @@ -10,40 +10,89 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Creates new accounts in the specified wallet.
      -
    • This function creates new wallet accounts based on the provided account parameters or address formats.
    • -
    • If a walletId is provided, it creates the accounts in that specific wallet; otherwise, it uses the current session's wallet.
    • -
    • If a list of address formats is provided, it will create accounts in the wallet based on those formats, automatically determining the next available path indexes to avoid duplicates with existing accounts.
    • -
    • If account parameters are provided, they are used directly for account creation.
    • -
    • Automatically queries existing wallet accounts to prevent duplicate account creation for the same address format and path.
    • -
    • Supports stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function creates new wallet accounts based on the provided account + parameters or address formats. +
    • +
    • + If a walletId is provided, it creates the accounts in that specific wallet; + otherwise, it uses the current session's wallet. +
    • +
    • + If a list of address formats is provided, it will create accounts in the + wallet based on those formats, automatically determining the next available + path indexes to avoid duplicates with existing accounts. +
    • +
    • + If account parameters are provided, they are used directly for account + creation. +
    • +
    • + Automatically queries existing wallet accounts to prevent duplicate account + creation for the same address format and path. +
    • +
    • + Supports stamping the request with a specific stamper (StamperType.Passkey, + StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3343

    +

    + Defined in:{" "} + + core.ts:3343 + +

    - + - -An array of account parameters or address formats to create in the wallet. - - -organization ID to create the accounts under a specific organization (walletId must be associated with the sub-organization). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -ID of the wallet to create accounts in. - + + An array of account parameters or address formats to create in the wallet. + + + organization ID to create the accounts under a specific organization + (walletId must be associated with the sub-organization). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + ID of the wallet to create accounts in. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an array of addresses for the newly created accounts. + + A promise that resolves to an array of addresses for the newly created + accounts. diff --git a/generated-docs/formatted/core/turnkey-client-create-wallet.mdx b/generated-docs/formatted/core/turnkey-client-create-wallet.mdx index ce7e6c71a..b09fc516d 100644 --- a/generated-docs/formatted/core/turnkey-client-create-wallet.mdx +++ b/generated-docs/formatted/core/turnkey-client-create-wallet.mdx @@ -11,43 +11,96 @@ Creates a new wallet for sub-organization.
    • This function creates a new wallet for the current sub-organization.
    • -
    • If an organizationId is provided, the wallet will be created under that specific sub-organization; otherwise, it uses the current session's organizationId.
    • -
    • If a list of address formats is provided, accounts will be created in the wallet based on those formats (starting from path index 0).
    • -
    • If a list of account parameters is provided, those accounts will be created in the wallet.
    • -
    • If no accounts or address formats are provided, default Ethereum and Solana accounts will be created.
    • -
    • Optionally allows specifying the mnemonic length for the wallet seed phrase (defaults to 12).
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + If an organizationId is provided, the wallet will be created under that + specific sub-organization; otherwise, it uses the current session's + organizationId. +
    • +
    • + If a list of address formats is provided, accounts will be created in the + wallet based on those formats (starting from path index 0). +
    • +
    • + If a list of account parameters is provided, those accounts will be created + in the wallet. +
    • +
    • + If no accounts or address formats are provided, default Ethereum and Solana + accounts will be created. +
    • +
    • + Optionally allows specifying the mnemonic length for the wallet seed phrase + (defaults to 12). +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3270

    +

    + Defined in:{" "} + + core.ts:3270 + +

    - + - -array of account parameters or address formats to create in the wallet. - - -mnemonic length for the wallet seed phrase (defaults to 12). - - -organization ID to create the wallet under a specific sub-organization (defaults to the current session's organizationId). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -name of the wallet to create. - + + array of account parameters or address formats to create in the wallet. + + + mnemonic length for the wallet seed phrase (defaults to 12). + + + organization ID to create the wallet under a specific sub-organization + (defaults to the current session's organizationId). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + name of the wallet to create. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the ID of the newly created wallet. diff --git a/generated-docs/formatted/core/turnkey-client-delete-sub-organization.mdx b/generated-docs/formatted/core/turnkey-client-delete-sub-organization.mdx index 93258e93b..e23c49ae6 100644 --- a/generated-docs/formatted/core/turnkey-client-delete-sub-organization.mdx +++ b/generated-docs/formatted/core/turnkey-client-delete-sub-organization.mdx @@ -10,33 +10,69 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Deletes the current sub-organization (sub-org) for the active session.
      -
    • This function deletes the sub-organization associated with the current active session.
    • -
    • By default, the deletion will fail if any wallets associated with the sub-organization have not been exported.
    • -
    • If ``deleteWithoutExport`` is set to true, the sub-organization will be deleted even if its wallets have not been exported (potentially resulting in loss of access to those wallets).
    • +
    • + This function deletes the sub-organization associated with the current + active session. +
    • +
    • + By default, the deletion will fail if any wallets associated with the + sub-organization have not been exported. +
    • +
    • + If ``deleteWithoutExport`` is set to true, the sub-organization will be + deleted even if its wallets have not been exported (potentially resulting in + loss of access to those wallets). +
    • Requires an active session; otherwise, an error is thrown.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3737

    +

    + Defined in:{" "} + + core.ts:3737 + +

    - + - -flag to delete the sub-organization without requiring all wallets to be exported first (defaults to false). - - -parameter to stamp the request with a specific stamper. - + + flag to delete the sub-organization without requiring all wallets to be + exported first (defaults to false). + + + parameter to stamp the request with a specific stamper. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a `TDeleteSubOrganizationResponse` object containing the result of the deletion. + + A promise that resolves to a `TDeleteSubOrganizationResponse` object + containing the result of the deletion. diff --git a/generated-docs/formatted/core/turnkey-client-disconnect-wallet-account.mdx b/generated-docs/formatted/core/turnkey-client-disconnect-wallet-account.mdx index 3c9a38667..3fe855dc0 100644 --- a/generated-docs/formatted/core/turnkey-client-disconnect-wallet-account.mdx +++ b/generated-docs/formatted/core/turnkey-client-disconnect-wallet-account.mdx @@ -13,19 +13,26 @@ Disconnects the specified wallet account.
  • Requires the wallet manager and its connector to be initialized.
  • -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:588

    +

    + Defined in:{" "} + + core.ts:588 + +

    - + wallet provider to disconnect. - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves once the wallet account is disconnected. diff --git a/generated-docs/formatted/core/turnkey-client-export-private-key.mdx b/generated-docs/formatted/core/turnkey-client-export-private-key.mdx index f49d6f9e5..92b5aa538 100644 --- a/generated-docs/formatted/core/turnkey-client-export-private-key.mdx +++ b/generated-docs/formatted/core/turnkey-client-export-private-key.mdx @@ -10,39 +10,84 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Exports a private key as an encrypted bundle.
      -
    • This function exports the specified private key as an encrypted bundle, suitable for backup or transfer.
    • -
    • The exported bundle contains the private key's key material, encrypted to the provided target public key.
    • -
    • If a targetPublicKey is provided, the bundle will be encrypted to that public key; otherwise, an error will be thrown.
    • -
    • If an organizationId is provided, the private key will be exported under that sub-organization; otherwise, the current session's organizationId is used.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function exports the specified private key as an encrypted bundle, + suitable for backup or transfer. +
    • +
    • + The exported bundle contains the private key's key material, encrypted to + the provided target public key. +
    • +
    • + If a targetPublicKey is provided, the bundle will be encrypted to that + public key; otherwise, an error will be thrown. +
    • +
    • + If an organizationId is provided, the private key will be exported under + that sub-organization; otherwise, the current session's organizationId is + used. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3476

    +

    + Defined in:{" "} + + core.ts:3476 + +

    - + - -organization ID to export the private key under a specific sub - - -ID of the private key to export. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -public key to encrypt the bundle to (required). - + + organization ID to export the private key under a specific sub + + + ID of the private key to export. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + public key to encrypt the bundle to (required). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an `ExportBundle` object containing the encrypted private key and metadata. + + A promise that resolves to an `ExportBundle` object containing the encrypted + private key and metadata. diff --git a/generated-docs/formatted/core/turnkey-client-export-wallet-account.mdx b/generated-docs/formatted/core/turnkey-client-export-wallet-account.mdx index c7c5d8072..e6203cc0a 100644 --- a/generated-docs/formatted/core/turnkey-client-export-wallet-account.mdx +++ b/generated-docs/formatted/core/turnkey-client-export-wallet-account.mdx @@ -10,39 +10,85 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Exports a wallet account as an encrypted bundle.
      -
    • This function exports the specified wallet account as an encrypted bundle, suitable for backup or transfer.
    • -
    • The exported bundle contains the wallet account's key material, encrypted to the provided target public key.
    • -
    • If a targetPublicKey is provided, the bundle will be encrypted to that public key; otherwise, an error will be thrown.
    • -
    • If an organizationId is provided, the wallet account will be exported under that sub-organization; otherwise, the current session's organizationId is used.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function exports the specified wallet account as an encrypted bundle, + suitable for backup or transfer. +
    • +
    • + The exported bundle contains the wallet account's key material, encrypted to + the provided target public key. +
    • +
    • + If a targetPublicKey is provided, the bundle will be encrypted to that + public key; otherwise, an error will be thrown. +
    • +
    • + If an organizationId is provided, the wallet account will be exported under + that sub-organization; otherwise, the current session's organizationId is + used. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3532

    +

    + Defined in:{" "} + + core.ts:3532 + +

    - + - -address of the wallet account to export. - - -organization ID to export the wallet account under a specific sub-organization. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -public key to encrypt the bundle to. - + + address of the wallet account to export. + + + organization ID to export the wallet account under a specific + sub-organization. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + public key to encrypt the bundle to. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an `ExportBundle` object containing the encrypted wallet account and metadata. + + A promise that resolves to an `ExportBundle` object containing the encrypted + wallet account and metadata. diff --git a/generated-docs/formatted/core/turnkey-client-export-wallet.mdx b/generated-docs/formatted/core/turnkey-client-export-wallet.mdx index 902405665..a307d09eb 100644 --- a/generated-docs/formatted/core/turnkey-client-export-wallet.mdx +++ b/generated-docs/formatted/core/turnkey-client-export-wallet.mdx @@ -10,40 +10,87 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Exports a wallet as an encrypted bundle.
      -
    • This function exports the specified wallet and its accounts as an encrypted bundle, suitable for backup or transfer.
    • -
    • The exported bundle contains the wallet's seed phrase, encrypted to the provided target public key.
    • -
    • If a targetPublicKey is provided, the bundle will be encrypted to that public key; otherwise, an error will be thrown.
    • -
    • If an organizationId is provided, the wallet will be exported under that sub-organization; otherwise, the current session's organizationId is used.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • -
    • The exported bundle can later be imported using the ``importWallet`` method.
    • +
    • + This function exports the specified wallet and its accounts as an encrypted + bundle, suitable for backup or transfer. +
    • +
    • + The exported bundle contains the wallet's seed phrase, encrypted to the + provided target public key. +
    • +
    • + If a targetPublicKey is provided, the bundle will be encrypted to that + public key; otherwise, an error will be thrown. +
    • +
    • + If an organizationId is provided, the wallet will be exported under that + sub-organization; otherwise, the current session's organizationId is used. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    • +
    • + The exported bundle can later be imported using the ``importWallet`` method. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3420

    +

    + Defined in:{" "} + + core.ts:3420 + +

    - + - -organization ID to export the wallet under a specific sub-organization (walletId must be associated with the sub-organization). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -public key to encrypt the bundle to (required). - - -ID of the wallet to export. - + + organization ID to export the wallet under a specific sub-organization + (walletId must be associated with the sub-organization). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + public key to encrypt the bundle to (required). + + + ID of the wallet to export. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an `ExportBundle` object containing the encrypted wallet seed phrase and metadata. + + A promise that resolves to an `ExportBundle` object containing the encrypted + wallet seed phrase and metadata. diff --git a/generated-docs/formatted/core/turnkey-client-fetch-user.mdx b/generated-docs/formatted/core/turnkey-client-fetch-user.mdx index 8487ab92a..ad1e7209a 100644 --- a/generated-docs/formatted/core/turnkey-client-fetch-user.mdx +++ b/generated-docs/formatted/core/turnkey-client-fetch-user.mdx @@ -10,36 +10,72 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Fetches the user details for the current session or a specified user.
      -
    • Retrieves user details from the Turnkey API using the provided userId and organizationId, or defaults to those from the active session.
    • -
    • If no userId is provided, the userId from the current session is used.
    • -
    • If no organizationId is provided, the organizationId from the current session is used.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + Retrieves user details from the Turnkey API using the provided userId and + organizationId, or defaults to those from the active session. +
    • +
    • + If no userId is provided, the userId from the current session is used. +
    • +
    • + If no organizationId is provided, the organizationId from the current + session is used. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    • Ensures that an active session exists before making the request.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2399

    +

    + Defined in:{" "} + + core.ts:2399 + +

    - + - -organization ID to specify the sub-organization (defaults to the current session's organizationId). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to fetch specific user details (defaults to the current session's userId). - + + organization ID to specify the sub-organization (defaults to the current + session's organizationId). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to fetch specific user details (defaults to the current session's + userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to a `v1User` object containing the user details. diff --git a/generated-docs/formatted/core/turnkey-client-fetch-wallet-accounts.mdx b/generated-docs/formatted/core/turnkey-client-fetch-wallet-accounts.mdx index ff9c93337..d3fea7568 100644 --- a/generated-docs/formatted/core/turnkey-client-fetch-wallet-accounts.mdx +++ b/generated-docs/formatted/core/turnkey-client-fetch-wallet-accounts.mdx @@ -10,39 +10,83 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Fetches all accounts for a specific wallet, including both embedded and connected wallet accounts.
      -
    • For embedded wallets, retrieves accounts from the Turnkey API, supporting pagination (defaults to the first page with a limit of 100 accounts).
    • -
    • For connected wallets (e.g., browser extensions or external providers), constructs account objects for each connected address from the provided or discovered wallet providers.
    • -
    • Automatically determines the account type and populates relevant fields such as address, curve, and signing capability.
    • -
    • Optionally allows filtering by a specific set of wallet providers and supports custom pagination options.
    • -
    • Supports stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + For embedded wallets, retrieves accounts from the Turnkey API, supporting + pagination (defaults to the first page with a limit of 100 accounts). +
    • +
    • + For connected wallets (e.g., browser extensions or external providers), + constructs account objects for each connected address from the provided or + discovered wallet providers. +
    • +
    • + Automatically determines the account type and populates relevant fields such + as address, curve, and signing capability. +
    • +
    • + Optionally allows filtering by a specific set of wallet providers and + supports custom pagination options. +
    • +
    • + Supports stamping the request with a specific stamper (StamperType.Passkey, + StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1890

    +

    + Defined in:{" "} + + core.ts:1890 + +

    - + - -pagination options for embedded wallets. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -wallet for which to fetch accounts. - - -list of wallet providers to filter by (used for connected wallets). - + + pagination options for embedded wallets. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + wallet for which to fetch accounts. + + + list of wallet providers to filter by (used for connected wallets). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to an array of `v1WalletAccount` objects. diff --git a/generated-docs/formatted/core/turnkey-client-fetch-wallets.mdx b/generated-docs/formatted/core/turnkey-client-fetch-wallets.mdx index 6cc3f5119..35a7cd271 100644 --- a/generated-docs/formatted/core/turnkey-client-fetch-wallets.mdx +++ b/generated-docs/formatted/core/turnkey-client-fetch-wallets.mdx @@ -10,33 +10,66 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Fetches all wallets for the current user, including both embedded and connected wallets.
      -
    • Retrieves all wallets associated with the organizationId from the current active session.
    • -
    • For each embedded wallet, automatically fetches and attaches all associated wallet accounts.
    • -
    • For connected wallets (e.g., browser extensions or external providers), groups providers by wallet name and attaches all connected accounts.
    • -
    • Returns both embedded and connected wallets in a single array, each with their respective accounts populated.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + Retrieves all wallets associated with the organizationId from the current + active session. +
    • +
    • + For each embedded wallet, automatically fetches and attaches all associated + wallet accounts. +
    • +
    • + For connected wallets (e.g., browser extensions or external providers), + groups providers by wallet name and attaches all connected accounts. +
    • +
    • + Returns both embedded and connected wallets in a single array, each with + their respective accounts populated. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1771

    +

    + Defined in:{" "} + + core.ts:1771 + +

    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -array of wallet providers to use for fetching wallets. - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + array of wallet providers to use for fetching wallets. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to an array of `Wallet` objects. diff --git a/generated-docs/formatted/core/turnkey-client-get-active-session-key.mdx b/generated-docs/formatted/core/turnkey-client-get-active-session-key.mdx index e5c08fa85..ad6436d6d 100644 --- a/generated-docs/formatted/core/turnkey-client-get-active-session-key.mdx +++ b/generated-docs/formatted/core/turnkey-client-get-active-session-key.mdx @@ -10,23 +10,40 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Retrieves the active session key currently set in persistent storage.
      -
    • This function fetches the session key that is currently marked as active in the client's persistent storage.
    • -
    • The active session key determines which session is used for all session-dependent operations.
    • +
    • + This function fetches the session key that is currently marked as active in + the client's persistent storage. +
    • +
    • + The active session key determines which session is used for all + session-dependent operations. +
    • If no active session key is set, returns ``undefined``.
    • -
    • Useful for determining which session is currently in use, especially when managing multiple sessions.
    • +
    • + Useful for determining which session is currently in use, especially when + managing multiple sessions. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:4050

    +

    + Defined in:{" "} + + core.ts:4050 + +

    No parameters.

    - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to the active session key as a string, or `undefined` if no active session is set. + + A promise that resolves to the active session key as a string, or `undefined` + if no active session is set. diff --git a/generated-docs/formatted/core/turnkey-client-get-all-sessions.mdx b/generated-docs/formatted/core/turnkey-client-get-all-sessions.mdx index ae2e10661..c9c7dd674 100644 --- a/generated-docs/formatted/core/turnkey-client-get-all-sessions.mdx +++ b/generated-docs/formatted/core/turnkey-client-get-all-sessions.mdx @@ -10,23 +10,47 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Retrieves all sessions stored in persistent storage.
      -
    • This function fetches all session objects currently stored by the client, including those that are not active.
    • -
    • Returns a record mapping each session key to its corresponding ``Session`` object.
    • -
    • Useful for session management, auditing, or displaying all available sessions to the user.
    • -
    • Automatically skips any session keys that do not have a valid session object.
    • +
    • + This function fetches all session objects currently stored by the client, + including those that are not active. +
    • +
    • + Returns a record mapping each session key to its corresponding ``Session`` + object. +
    • +
    • + Useful for session management, auditing, or displaying all available + sessions to the user. +
    • +
    • + Automatically skips any session keys that do not have a valid session + object. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3991

    +

    + Defined in:{" "} + + core.ts:3991 + +

    No parameters.

    - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a record of session keys and their corresponding `Session` objects, or `undefined` if no sessions exist. + + A promise that resolves to a record of session keys and their corresponding + `Session` objects, or `undefined` if no sessions exist. diff --git a/generated-docs/formatted/core/turnkey-client-get-proxy-auth-config.mdx b/generated-docs/formatted/core/turnkey-client-get-proxy-auth-config.mdx index 0b0bd8e8e..51380b06b 100644 --- a/generated-docs/formatted/core/turnkey-client-get-proxy-auth-config.mdx +++ b/generated-docs/formatted/core/turnkey-client-get-proxy-auth-config.mdx @@ -10,27 +10,48 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Fetches the WalletKit proxy authentication configuration from the auth proxy.
      -
    • This function makes a request to the Turnkey auth proxy to retrieve the current WalletKit configuration,
    • +
    • + This function makes a request to the Turnkey auth proxy to retrieve the + current WalletKit configuration, +
    including supported authentication methods, OAuth providers, and any custom proxy settings.
      -
    • Useful for dynamically configuring the client UI or authentication flows based on the proxy's capabilities.
    • -
    • Ensures that the client is aware of the latest proxy-side configuration, which may affect available login/signup options.
    • +
    • + Useful for dynamically configuring the client UI or authentication flows + based on the proxy's capabilities. +
    • +
    • + Ensures that the client is aware of the latest proxy-side configuration, + which may affect available login/signup options. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:4168

    +

    + Defined in:{" "} + + core.ts:4168 + +

    No parameters.

    - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a `ProxyTGetWalletKitConfigResponse` object containing the proxy authentication configuration. + + A promise that resolves to a `ProxyTGetWalletKitConfigResponse` object + containing the proxy authentication configuration. diff --git a/generated-docs/formatted/core/turnkey-client-get-session.mdx b/generated-docs/formatted/core/turnkey-client-get-session.mdx index a90e6c427..3c7cf262e 100644 --- a/generated-docs/formatted/core/turnkey-client-get-session.mdx +++ b/generated-docs/formatted/core/turnkey-client-get-session.mdx @@ -10,28 +10,51 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Retrieves the session associated with the specified session key, or the active session by default.
      -
    • This function retrieves the session object from storage, using the provided session key or, if not specified, the current active session key.
    • -
    • If no session key is provided and there is no active session, it returns undefined.
    • -
    • Returns the session details, including public key, organization ID, user ID, and expiration.
    • +
    • + This function retrieves the session object from storage, using the provided + session key or, if not specified, the current active session key. +
    • +
    • + If no session key is provided and there is no active session, it returns + undefined. +
    • +
    • + Returns the session details, including public key, organization ID, user ID, + and expiration. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3964

    +

    + Defined in:{" "} + + core.ts:3964 + +

    - + - -session key to retrieve a specific session (defaults to the current active session key). - + + session key to retrieve a specific session (defaults to the current active + session key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a `Session` object containing the session details, or undefined if not found. + + A promise that resolves to a `Session` object containing the session details, + or undefined if not found. diff --git a/generated-docs/formatted/core/turnkey-client-get-wallet-providers.mdx b/generated-docs/formatted/core/turnkey-client-get-wallet-providers.mdx index dd8a7c5fc..f4f86fe2e 100644 --- a/generated-docs/formatted/core/turnkey-client-get-wallet-providers.mdx +++ b/generated-docs/formatted/core/turnkey-client-get-wallet-providers.mdx @@ -14,19 +14,26 @@ Retrieves wallet providers from the initialized wallet manager.
  • Throws an error if the wallet manager is not initialized.
  • -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:531

    +

    + Defined in:{" "} + + core.ts:531 + +

    - + optional blockchain chain to filter the returned providers. - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to an array of wallet providers. diff --git a/generated-docs/formatted/core/turnkey-client-import-private-key.mdx b/generated-docs/formatted/core/turnkey-client-import-private-key.mdx index 414e34e4b..8f83ce93a 100644 --- a/generated-docs/formatted/core/turnkey-client-import-private-key.mdx +++ b/generated-docs/formatted/core/turnkey-client-import-private-key.mdx @@ -10,45 +10,97 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Imports a private key from an encrypted bundle.
      -
    • This function imports a private key using the provided encrypted bundle.
    • -
    • If a userId is provided, the private key will be imported for that specific user; otherwise, it uses the current session's userId.
    • +
    • + This function imports a private key using the provided encrypted bundle. +
    • +
    • + If a userId is provided, the private key will be imported for that specific + user; otherwise, it uses the current session's userId. +
    • Requires address formats to
    • -
    • Automatically infers the cryptographic curve used to generate the private key based on the address format (can be optionally overriden if needed).
    • +
    • + Automatically infers the cryptographic curve used to generate the private + key based on the address format (can be optionally overriden if needed). +
    • The encrypted bundle MUST be encrypted to ensure security.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3663

    +

    + Defined in:{" "} + + core.ts:3663 + +

    - + - - -the cryptographic curve used to generate a given private key - - -encrypted bundle containing the private key key material and metadata. - - -name of the private key to create upon import. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to import the wallet for a specific user (defaults to the current session's userId). - + + + the cryptographic curve used to generate a given private key + + + encrypted bundle containing the private key key material and metadata. + + + name of the private key to create upon import. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to import the wallet for a specific user (defaults to the current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the ID of the imported wallet. diff --git a/generated-docs/formatted/core/turnkey-client-import-wallet.mdx b/generated-docs/formatted/core/turnkey-client-import-wallet.mdx index 8e2a915a3..ab97a1650 100644 --- a/generated-docs/formatted/core/turnkey-client-import-wallet.mdx +++ b/generated-docs/formatted/core/turnkey-client-import-wallet.mdx @@ -10,43 +10,93 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Imports a wallet from an encrypted bundle.
      -
    • This function imports a wallet using the provided encrypted bundle and creates accounts based on the provided parameters.
    • -
    • If a userId is provided, the wallet will be imported for that specific user; otherwise, it uses the current session's userId.
    • -
    • If an accounts array is provided, those accounts will be created in the imported wallet; otherwise, default Ethereum and Solana accounts will be created.
    • +
    • + This function imports a wallet using the provided encrypted bundle and + creates accounts based on the provided parameters. +
    • +
    • + If a userId is provided, the wallet will be imported for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + If an accounts array is provided, those accounts will be created in the + imported wallet; otherwise, default Ethereum and Solana accounts will be + created. +
    • The encrypted bundle MUST be encrypted to
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3589

    +

    + Defined in:{" "} + + core.ts:3589 + +

    - + - -array of account parameters to create in the imported wallet (defaults to standard Ethereum and Solana accounts). - - -encrypted bundle containing the wallet seed phrase and metadata. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to import the wallet for a specific user (defaults to the current session's userId). - - -name of the wallet to create upon import. - + + array of account parameters to create in the imported wallet (defaults to + standard Ethereum and Solana accounts). + + + encrypted bundle containing the wallet seed phrase and metadata. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to import the wallet for a specific user (defaults to the current + session's userId). + + + name of the wallet to create upon import. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the ID of the imported wallet. diff --git a/generated-docs/formatted/core/turnkey-client-init-otp.mdx b/generated-docs/formatted/core/turnkey-client-init-otp.mdx index 6db724318..052167829 100644 --- a/generated-docs/formatted/core/turnkey-client-init-otp.mdx +++ b/generated-docs/formatted/core/turnkey-client-init-otp.mdx @@ -10,31 +10,52 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Initializes the OTP process by sending an OTP code to the provided contact.
      -
    • This function initiates the OTP flow by sending a one-time password (OTP) code to the user's contact information (email address or phone number) via the auth proxy.
    • +
    • + This function initiates the OTP flow by sending a one-time password (OTP) + code to the user's contact information (email address or phone number) via + the auth proxy. +
    • Supports both email and SMS OTP types.
    • Returns an OTP ID that is required for subsequent OTP verification.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1154

    +

    + Defined in:{" "} + + core.ts:1154 + +

    - + - -contact information for the user (e.g., email address or phone number). - - -type of OTP to initialize (OtpType.Email or OtpType.Sms). - + + contact information for the user (e.g., email address or phone number). + + + type of OTP to initialize (OtpType.Email or OtpType.Sms). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the OTP ID required for verification. diff --git a/generated-docs/formatted/core/turnkey-client-init.mdx b/generated-docs/formatted/core/turnkey-client-init.mdx index 62995f847..ed68b52b2 100644 --- a/generated-docs/formatted/core/turnkey-client-init.mdx +++ b/generated-docs/formatted/core/turnkey-client-init.mdx @@ -5,15 +5,22 @@ title: "init()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:138

    +

    + Defined in:{" "} + + core.ts:138 + +

    No parameters.

    - -A successful response returns the following fields: +A successful response returns the following +fields: diff --git a/generated-docs/formatted/core/turnkey-client-login-or-signup-with-wallet.mdx b/generated-docs/formatted/core/turnkey-client-login-or-signup-with-wallet.mdx index e1172209f..d8ea66ded 100644 --- a/generated-docs/formatted/core/turnkey-client-login-or-signup-with-wallet.mdx +++ b/generated-docs/formatted/core/turnkey-client-login-or-signup-with-wallet.mdx @@ -10,43 +10,89 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Logs in an existing user or signs up a new user using a wallet, creating a new sub-organization if needed.
      -
    • This function attempts to log in the user by stamping a login request with the provided wallet.
    • -
    • If the wallet’s public key is not associated with an existing sub-organization, a new one is created.
    • -
    • Handles both wallet authentication and sub-organization creation in a single flow.
    • -
    • For Ethereum wallets, derives the public key from the signed request header; for Solana wallets, retrieves it directly from the wallet.
    • -
    • Optionally accepts additional sub-organization parameters, a custom session key, and a custom session expiration.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • +
    • + This function attempts to log in the user by stamping a login request with + the provided wallet. +
    • +
    • + If the wallet’s public key is not associated with an existing + sub-organization, a new one is created. +
    • +
    • + Handles both wallet authentication and sub-organization creation in a single + flow. +
    • +
    • + For Ethereum wallets, derives the public key from the signed request header; + for Solana wallets, retrieves it directly from the wallet. +
    • +
    • + Optionally accepts additional sub-organization parameters, a custom session + key, and a custom session expiration. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:939

    +

    + Defined in:{" "} + + core.ts:939 + +

    - + - -optional parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -session expiration time in seconds (defaults to the configured default). - - -session key to use for storing the session (defaults to the default session key). - - -wallet provider to use for authentication. - + + optional parameters for creating a sub-organization (e.g., authenticators, + user metadata). + + + session expiration time in seconds (defaults to the configured default). + + + session key to use for storing the session (defaults to the default + session key). + + + wallet provider to use for authentication. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an object containing: - - `sessionToken`: the signed JWT session token. - - `address`: the authenticated wallet address. - - `action`: whether the flow resulted in a login or signup (AuthAction). + + A promise that resolves to an object containing: - `sessionToken`: the signed + JWT session token. - `address`: the authenticated wallet address. - `action`: + whether the flow resulted in a login or signup (AuthAction). diff --git a/generated-docs/formatted/core/turnkey-client-login-with-oauth.mdx b/generated-docs/formatted/core/turnkey-client-login-with-oauth.mdx index a4644588d..465a5ebd0 100644 --- a/generated-docs/formatted/core/turnkey-client-login-with-oauth.mdx +++ b/generated-docs/formatted/core/turnkey-client-login-with-oauth.mdx @@ -10,39 +10,77 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Logs in a user using OAuth authentication.
      -
    • This function logs in a user using the provided OIDC token and public key.
    • -
    • Optionally invalidates any existing sessions for the user if ``invalidateExisting`` is set to true.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • +
    • + This function logs in a user using the provided OIDC token and public key. +
    • +
    • + Optionally invalidates any existing sessions for the user if + ``invalidateExisting`` is set to true. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • Handles cleanup of unused key pairs if login fails.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1612

    +

    + Defined in:{" "} + + core.ts:1612 + +

    - + - -flag to invalidate existing sessions for the user. - - -OIDC token received after successful authentication with the OAuth provider. - - -public key to use for authentication. Must be generated prior to calling this function. - - -session key to use for session creation (defaults to the default session key). - + + flag to invalidate existing sessions for the user. + + + OIDC token received after successful authentication with the OAuth + provider. + + + public key to use for authentication. Must be generated prior to calling + this function. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/core/turnkey-client-login-with-otp.mdx b/generated-docs/formatted/core/turnkey-client-login-with-otp.mdx index 378d5581f..cb663fa05 100644 --- a/generated-docs/formatted/core/turnkey-client-login-with-otp.mdx +++ b/generated-docs/formatted/core/turnkey-client-login-with-otp.mdx @@ -10,40 +10,81 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Logs in a user using an OTP verification token.
      -
    • This function logs in a user using the verification token received after OTP verification (from email or SMS).
    • -
    • If a public key is not provided, a new API key pair will be generated for authentication.
    • -
    • Optionally invalidates any existing sessions for the user if ``invalidateExisting`` is set to true.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • +
    • + This function logs in a user using the verification token received after OTP + verification (from email or SMS). +
    • +
    • + If a public key is not provided, a new API key pair will be generated for + authentication. +
    • +
    • + Optionally invalidates any existing sessions for the user if + ``invalidateExisting`` is set to true. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • Handles cleanup of unused key pairs if login fails.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1271

    +

    + Defined in:{" "} + + core.ts:1271 + +

    - + - -flag to invalidate existing session for the user. - - -public key to use for authentication. If not provided, a new key pair will be generated. - - -session key to use for session creation (defaults to the default session key). - - -verification token received after OTP verification. - + + flag to invalidate existing session for the user. + + + public key to use for authentication. If not provided, a new key pair will + be generated. + + + session key to use for session creation (defaults to the default session + key). + + + verification token received after OTP verification. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/core/turnkey-client-login-with-passkey.mdx b/generated-docs/formatted/core/turnkey-client-login-with-passkey.mdx index 5cc23be98..bd7440945 100644 --- a/generated-docs/formatted/core/turnkey-client-login-with-passkey.mdx +++ b/generated-docs/formatted/core/turnkey-client-login-with-passkey.mdx @@ -10,38 +10,73 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Logs in a user using a passkey, optionally specifying the public key, session key, and session expiration.
      -
    • This function initiates the login process with a passkey and handles session creation and storage.
    • -
    • If a public key is not provided, a new key pair will be generated for authentication.
    • -
    • If a session key is not provided, the default session key will be used.
    • -
    • The session expiration can be customized via the expirationSeconds parameter.
    • +
    • + This function initiates the login process with a passkey and handles session + creation and storage. +
    • +
    • + If a public key is not provided, a new key pair will be generated for + authentication. +
    • +
    • + If a session key is not provided, the default session key will be used. +
    • +
    • + The session expiration can be customized via the expirationSeconds + parameter. +
    • Handles cleanup of unused key pairs if login fails.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:319

    +

    + Defined in:{" "} + + core.ts:319 + +

    - + - -session expiration time in seconds (defaults to the configured default). - - -public key to use for authentication. If not provided, a new key pair will be generated. - - -session key to use for session creation (defaults to the default session key). - + + session expiration time in seconds (defaults to the configured default). + + + public key to use for authentication. If not provided, a new key pair will + be generated. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a PasskeyAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `credentialId`: an empty string. + + A promise that resolves to a PasskeyAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `credentialId`: an empty + string. diff --git a/generated-docs/formatted/core/turnkey-client-login-with-wallet.mdx b/generated-docs/formatted/core/turnkey-client-login-with-wallet.mdx index 3ea62d5a6..fbdd8e2ca 100644 --- a/generated-docs/formatted/core/turnkey-client-login-with-wallet.mdx +++ b/generated-docs/formatted/core/turnkey-client-login-with-wallet.mdx @@ -10,41 +10,83 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Logs in a user using the specified wallet provider.
      -
    • This function logs in a user by authenticating with the provided wallet provider via a wallet-based signature.
    • -
    • If a public key is not provided, a new one will be generated for authentication.
    • +
    • + This function logs in a user by authenticating with the provided wallet + provider via a wallet-based signature. +
    • +
    • + If a public key is not provided, a new one will be generated for + authentication. +
    • Optionally accepts a custom session key and session expiration time.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • -
    • Throws an error if a public key cannot be found or generated, or if the login process fails.
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • +
    • + Throws an error if a public key cannot be found or generated, or if the + login process fails. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:697

    +

    + Defined in:{" "} + + core.ts:697 + +

    - + - -optional session expiration time in seconds (defaults to the configured default). - - -optional public key to associate with the session (generated if not provided). - - -optional key to store the session under (defaults to the default session key). - - -wallet provider to use for authentication. - + + optional session expiration time in seconds (defaults to the configured + default). + + + optional public key to associate with the session (generated if not + provided). + + + optional key to store the session under (defaults to the default session + key). + + + wallet provider to use for authentication. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a WalletAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `address`: the authenticated wallet address. + + A promise that resolves to a WalletAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `address`: the authenticated + wallet address. diff --git a/generated-docs/formatted/core/turnkey-client-logout.mdx b/generated-docs/formatted/core/turnkey-client-logout.mdx index 6a1e7e896..ddf1437c1 100644 --- a/generated-docs/formatted/core/turnkey-client-logout.mdx +++ b/generated-docs/formatted/core/turnkey-client-logout.mdx @@ -10,28 +10,47 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Logs out the current client session.
      -
    • This function clears the specified session and removes any associated key pairs from storage.
    • -
    • If a sessionKey is provided, it logs out from that session; otherwise, it logs out from the active session.
    • +
    • + This function clears the specified session and removes any associated key + pairs from storage. +
    • +
    • + If a sessionKey is provided, it logs out from that session; otherwise, it + logs out from the active session. +
    • Cleans up any api keys associated with the session.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:272

    +

    + Defined in:{" "} + + core.ts:272 + +

    - + - -session key to specify which session to log out from (defaults to the active session). - + + session key to specify which session to log out from (defaults to the + active session). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves when the logout process is complete. diff --git a/generated-docs/formatted/core/turnkey-client-refresh-session.mdx b/generated-docs/formatted/core/turnkey-client-refresh-session.mdx index 507f2ab1a..9e9e8fd0d 100644 --- a/generated-docs/formatted/core/turnkey-client-refresh-session.mdx +++ b/generated-docs/formatted/core/turnkey-client-refresh-session.mdx @@ -10,43 +10,102 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Refreshes the session associated with the specified session key, or the active session by default.
      -
    • This function refreshes the session and updates the session token and key pair associated with the given session key.
    • -
    • If a sessionKey is provided, it will refresh the session under that key; otherwise, it will use the current active session key.
    • -
    • Optionally allows specifying a new expiration time for the session, a custom public key, and whether to invalidate the existing session after refreshing.
    • -
    • Makes a request to the Turnkey API to stamp a new login and stores the refreshed session token.
    • -
    • Automatically manages key pair cleanup and session storage to ensure consistency.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function refreshes the session and updates the session token and key + pair associated with the given session key. +
    • +
    • + If a sessionKey is provided, it will refresh the session under that key; + otherwise, it will use the current active session key. +
    • +
    • + Optionally allows specifying a new expiration time for the session, a custom + public key, and whether to invalidate the existing session after refreshing. +
    • +
    • + Makes a request to the Turnkey API to stamp a new login and stores the + refreshed session token. +
    • +
    • + Automatically manages key pair cleanup and session storage to ensure + consistency. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3878

    +

    + Defined in:{" "} + + core.ts:3878 + +

    - + - -expiration time in seconds for the refreshed session (defaults to the configured default). - - -flag to invalidate the existing session before refreshing (defaults to false). - - -public key to use for the refreshed session (if not provided, a new key pair will be generated). - - -session key to refresh the session under (defaults to the active session key). - - -parameter to stamp the request with a specific stamper. - + + expiration time in seconds for the refreshed session (defaults to the + configured default). + + + flag to invalidate the existing session before refreshing (defaults to + false). + + + public key to use for the refreshed session (if not provided, a new key + pair will be generated). + + + session key to refresh the session under (defaults to the active session + key). + + + parameter to stamp the request with a specific stamper. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a `TStampLoginResponse` object containing the refreshed session details. + + A promise that resolves to a `TStampLoginResponse` object containing the + refreshed session details. diff --git a/generated-docs/formatted/core/turnkey-client-remove-oauth-providers.mdx b/generated-docs/formatted/core/turnkey-client-remove-oauth-providers.mdx index 17fd01b52..9dd451c4e 100644 --- a/generated-docs/formatted/core/turnkey-client-remove-oauth-providers.mdx +++ b/generated-docs/formatted/core/turnkey-client-remove-oauth-providers.mdx @@ -10,36 +10,74 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Removes a list of OAuth providers from the user.
      -
    • This function removes OAuth providers (e.g., Google, Apple) from the user's account.
    • -
    • If a userId is provided, it removes the providers for that specific user; otherwise, it uses the current session's userId.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • -
    • Returns an array of remaining provider IDs associated with the user after removal.
    • +
    • + This function removes OAuth providers (e.g., Google, Apple) from the user's + account. +
    • +
    • + If a userId is provided, it removes the providers for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    • +
    • + Returns an array of remaining provider IDs associated with the user after + removal. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3087

    +

    + Defined in:{" "} + + core.ts:3087 + +

    - + - -IDs of the OAuth providers to remove. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to remove the provider for a specific user (defaults to the current session's userId). - + + IDs of the OAuth providers to remove. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to remove the provider for a specific user (defaults to the + current session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to an array of provider IDs that were removed. diff --git a/generated-docs/formatted/core/turnkey-client-remove-passkeys.mdx b/generated-docs/formatted/core/turnkey-client-remove-passkeys.mdx index 6bc428b21..75848a771 100644 --- a/generated-docs/formatted/core/turnkey-client-remove-passkeys.mdx +++ b/generated-docs/formatted/core/turnkey-client-remove-passkeys.mdx @@ -10,36 +10,73 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Removes passkeys (authenticator) from the user.
      -
    • This function removes passkeys (WebAuthn/FIDO2 authenticators) from the user's account.
    • -
    • If a userId is provided, it removes the passkeys for that specific user; otherwise, it uses the current session's userId.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • -
    • Returns an array of remaining authenticator IDs for the user after removal.
    • +
    • + This function removes passkeys (WebAuthn/FIDO2 authenticators) from the + user's account. +
    • +
    • + If a userId is provided, it removes the passkeys for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    • +
    • + Returns an array of remaining authenticator IDs for the user after removal. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3212

    +

    + Defined in:{" "} + + core.ts:3212 + +

    - + - -IDs of the authenticators (passkeys) to remove. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to remove the passkeys for a specific user (defaults to the current session's userId). - + + IDs of the authenticators (passkeys) to remove. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to remove the passkeys for a specific user (defaults to the + current session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to an array of authenticator IDs that were removed. diff --git a/generated-docs/formatted/core/turnkey-client-remove-user-email.mdx b/generated-docs/formatted/core/turnkey-client-remove-user-email.mdx index 25a726188..1f3a5cbd4 100644 --- a/generated-docs/formatted/core/turnkey-client-remove-user-email.mdx +++ b/generated-docs/formatted/core/turnkey-client-remove-user-email.mdx @@ -10,32 +10,62 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Removes the user's email address.
      -
    • This function removes the user's email address by setting it to an empty string.
    • -
    • If a userId is provided, it removes the email for that specific user; otherwise, it uses the current session's userId.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function removes the user's email address by setting it to an empty + string. +
    • +
    • + If a userId is provided, it removes the email for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2762

    +

    + Defined in:{" "} + + core.ts:2762 + +

    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to remove a specific user's email address (defaults to the current session's userId). - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to remove a specific user's email address (defaults to the current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the userId of the user whose email was removed. diff --git a/generated-docs/formatted/core/turnkey-client-remove-user-phone-number.mdx b/generated-docs/formatted/core/turnkey-client-remove-user-phone-number.mdx index 1a7e5bb94..8f00a4e1a 100644 --- a/generated-docs/formatted/core/turnkey-client-remove-user-phone-number.mdx +++ b/generated-docs/formatted/core/turnkey-client-remove-user-phone-number.mdx @@ -10,32 +10,63 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Removes the user's phone number.
      -
    • This function removes the user's phone number by setting it to an empty string.
    • -
    • If a userId is provided, it removes the phone number for that specific user; otherwise, it uses the current session's userId.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function removes the user's phone number by setting it to an empty + string. +
    • +
    • + If a userId is provided, it removes the phone number for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2871

    +

    + Defined in:{" "} + + core.ts:2871 + +

    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to remove a specific user's phone number (defaults to the current session's userId). - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to remove a specific user's phone number (defaults to the current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to the userId of the user whose phone number was removed. + + A promise that resolves to the userId of the user whose phone number was + removed. diff --git a/generated-docs/formatted/core/turnkey-client-set-active-session.mdx b/generated-docs/formatted/core/turnkey-client-set-active-session.mdx index 826b57710..36426a592 100644 --- a/generated-docs/formatted/core/turnkey-client-set-active-session.mdx +++ b/generated-docs/formatted/core/turnkey-client-set-active-session.mdx @@ -10,29 +10,53 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Sets the active session to the specified session key.
      -
    • This function updates the ``activeSessionKey`` in persistent storage to the specified session key.
    • -
    • Ensures that subsequent operations use the session associated with this key as the active session.
    • -
    • Does not validate whether the session key exists or is valid; it simply updates the pointer.
    • -
    • Useful for switching between multiple stored sessions or restoring a previous session context.
    • +
    • + This function updates the ``activeSessionKey`` in persistent storage to the + specified session key. +
    • +
    • + Ensures that subsequent operations use the session associated with this key + as the active session. +
    • +
    • + Does not validate whether the session key exists or is valid; it simply + updates the pointer. +
    • +
    • + Useful for switching between multiple stored sessions or restoring a + previous session context. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:4026

    +

    + Defined in:{" "} + + core.ts:4026 + +

    - + - -session key to set as the active session. - + + session key to set as the active session. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves when the active session key is successfully set. diff --git a/generated-docs/formatted/core/turnkey-client-sign-and-send-transaction.mdx b/generated-docs/formatted/core/turnkey-client-sign-and-send-transaction.mdx index 91061e2d4..67bfc9f9a 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-and-send-transaction.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-and-send-transaction.mdx @@ -22,35 +22,67 @@ Signs and broadcasts a transaction using the specified wallet account.
  • Broadcasts the transaction using a JSON-RPC client.
  • -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2294

    +

    + Defined in:{" "} + + core.ts:2294 + +

    - + - -required for embedded wallets to broadcast the signed transaction. - - -optional stamper to tag the signing request. - - -transaction type (e.g., "TRANSACTION_TYPE_SOLANA"). - - -unsigned transaction (serialized string). - - -wallet account to use for signing and sending. - + + required for embedded wallets to broadcast the signed transaction. + + + optional stamper to tag the signing request. + + + transaction type (e.g., "TRANSACTION_TYPE_SOLANA"). + + + unsigned transaction (serialized string). + + + wallet account to use for signing and sending. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to a transaction signature or hash. diff --git a/generated-docs/formatted/core/turnkey-client-sign-message.mdx b/generated-docs/formatted/core/turnkey-client-sign-message.mdx index 3c222334e..263dba4c9 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-message.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-message.mdx @@ -13,54 +13,102 @@ Signs a message using the specified wallet account.
  • Supports both embedded and connected wallets.
  • For **connected wallets**:
  • Delegates signing to the wallet provider’s native signing method.
  • -
  • **Important:** For Ethereum wallets (e.g., MetaMask), signatures follow [EIP-191](https://eips.ethereum.org/EIPS/eip-191).
  • +
  • + **Important:** For Ethereum wallets (e.g., MetaMask), signatures follow + [EIP-191](https://eips.ethereum.org/EIPS/eip-191). +
  • -The message is automatically prefixed with ``"\x19Ethereum Signed Message:\n" + message length`` before signing. As a result, this signature **cannot be used as a raw transaction signature** or broadcast on-chain. +The message is automatically prefixed with `"\x19Ethereum Signed Message:\n" + message length` before signing. As a result, this signature **cannot be used as a raw transaction signature** or broadcast on-chain.
      -
    • For **embedded wallets**, uses the Turnkey API to sign the message directly.
    • -
    • Automatically handles message encoding and hashing based on the wallet account’s address format,
    • +
    • + For **embedded wallets**, uses the Turnkey API to sign the message directly. +
    • +
    • + Automatically handles message encoding and hashing based on the wallet + account’s address format, +
    unless explicitly overridden. -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2123

    +

    + Defined in:{" "} + + core.ts:2123 + +

    - + - -whether to prefix the message with Ethereum's `"\x19Ethereum Signed Message:\n"` string. - - If `true` (default for Ethereum), the message is prefixed before signing. - - If `false`: - - Connected wallets will throw an error because they always prefix automatically. - - Embedded wallets will sign the raw message without any prefix. - - -override for the payload encoding (defaults to the encoding appropriate for the address type). - - -override for the hash function (defaults to the hash function appropriate for the address type). - - -message to sign. - - -stamper to tag the signing request (e.g., Passkey, ApiKey, or Wallet). - - -wallet account to use for signing. - + + whether to prefix the message with Ethereum's `"\x19Ethereum Signed + Message:\n"` string. - If `true` (default for Ethereum), the message is + prefixed before signing. - If `false`: - Connected wallets will throw an + error because they always prefix automatically. - Embedded wallets will + sign the raw message without any prefix. + + + override for the payload encoding (defaults to the encoding appropriate + for the address type). + + + override for the hash function (defaults to the hash function appropriate + for the address type). + + + message to sign. + + + stamper to tag the signing request (e.g., Passkey, ApiKey, or Wallet). + + + wallet account to use for signing. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise resolving to a `v1SignRawPayloadResult` containing the signature and metadata. + + A promise resolving to a `v1SignRawPayloadResult` containing the signature and + metadata. diff --git a/generated-docs/formatted/core/turnkey-client-sign-transaction.mdx b/generated-docs/formatted/core/turnkey-client-sign-transaction.mdx index 74e929748..33e743cc2 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-transaction.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-transaction.mdx @@ -10,39 +10,84 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Signs a transaction using the specified wallet account.
      -
    • This function signs a blockchain transaction using the provided wallet address and transaction data.
    • -
    • Supports all Turnkey-supported blockchain networks (e.g., Ethereum, Solana, Tron).
    • -
    • Automatically determines the appropriate signing method based on the transaction type.
    • -
    • Delegates signing to the Turnkey API, which returns the signed transaction and related metadata.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + This function signs a blockchain transaction using the provided wallet + address and transaction data. +
    • +
    • + Supports all Turnkey-supported blockchain networks (e.g., Ethereum, Solana, + Tron). +
    • +
    • + Automatically determines the appropriate signing method based on the + transaction type. +
    • +
    • + Delegates signing to the Turnkey API, which returns the signed transaction + and related metadata. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2221

    +

    + Defined in:{" "} + + core.ts:2221 + +

    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -type of transaction (e.g., "TRANSACTION_TYPE_ETHEREUM", "TRANSACTION_TYPE_SOLANA", "TRANSACTION_TYPE_TRON"). - - -unsigned transaction data (serialized as a string) to be signed. - - -wallet account to use for signing the transaction. - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + type of transaction (e.g., "TRANSACTION_TYPE_ETHEREUM", + "TRANSACTION_TYPE_SOLANA", "TRANSACTION_TYPE_TRON"). + + + unsigned transaction data (serialized as a string) to be signed. + + + wallet account to use for signing the transaction. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a `TSignTransactionResponse` object containing the signed transaction and any additional signing metadata. + + A promise that resolves to a `TSignTransactionResponse` object containing the + signed transaction and any additional signing metadata. diff --git a/generated-docs/formatted/core/turnkey-client-sign-up-with-oauth.mdx b/generated-docs/formatted/core/turnkey-client-sign-up-with-oauth.mdx index 68d1d112e..0ad3796ac 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-up-with-oauth.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-up-with-oauth.mdx @@ -10,42 +10,89 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Signs up a user using OAuth authentication.
      -
    • This function creates a new sub-organization for the user using the provided OIDC token, public key, and provider name.
    • -
    • Handles the full OAuth sign-up flow, including sub-organization creation and session management.
    • -
    • Optionally accepts additional sub-organization creation parameters and a custom session key.
    • -
    • After successful sign-up, automatically logs in the user and returns a signed JWT session token.
    • +
    • + This function creates a new sub-organization for the user using the provided + OIDC token, public key, and provider name. +
    • +
    • + Handles the full OAuth sign-up flow, including sub-organization creation and + session management. +
    • +
    • + Optionally accepts additional sub-organization creation parameters and a + custom session key. +
    • +
    • + After successful sign-up, automatically logs in the user and returns a + signed JWT session token. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1706

    +

    + Defined in:{" "} + + core.ts:1706 + +

    - + - -parameters for sub-organization creation (e.g., authenticators, user metadata). - - -OIDC token received after successful authentication with the OAuth provider. - - -name of the OAuth provider (e.g., "Google", "Apple"). - - -public key to associate with the new sub-organization. - - -session key to use for session creation (defaults to the default session key). - + + parameters for sub-organization creation (e.g., authenticators, user + metadata). + + + OIDC token received after successful authentication with the OAuth + provider. + + + name of the OAuth provider (e.g., "Google", "Apple"). + + + public key to associate with the new sub-organization. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/core/turnkey-client-sign-up-with-otp.mdx b/generated-docs/formatted/core/turnkey-client-sign-up-with-otp.mdx index 624a5e8e6..314664a07 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-up-with-otp.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-up-with-otp.mdx @@ -10,46 +10,100 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Signs up a user using an OTP verification token.
      -
    • This function signs up a user using the verification token received after OTP verification (from email or SMS).
    • -
    • Creates a new sub-organization for the user with the provided parameters and associates the contact (email or phone) with the sub-organization.
    • -
    • Automatically generates a new API key pair for authentication and session management.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • -
    • Handles both email and SMS OTP types, and supports additional sub-organization creation parameters.
    • +
    • + This function signs up a user using the verification token received after + OTP verification (from email or SMS). +
    • +
    • + Creates a new sub-organization for the user with the provided parameters and + associates the contact (email or phone) with the sub-organization. +
    • +
    • + Automatically generates a new API key pair for authentication and session + management. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • +
    • + Handles both email and SMS OTP types, and supports additional + sub-organization creation parameters. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1356

    +

    + Defined in:{" "} + + core.ts:1356 + +

    - + - -contact information for the user (e.g., email address or phone number). - - -parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -flag to invalidate existing session for the user. - - -type of OTP being used (OtpType.Email or OtpType.Sms). - - -session key to use for session creation (defaults to the default session key). - - -verification token received after OTP verification. - + + contact information for the user (e.g., email address or phone number). + + + parameters for creating a sub-organization (e.g., authenticators, user + metadata). + + + flag to invalidate existing session for the user. + + + type of OTP being used (OtpType.Email or OtpType.Sms). + + + session key to use for session creation (defaults to the default session + key). + + + verification token received after OTP verification. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/core/turnkey-client-sign-up-with-passkey.mdx b/generated-docs/formatted/core/turnkey-client-sign-up-with-passkey.mdx index a33871293..27640338b 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-up-with-passkey.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-up-with-passkey.mdx @@ -10,44 +10,94 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Signs up a user using a passkey, creating a new sub-organization and session.
      -
    • This function creates a new passkey authenticator and uses it to register a new sub-organization for the user.
    • -
    • Handles both passkey creation and sub-organization creation in a single flow.
    • -
    • Optionally accepts additional sub-organization parameters, a custom session key, a custom passkey display name, and a custom session expiration.
    • -
    • Automatically generates a new API key pair for authentication and session management.
    • -
    • Stores the resulting session token and manages cleanup of unused key pairs.
    • +
    • + This function creates a new passkey authenticator and uses it to register a + new sub-organization for the user. +
    • +
    • + Handles both passkey creation and sub-organization creation in a single + flow. +
    • +
    • + Optionally accepts additional sub-organization parameters, a custom session + key, a custom passkey display name, and a custom session expiration. +
    • +
    • + Automatically generates a new API key pair for authentication and session + management. +
    • +
    • + Stores the resulting session token and manages cleanup of unused key pairs. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:412

    +

    + Defined in:{" "} + + core.ts:412 + +

    - + - -challenge string to use for passkey registration. If not provided, a new challenge will be generated. - - -parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -session expiration time in seconds (defaults to the configured default). - - -display name for the passkey (defaults to a generated name based on the current timestamp). - - -session key to use for storing the session (defaults to the default session key). - + + challenge string to use for passkey registration. If not provided, a new + challenge will be generated. + + + parameters for creating a sub-organization (e.g., authenticators, user + metadata). + + + session expiration time in seconds (defaults to the configured default). + + + display name for the passkey (defaults to a generated name based on the + current timestamp). + + + session key to use for storing the session (defaults to the default + session key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a PasskeyAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `credentialId`: the credential ID associated with the passkey created. + + A promise that resolves to a PasskeyAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `credentialId`: the credential + ID associated with the passkey created. diff --git a/generated-docs/formatted/core/turnkey-client-sign-up-with-wallet.mdx b/generated-docs/formatted/core/turnkey-client-sign-up-with-wallet.mdx index 35cb096ee..2edcf0da5 100644 --- a/generated-docs/formatted/core/turnkey-client-sign-up-with-wallet.mdx +++ b/generated-docs/formatted/core/turnkey-client-sign-up-with-wallet.mdx @@ -10,41 +10,86 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Signs up a user using a wallet, creating a new sub-organization and session.
      -
    • This function creates a new wallet authenticator and uses it to register a new sub-organization for the user.
    • -
    • Handles both wallet authentication and sub-organization creation in a single flow.
    • -
    • Optionally accepts additional sub-organization parameters, a custom session key, and a custom session expiration.
    • -
    • Automatically generates additional API key pairs for authentication and session management.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided, and manages cleanup of unused key pairs.
    • +
    • + This function creates a new wallet authenticator and uses it to register a + new sub-organization for the user. +
    • +
    • + Handles both wallet authentication and sub-organization creation in a single + flow. +
    • +
    • + Optionally accepts additional sub-organization parameters, a custom session + key, and a custom session expiration. +
    • +
    • + Automatically generates additional API key pairs for authentication and + session management. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided, and manages cleanup of unused key + pairs. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:797

    +

    + Defined in:{" "} + + core.ts:797 + +

    - + - -parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -session expiration time in seconds (defaults to the configured default). - - -session key to use for storing the session (defaults to the default session key). - - -wallet provider to use for authentication. - + + parameters for creating a sub-organization (e.g., authenticators, user + metadata). + + + session expiration time in seconds (defaults to the configured default). + + + session key to use for storing the session (defaults to the default + session key). + + + wallet provider to use for authentication. + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to a WalletAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `address`: the authenticated wallet address. + + A promise that resolves to a WalletAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `address`: the authenticated + wallet address. diff --git a/generated-docs/formatted/core/turnkey-client-store-session.mdx b/generated-docs/formatted/core/turnkey-client-store-session.mdx index e4468624a..a157fa2e6 100644 --- a/generated-docs/formatted/core/turnkey-client-store-session.mdx +++ b/generated-docs/formatted/core/turnkey-client-store-session.mdx @@ -10,33 +10,66 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Stores a session token and updates the session associated with the specified session key, or by default the active session.
      -
    • This function parses and stores a signed JWT session token in local storage, associating it with the given session key.
    • -
    • If a sessionKey is provided, the session will be stored under that key; otherwise, it will use the default session key.
    • -
    • If a session already exists for the session key, its associated key pair will be deleted before storing the new session.
    • -
    • After storing the session, any unused key pairs are automatically cleared from storage.
    • -
    • Ensures that session management is consistent and prevents orphaned key pairs.
    • +
    • + This function parses and stores a signed JWT session token in local storage, + associating it with the given session key. +
    • +
    • + If a sessionKey is provided, the session will be stored under that key; + otherwise, it will use the default session key. +
    • +
    • + If a session already exists for the session key, its associated key pair + will be deleted before storing the new session. +
    • +
    • + After storing the session, any unused key pairs are automatically cleared + from storage. +
    • +
    • + Ensures that session management is consistent and prevents orphaned key + pairs. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:3778

    +

    + Defined in:{" "} + + core.ts:3778 + +

    - + - -session key to store the session under (defaults to the default session key). - - -JWT session token to store. - + + session key to store the session under (defaults to the default session + key). + + + JWT session token to store. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves when the session is successfully stored. diff --git a/generated-docs/formatted/core/turnkey-client-switch-wallet-account-chain.mdx b/generated-docs/formatted/core/turnkey-client-switch-wallet-account-chain.mdx index d759307b6..d9532b358 100644 --- a/generated-docs/formatted/core/turnkey-client-switch-wallet-account-chain.mdx +++ b/generated-docs/formatted/core/turnkey-client-switch-wallet-account-chain.mdx @@ -16,29 +16,53 @@ Switches the wallet provider associated with a given wallet account to a differe
  • Does nothing if the provider is already on the desired chain.
  • -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:625

    +

    + Defined in:{" "} + + core.ts:625 + +

    - + - -The target chain, specified as a chain ID string or a SwitchableChain object. - - -The wallet account whose provider should be switched. - - -Optional list of wallet providers to search; falls back to `fetchWalletProviders()` if omitted. - + + The target chain, specified as a chain ID string or a SwitchableChain + object. + + + The wallet account whose provider should be switched. + + + Optional list of wallet providers to search; falls back to + `fetchWalletProviders()` if omitted. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves once the chain switch is complete. diff --git a/generated-docs/formatted/core/turnkey-client-update-user-email.mdx b/generated-docs/formatted/core/turnkey-client-update-user-email.mdx index 06c31f0d1..8cd174c56 100644 --- a/generated-docs/formatted/core/turnkey-client-update-user-email.mdx +++ b/generated-docs/formatted/core/turnkey-client-update-user-email.mdx @@ -10,39 +10,83 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Updates the user's email address.
      -
    • This function updates the user's email address and, if provided, verifies it using a verification token (typically from an OTP flow).
    • -
    • If a userId is provided, it updates the email for that specific user; otherwise, it uses the current session's userId.
    • -
    • If a verificationToken is not provided, the email will be updated but will not be marked as verified.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Handles session management and error reporting for both update and verification flows.
    • +
    • + This function updates the user's email address and, if provided, verifies it + using a verification token (typically from an OTP flow). +
    • +
    • + If a userId is provided, it updates the email for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + If a verificationToken is not provided, the email will be updated but will + not be marked as verified. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Handles session management and error reporting for both update and + verification flows. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2693

    +

    + Defined in:{" "} + + core.ts:2693 + +

    - + - -new email address to set for the user. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to update a specific user's email (defaults to the current session's userId). - - -verification token from OTP email verification (required if verifying the email). - + + new email address to set for the user. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to update a specific user's email (defaults to the current + session's userId). + + + verification token from OTP email verification (required if verifying the + email). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the userId of the updated user. diff --git a/generated-docs/formatted/core/turnkey-client-update-user-name.mdx b/generated-docs/formatted/core/turnkey-client-update-user-name.mdx index 0d3f33bd4..162b5e321 100644 --- a/generated-docs/formatted/core/turnkey-client-update-user-name.mdx +++ b/generated-docs/formatted/core/turnkey-client-update-user-name.mdx @@ -11,35 +11,67 @@ Updates the user's name.
    • This function updates the user's display name.
    • -
    • If a userId is provided, it updates the name for that specific user; otherwise, it uses the current session's userId.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + If a userId is provided, it updates the name for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    • Handles session management and error reporting for the update flow.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2924

    +

    + Defined in:{" "} + + core.ts:2924 + +

    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to update a specific user's name (defaults to the current session's userId). - - -new name to set for the user. - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to update a specific user's name (defaults to the current + session's userId). + + + new name to set for the user. + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the userId of the updated user. diff --git a/generated-docs/formatted/core/turnkey-client-update-user-phone-number.mdx b/generated-docs/formatted/core/turnkey-client-update-user-phone-number.mdx index e0d677802..42c5aeaea 100644 --- a/generated-docs/formatted/core/turnkey-client-update-user-phone-number.mdx +++ b/generated-docs/formatted/core/turnkey-client-update-user-phone-number.mdx @@ -10,39 +10,83 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Updates the user's phone number.
      -
    • This function updates the user's phone number and, if provided, verifies it using a verification token (from an OTP flow).
    • -
    • If a userId is provided, it updates the phone number for that specific user; otherwise, it uses the current session's userId.
    • -
    • If a verificationToken is not provided, the phone number will be updated but will not be marked as verified.
    • -
    • Automatically ensures an active session exists before making the request.
    • -
    • Handles session management and error reporting for both update and verification flows.
    • +
    • + This function updates the user's phone number and, if provided, verifies it + using a verification token (from an OTP flow). +
    • +
    • + If a userId is provided, it updates the phone number for that specific user; + otherwise, it uses the current session's userId. +
    • +
    • + If a verificationToken is not provided, the phone number will be updated but + will not be marked as verified. +
    • +
    • + Automatically ensures an active session exists before making the request. +
    • +
    • + Handles session management and error reporting for both update and + verification flows. +
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:2815

    +

    + Defined in:{" "} + + core.ts:2815 + +

    - + - -new phone number to set for the user. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -user ID to update a specific user's phone number (defaults to the current session's userId). - - -verification token from OTP phone verification (required if verifying the phone number). - + + new phone number to set for the user. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + user ID to update a specific user's phone number (defaults to the current + session's userId). + + + verification token from OTP phone verification (required if verifying the + phone number). + - -A successful response returns the following fields: +A successful response returns the following +fields: - + A promise that resolves to the userId of the updated user. diff --git a/generated-docs/formatted/core/turnkey-client-verify-otp.mdx b/generated-docs/formatted/core/turnkey-client-verify-otp.mdx index 036dc33c1..cc465afc3 100644 --- a/generated-docs/formatted/core/turnkey-client-verify-otp.mdx +++ b/generated-docs/formatted/core/turnkey-client-verify-otp.mdx @@ -10,44 +10,90 @@ import { NestedParam } from "/snippets/nested-param.mdx"; Verifies the OTP code sent to the user.
      -
    • This function verifies the OTP code entered by the user against the OTP sent to their contact information (email or phone) using the auth proxy.
    • -
    • If verification is successful, it returns the sub-organization ID associated with the contact (if it exists) and a verification token.
    • -
    • The verification token can be used for subsequent login or sign-up flows.
    • +
    • + This function verifies the OTP code entered by the user against the OTP sent + to their contact information (email or phone) using the auth proxy. +
    • +
    • + If verification is successful, it returns the sub-organization ID associated + with the contact (if it exists) and a verification token. +
    • +
    • + The verification token can be used for subsequent login or sign-up flows. +
    • Handles both email and SMS OTP types.
    -

    Package: core

    +

    + Package: core +

    -

    Defined in: core.ts:1202

    +

    + Defined in:{" "} + + core.ts:1202 + +

    - + - -contact information for the user (e.g., email address or phone number). - - -OTP code entered by the user. - - -ID of the OTP to verify (returned from `initOtp`). - - -type of OTP being verified (OtpType.Email or OtpType.Sms). - + + contact information for the user (e.g., email address or phone number). + + + OTP code entered by the user. + + + ID of the OTP to verify (returned from `initOtp`). + + + type of OTP being verified (OtpType.Email or OtpType.Sms). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - A promise that resolves to an object containing: - - subOrganizationId: sub-organization ID if the contact is already associated with a sub-organization, or an empty string if not. - - verificationToken: verification token to be used for login or sign-up. + + A promise that resolves to an object containing: - subOrganizationId: + sub-organization ID if the contact is already associated with a + sub-organization, or an empty string if not. - verificationToken: verification + token to be used for login or sign-up. - - + + diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-complete-oauth.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-complete-oauth.mdx index ffb58ba81..85bb8788d 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-complete-oauth.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-complete-oauth.mdx @@ -5,50 +5,100 @@ title: "completeOauth()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Completes the OAuth authentication flow by either signing up or logging in the user, depending on whether a sub-organization already exists for the provided OIDC token.
      -
    • This function first checks if there is an existing sub-organization associated with the OIDC token.
    • +
    • + This function first checks if there is an existing sub-organization + associated with the OIDC token. +
    • If a sub-organization exists, it proceeds with the OAuth login flow.
    • -
    • If no sub-organization exists, it creates a new sub-organization and completes the sign-up flow.
    • -
    • Optionally accepts a custom OAuth provider name, session key, and additional sub-organization creation parameters.
    • -
    • Handles session storage and management, and supports invalidating existing sessions if specified.
    • +
    • + If no sub-organization exists, it creates a new sub-organization and + completes the sign-up flow. +
    • +
    • + Optionally accepts a custom OAuth provider name, session key, and additional + sub-organization creation parameters. +
    • +
    • + Handles session storage and management, and supports invalidating existing + sessions if specified. +
    - + - -parameters for sub-organization creation (e.g., authenticators, user metadata). - - -flag to invalidate existing sessions for the user. - - -OIDC token received after successful authentication with the OAuth provider. - - -name of the OAuth provider (defaults to a generated name with a timestamp). - - -public key to use for authentication. Must be generated prior to calling this function, this is because the OIDC nonce has to be set to `sha256(publicKey)`. - - -session key to use for session creation (defaults to the default session key). - + + parameters for sub-organization creation (e.g., authenticators, user + metadata). + + + flag to invalidate existing sessions for the user. + + + OIDC token received after successful authentication with the OAuth + provider. + + + name of the OAuth provider (defaults to a generated name with a + timestamp). + + + public key to use for authentication. Must be generated prior to calling + this function, this is because the OIDC nonce has to be set to + `sha256(publicKey)`. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to an object containing: - - `sessionToken`: the signed JWT session token. - - `action`: whether the flow resulted in a login or signup (AuthAction). + A promise that resolves to an object containing: - `sessionToken`: the signed + JWT session token. - `action`: whether the flow resulted in a login or signup + (AuthAction). diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-complete-otp.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-complete-otp.mdx index adc96fe6a..ebba67c9b 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-complete-otp.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-complete-otp.mdx @@ -5,57 +5,114 @@ title: "completeOtp()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Completes the OTP authentication flow by verifying the OTP code and then either signing up or logging in the user.
      -
    • This function first verifies the OTP code for the provided contact and OTP type.
    • -
    • If the contact is not associated with an existing sub-organization, it will automatically create a new sub-organization and complete the sign-up flow.
    • -
    • If the contact is already associated with a sub-organization, it will complete the login flow.
    • -
    • Supports passing a custom public key for authentication, invalidating existing session, specifying a session key, and providing additional sub-organization creation parameters.
    • +
    • + This function first verifies the OTP code for the provided contact and OTP + type. +
    • +
    • + If the contact is not associated with an existing sub-organization, it will + automatically create a new sub-organization and complete the sign-up flow. +
    • +
    • + If the contact is already associated with a sub-organization, it will + complete the login flow. +
    • +
    • + Supports passing a custom public key for authentication, invalidating + existing session, specifying a session key, and providing additional + sub-organization creation parameters. +
    • Handles both email and SMS OTP types.
    - + - -contact information for the user (e.g., email address or phone number). - - -parameters for sub-organization creation (e.g., authenticators, user metadata). - - -flag to invalidate existing sessions for the user. - - -OTP code entered by the user. - - -ID of the OTP to complete (returned from `initOtp`). - - -type of OTP being completed (OtpType.Email or OtpType.Sms). - - -public key to use for authentication. If not provided, a new key pair may be generated. - - -session key to use for session creation (defaults to the default session key). - + + contact information for the user (e.g., email address or phone number). + + + parameters for sub-organization creation (e.g., authenticators, user + metadata). + + + flag to invalidate existing sessions for the user. + + + OTP code entered by the user. + + + ID of the OTP to complete (returned from `initOtp`). + + + type of OTP being completed (OtpType.Email or OtpType.Sms). + + + public key to use for authentication. If not provided, a new key pair may + be generated. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to an object containing: - - `sessionToken`: the signed JWT session token. - - `verificationToken`: the OTP verification token. - - `action`: whether the flow resulted in a login or signup (AuthAction). + A promise that resolves to an object containing: - `sessionToken`: the signed + JWT session token. - `verificationToken`: the OTP verification token. - + `action`: whether the flow resulted in a login or signup (AuthAction). diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-create-passkey.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-create-passkey.mdx index d727e1161..415b015d8 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-create-passkey.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-create-passkey.mdx @@ -5,43 +5,82 @@ title: "createPasskey()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Creates a new passkey authenticator for the user.
      -
    • This function generates a new passkey attestation and challenge, suitable for registration with the user's device.
    • -
    • Handles both web and React Native environments, automatically selecting the appropriate passkey creation flow.
    • -
    • The resulting attestation and challenge can be used to register the passkey with Turnkey.
    • +
    • + This function generates a new passkey attestation and challenge, suitable + for registration with the user's device. +
    • +
    • + Handles both web and React Native environments, automatically selecting the + appropriate passkey creation flow. +
    • +
    • + The resulting attestation and challenge can be used to register the passkey + with Turnkey. +
    - + - -challenge string to use for passkey registration. If not provided, a new challenge will be generated. - - -display name for the passkey (defaults to a generated name based on the current timestamp). - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - + + challenge string to use for passkey registration. If not provided, a new + challenge will be generated. + + + display name for the passkey (defaults to a generated name based on the + current timestamp). + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to an object containing: - - attestation: attestation object returned from the passkey creation process. - - encodedChallenge: encoded challenge string used for passkey registration. + A promise that resolves to an object containing: - attestation: attestation + object returned from the passkey creation process. - encodedChallenge: encoded + challenge string used for passkey registration. - - + + diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-fetch-wallets.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-fetch-wallets.mdx index 05143d3a9..37002c8f8 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-fetch-wallets.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-fetch-wallets.mdx @@ -5,35 +5,63 @@ title: "fetchWallets()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Fetches all wallets for the current user, including both embedded and connected wallets.
      -
    • Retrieves all wallets associated with the organizationId from the current active session.
    • -
    • For each embedded wallet, automatically fetches and attaches all associated wallet accounts.
    • -
    • For connected wallets (e.g., browser extensions or external providers), groups providers by wallet name and attaches all connected accounts.
    • -
    • Returns both embedded and connected wallets in a single array, each with their respective accounts populated.
    • -
    • Optionally allows stamping the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet).
    • +
    • + Retrieves all wallets associated with the organizationId from the current + active session. +
    • +
    • + For each embedded wallet, automatically fetches and attaches all associated + wallet accounts. +
    • +
    • + For connected wallets (e.g., browser extensions or external providers), + groups providers by wallet name and attaches all connected accounts. +
    • +
    • + Returns both embedded and connected wallets in a single array, each with + their respective accounts populated. +
    • +
    • + Optionally allows stamping the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). +
    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -array of wallet providers to use for fetching wallets. - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + array of wallet providers to use for fetching wallets. + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to an array of `Wallet` objects. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-email.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-email.mdx index ee6e6a356..b1eea9cb6 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-email.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-email.mdx @@ -5,45 +5,92 @@ title: "handleAddEmail()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:516

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:516 + +

    Handles the add user email flow.
      -
    • This function opens a modal with the UpdateEmail component, using a modified title and flow for adding and verifying the user's email address.
    • -
    • If an email is provided, it will immediately send an OTP request to the user and display the OTP verification modal.
    • -
    • Supports both manual entry and pre-filled email addresses, as well as custom modal titles and subtitles.
    • -
    • Uses the addEmailContinue helper to manage the OTP flow, verification, and update logic.
    • -
    • After successful verification and update, the user details state is refreshed and an optional success page can be shown.
    • +
    • + This function opens a modal with the UpdateEmail component, using a modified + title and flow for adding and verifying the user's email address. +
    • +
    • + If an email is provided, it will immediately send an OTP request to the user + and display the OTP verification modal. +
    • +
    • + Supports both manual entry and pre-filled email addresses, as well as custom + modal titles and subtitles. +
    • +
    • + Uses the addEmailContinue helper to manage the OTP flow, verification, and + update logic. +
    • +
    • + After successful verification and update, the user details state is + refreshed and an optional success page can be shown. +
    • Supports customizing the duration of the success page after update.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - -parameter to specify the new email address. - - -subtitle for the modal. - - -duration (in ms) for the success page after update (default: 0, no success page). - - -title for the modal (defaults to "Connect an email" if the user does not have an email). - + + parameter to specify the new email address. + + + subtitle for the modal. + + + duration (in ms) for the success page after update (default: 0, no success + page). + + + title for the modal (defaults to "Connect an email" if the user does not + have an email). + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the userId of the user that was changed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-oauth-provider.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-oauth-provider.mdx index 05f4f6691..4b4a454b0 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-oauth-provider.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-oauth-provider.mdx @@ -5,39 +5,80 @@ title: "handleAddOauthProvider()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:568

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:568 + +

    Handles the addition of an OAuth provider for the user.
      -
    • This function opens a modal-driven flow for linking a new OAuth provider (Google, Apple, or Facebook) to the user's account.
    • -
    • It supports all enabled OAuth providers as defined in the configuration and dynamically triggers the appropriate OAuth flow.
    • -
    • Uses the handleGoogleOauth, handleAppleOauth, and handleFacebookOauth functions to initiate the provider-specific OAuth authentication process.
    • -
    • After successful authentication, the provider is linked to the user's account and a success page is shown.
    • -
    • Automatically refreshes the user details state after linking to ensure the latest provider list is available in the provider.
    • -
    • Optionally allows specifying the stamper to use for the addition (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + This function opens a modal-driven flow for linking a new OAuth provider + (Google, Apple, or Facebook) to the user's account. +
    • +
    • + It supports all enabled OAuth providers as defined in the configuration and + dynamically triggers the appropriate OAuth flow. +
    • +
    • + Uses the handleGoogleOauth, handleAppleOauth, and handleFacebookOauth + functions to initiate the provider-specific OAuth authentication process. +
    • +
    • + After successful authentication, the provider is linked to the user's + account and a success page is shown. +
    • +
    • + Automatically refreshes the user details state after linking to ensure the + latest provider list is available in the provider. +
    • +
    • + Optionally allows specifying the stamper to use for the addition + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for + granular authentication control. +
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - -The name of the OAuth provider to add (OAuthProviders.GOOGLE, OAuthProviders.APPLE, OAuthProviders.FACEBOOK). - - -parameter to specify the stamper to use for the addition (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - + + The name of the OAuth provider to add (OAuthProviders.GOOGLE, + OAuthProviders.APPLE, OAuthProviders.FACEBOOK). + + + parameter to specify the stamper to use for the addition + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + - -A successful response returns the following fields: +A successful response returns the following +fields: A void promise. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-passkey.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-passkey.mdx index b5ea753b5..92edea192 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-passkey.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-passkey.mdx @@ -5,48 +5,106 @@ title: "handleAddPasskey()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:621

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:621 + +

    Handles the addition of a passkey (authenticator) for the user.
      -
    • This function opens a modal-driven flow for adding a new passkey authenticator (WebAuthn/FIDO2) to the user's account.
    • -
    • If a ``name`` or ``displayName`` is provided, those will be used for the passkey metadata; otherwise, defaults are generated based on the website and timestamp.
    • -
    • The passkey is created and linked to the specified user (by ``userId``) or the current session's user if not provided.
    • -
    • After successful addition, a success page is shown for the specified duration (or skipped if ``successPageDuration`` is 0).
    • -
    • Supports stamping the request with a specific stamper (``StamperType.Passkey``, ``StamperType.ApiKey``, or ``StamperType.Wallet``) for granular authentication control.
    • -
    • Automatically refreshes the user details state after successful addition to ensure the latest authenticators list is available in the provider.
    • -
    • Handles all error cases and throws a ``TurnkeyError`` with appropriate error codes.
    • +
    • + This function opens a modal-driven flow for adding a new passkey + authenticator (WebAuthn/FIDO2) to the user's account. +
    • +
    • + If a ``name`` or ``displayName`` is provided, those will be used for the + passkey metadata; otherwise, defaults are generated based on the website and + timestamp. +
    • +
    • + The passkey is created and linked to the specified user (by ``userId``) or + the current session's user if not provided. +
    • +
    • + After successful addition, a success page is shown for the specified + duration (or skipped if ``successPageDuration`` is 0). +
    • +
    • + Supports stamping the request with a specific stamper + (``StamperType.Passkey``, ``StamperType.ApiKey``, or ``StamperType.Wallet``) + for granular authentication control. +
    • +
    • + Automatically refreshes the user details state after successful addition to + ensure the latest authenticators list is available in the provider. +
    • +
    • + Handles all error cases and throws a ``TurnkeyError`` with appropriate error + codes. +
    - + - -display name for the passkey (shown to the user in the UI). - - -internal name for the passkey (for backend or developer reference). - - -parameter to stamp the request with a specific stamper (`StamperType.Passkey`, `StamperType.ApiKey`, or `StamperType.Wallet`). - - -duration (in ms) for the success page after addition (default: 0, no success page). - - -user ID to add the passkey for a specific user (defaults to current session's userId). - + + display name for the passkey (shown to the user in the UI). + + + internal name for the passkey (for backend or developer reference). + + + parameter to stamp the request with a specific stamper + (`StamperType.Passkey`, `StamperType.ApiKey`, or `StamperType.Wallet`). + + + duration (in ms) for the success page after addition (default: 0, no + success page). + + + user ID to add the passkey for a specific user (defaults to current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the user's updated passkeys. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-phone-number.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-phone-number.mdx index e686ceeee..52dc79ff6 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-phone-number.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-add-phone-number.mdx @@ -5,48 +5,99 @@ title: "handleAddPhoneNumber()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:543

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:543 + +

    Handles the add phone number flow.
      -
    • This function opens a modal with the UpdatePhoneNumber component for adding and verifying the user's phone number.
    • -
    • If a phone number is provided, it will immediately send an OTP request to the user and display the OTP verification modal.
    • -
    • Supports both manual entry and pre-filled phone numbers, as well as custom modal titles and subtitles.
    • -
    • Uses the addPhoneNumberContinue helper to manage the OTP flow, verification, and update logic.
    • -
    • After successful verification and update, the user details state is refreshed and an optional success page can be shown.
    • +
    • + This function opens a modal with the UpdatePhoneNumber component for adding + and verifying the user's phone number. +
    • +
    • + If a phone number is provided, it will immediately send an OTP request to + the user and display the OTP verification modal. +
    • +
    • + Supports both manual entry and pre-filled phone numbers, as well as custom + modal titles and subtitles. +
    • +
    • + Uses the addPhoneNumberContinue helper to manage the OTP flow, verification, + and update logic. +
    • +
    • + After successful verification and update, the user details state is + refreshed and an optional success page can be shown. +
    • Supports customizing the duration of the success page after update.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - -parameter to specify the formatted phone number. - - -parameter to specify the new phone number. - - -subtitle for the modal. - - -duration (in ms) for the success page after update (default: 0, no success page). - - -title for the modal. - + + parameter to specify the formatted phone number. + + + parameter to specify the new phone number. + + + subtitle for the modal. + + + duration (in ms) for the success page after update (default: 0, no success + page). + + + title for the modal. + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the userId of the user that was changed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-apple-oauth.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-apple-oauth.mdx index a8e58b8e1..ab425587d 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-apple-oauth.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-apple-oauth.mdx @@ -5,24 +5,61 @@ title: "handleAppleOauth()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:247

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:247 + +

    Handles the Apple OAuth flow.
      -
    • This function initiates the Apple OAuth flow by either redirecting the user to the Apple authorization page or opening it in a popup window.
    • -
    • The flow type is determined by the ``openInPage`` parameter: if true, the current page is redirected; if false (default), a popup window is used.
    • -
    • Generates a new ephemeral API key pair and uses its public key as the nonce for the OAuth request, ensuring cryptographic binding of the session.
    • -
    • Constructs the Apple OAuth URL with all required parameters, including client ID, redirect URI, response type, response mode, nonce, and state.
    • -
    • The ``state`` parameter includes the provider, flow type, public key, and any additional state parameters for tracking or custom logic.
    • -
    • If ``openInPage`` is true, the function redirects and returns a promise that resolves on redirect or times out after 5 minutes.
    • -
    • If ``openInPage`` is false, a popup window is opened and the function returns a promise that resolves when the flow completes, or rejects if the window is closed or times out.
    • -
    • On successful authentication, the function either calls the provided ``onOauthSuccess`` callback, triggers the ``onOauthRedirect`` callback from provider callbacks, or completes the OAuth flow internally by calling ``completeOauth``.
    • -
    • Handles all error cases, including missing configuration, popup failures, and timeouts, and throws a ``TurnkeyError`` with appropriate error codes.
    • +
    • + This function initiates the Apple OAuth flow by either redirecting the user + to the Apple authorization page or opening it in a popup window. +
    • +
    • + The flow type is determined by the ``openInPage`` parameter: if true, the + current page is redirected; if false (default), a popup window is used. +
    • +
    • + Generates a new ephemeral API key pair and uses its public key as the nonce + for the OAuth request, ensuring cryptographic binding of the session. +
    • +
    • + Constructs the Apple OAuth URL with all required parameters, including + client ID, redirect URI, response type, response mode, nonce, and state. +
    • +
    • + The ``state`` parameter includes the provider, flow type, public key, and + any additional state parameters for tracking or custom logic. +
    • +
    • + If ``openInPage`` is true, the function redirects and returns a promise that + resolves on redirect or times out after 5 minutes. +
    • +
    • + If ``openInPage`` is false, a popup window is opened and the function + returns a promise that resolves when the flow completes, or rejects if the + window is closed or times out. +
    • +
    • + On successful authentication, the function either calls the provided + ``onOauthSuccess`` callback, triggers the ``onOauthRedirect`` callback from + provider callbacks, or completes the OAuth flow internally by calling + ``completeOauth``. +
    • +
    • + Handles all error cases, including missing configuration, popup failures, + and timeouts, and throws a ``TurnkeyError`` with appropriate error codes. +
    @@ -39,18 +76,20 @@ The Apple Client ID to use (defaults to the client ID from configuration). Callback function to handle the successful OAuth response (receives `{ oidcToken, providerName }`). onOauthSuccess params: + - oidcToken: The OIDC token received from the OAuth flow. - providerName: The name of the OAuth provider ("apple"). - + Whether to open the OAuth flow in the current page (redirect) or a popup window (default: false).
    - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout. + A promise that resolves when the OAuth flow is successfully initiated and + completed, or rejects on error or timeout. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-private-key.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-private-key.mdx index b9a337367..663e02b77 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-private-key.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-private-key.mdx @@ -5,47 +5,103 @@ title: "handleExportPrivateKey()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:336

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:336 + +

    handles the export private key flow.
      -
    • This function opens a modal with the ExportComponent for exporting a private key.
    • -
    • Uses Turnkey's export iframe flow to securely export private key material.
    • -
    • The export process encrypts the exported bundle to a target public key, which is generated and managed inside the iframe for maximum security.
    • -
    • A request is made to the Turnkey API to export the private key, encrypted to the target public key.
    • -
    • The resulting export bundle is injected into the iframe, where it is decrypted and displayed to the user.
    • -
    • If a custom iframe URL is used, a target public key can be provided explicitly.
    • -
    • Hexadecimal and Solana address formats are supported for wallet account exports - defaulting to Hexadecimal if not specified.
    • -
    • Optionally allows specifying the stamper to use for the export (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • The modal-driven UI ensures the user is guided through the export process and can securely retrieve their exported material.
    • +
    • + This function opens a modal with the ExportComponent for exporting a private + key. +
    • +
    • + Uses Turnkey's export iframe flow to securely export private key material. +
    • +
    • + The export process encrypts the exported bundle to a target public key, + which is generated and managed inside the iframe for maximum security. +
    • +
    • + A request is made to the Turnkey API to export the private key, encrypted to + the target public key. +
    • +
    • + The resulting export bundle is injected into the iframe, where it is + decrypted and displayed to the user. +
    • +
    • + If a custom iframe URL is used, a target public key can be provided + explicitly. +
    • +
    • + Hexadecimal and Solana address formats are supported for wallet account + exports - defaulting to Hexadecimal if not specified. +
    • +
    • + Optionally allows specifying the stamper to use for the export + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for + granular authentication control. +
    • +
    • + The modal-driven UI ensures the user is guided through the export process + and can securely retrieve their exported material. +
    - + - -The format of the private key to export (KeyFormat.Hexadecimal or KeyFormat.Solana). - - -The ID of the private key to export. - - -The stamper to use for the export (Passkey, ApiKey, or Wallet). - - -The target public key to encrypt the export bundle to (required for custom iframe flows). - + + The format of the private key to export (KeyFormat.Hexadecimal or + KeyFormat.Solana). + + + The ID of the private key to export. + + + The stamper to use for the export (Passkey, ApiKey, or Wallet). + + + The target public key to encrypt the export bundle to (required for custom + iframe flows). + - -A successful response returns the following fields: +A successful response returns the following +fields: A void promise. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet-account.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet-account.mdx index 7dd3a648c..7d3e0f9a0 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet-account.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet-account.mdx @@ -5,47 +5,104 @@ title: "handleExportWalletAccount()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:364

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:364 + +

    Handles the export wallet account flow.
      -
    • This function opens a modal with the ExportComponent for exporting a wallet account.
    • -
    • Uses Turnkey's export iframe flow to securely export wallet account material.
    • -
    • The export process encrypts the exported bundle to a target public key, which is generated and managed inside the iframe for maximum security.
    • -
    • A request is made to the Turnkey API to export the wallet account, encrypted to the target public key.
    • -
    • The resulting export bundle is injected into the iframe, where it is decrypted and displayed to the user.
    • -
    • If a custom iframe URL is used, a target public key can be provided explicitly.
    • -
    • Hexadecimal and Solana address formats are supported for wallet account exports - defaulting to Hexadecimal if not specified.
    • -
    • Optionally allows specifying the stamper to use for the export (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • The modal-driven UI ensures the user is guided through the export process and can securely retrieve their exported material.
    • +
    • + This function opens a modal with the ExportComponent for exporting a wallet + account. +
    • +
    • + Uses Turnkey's export iframe flow to securely export wallet account + material. +
    • +
    • + The export process encrypts the exported bundle to a target public key, + which is generated and managed inside the iframe for maximum security. +
    • +
    • + A request is made to the Turnkey API to export the wallet account, encrypted + to the target public key. +
    • +
    • + The resulting export bundle is injected into the iframe, where it is + decrypted and displayed to the user. +
    • +
    • + If a custom iframe URL is used, a target public key can be provided + explicitly. +
    • +
    • + Hexadecimal and Solana address formats are supported for wallet account + exports - defaulting to Hexadecimal if not specified. +
    • +
    • + Optionally allows specifying the stamper to use for the export + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for + granular authentication control. +
    • +
    • + The modal-driven UI ensures the user is guided through the export process + and can securely retrieve their exported material. +
    - + - -The address of the wallet account to export. - - -The format of the address to export (KeyFormat.Hexadecimal or KeyFormat.Solana). - - -The stamper to use for the export (Passkey, ApiKey, or Wallet). - - -The target public key to encrypt the export bundle to (required for custom iframe flows). - + + The address of the wallet account to export. + + + The format of the address to export (KeyFormat.Hexadecimal or + KeyFormat.Solana). + + + The stamper to use for the export (Passkey, ApiKey, or Wallet). + + + The target public key to encrypt the export bundle to (required for custom + iframe flows). + - -A successful response returns the following fields: +A successful response returns the following +fields: A void promise. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet.mdx index 7f7e275f1..5413fd9de 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-export-wallet.mdx @@ -5,43 +5,87 @@ title: "handleExportWallet()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:311

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:311 + +

    Handles the export wallet flow.
      -
    • This function opens a modal with the ExportComponent for exporting a wallet.
    • +
    • + This function opens a modal with the ExportComponent for exporting a wallet. +
    • Uses Turnkey's export iframe flow to securely export wallet material.
    • -
    • The export process encrypts the exported bundle to a target public key, which is generated and managed inside the iframe for maximum security.
    • -
    • A request is made to the Turnkey API to export the wallet, encrypted to the target public key.
    • -
    • The resulting export bundle is injected into the iframe, where it is decrypted and displayed to the user.
    • -
    • If a custom iframe URL is used, a target public key can be provided explicitly.
    • -
    • Optionally allows specifying the stamper to use for the export (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • The modal-driven UI ensures the user is guided through the export process and can securely retrieve their exported material.
    • +
    • + The export process encrypts the exported bundle to a target public key, + which is generated and managed inside the iframe for maximum security. +
    • +
    • + A request is made to the Turnkey API to export the wallet, encrypted to the + target public key. +
    • +
    • + The resulting export bundle is injected into the iframe, where it is + decrypted and displayed to the user. +
    • +
    • + If a custom iframe URL is used, a target public key can be provided + explicitly. +
    • +
    • + Optionally allows specifying the stamper to use for the export + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for + granular authentication control. +
    • +
    • + The modal-driven UI ensures the user is guided through the export process + and can securely retrieve their exported material. +
    - + - -The stamper to use for the export (Passkey, ApiKey, or Wallet). - - -The target public key to encrypt the export bundle to (required for custom iframe flows). - - -The ID of the wallet to export. - + + The stamper to use for the export (Passkey, ApiKey, or Wallet). + + + The target public key to encrypt the export bundle to (required for custom + iframe flows). + + + The ID of the wallet to export. + - -A successful response returns the following fields: +A successful response returns the following +fields: A void promise. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-facebook-oauth.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-facebook-oauth.mdx index f7ad6ae17..85fc1da89 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-facebook-oauth.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-facebook-oauth.mdx @@ -5,25 +5,65 @@ title: "handleFacebookOauth()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:283

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:283 + +

    Handles the Facebook OAuth flow.
      -
    • This function initiates the Facebook OAuth flow by either redirecting the user to the Facebook authorization page or opening it in a popup window.
    • -
    • The flow type is determined by the ``openInPage`` parameter: if true, the current page is redirected; if false (default), a popup window is used.
    • -
    • Generates a new ephemeral API key pair and uses its public key as the nonce for the OAuth request, ensuring cryptographic binding of the session.
    • -
    • Uses PKCE (Proof Key for Code Exchange) for enhanced security, generating a code verifier and challenge for the Facebook OAuth flow.
    • -
    • Constructs the Facebook OAuth URL with all required parameters, including client ID, redirect URI, response type, code challenge, nonce, and state.
    • -
    • The ``state`` parameter includes the provider, flow type, public key, and any additional state parameters for tracking or custom logic.
    • -
    • If ``openInPage`` is true, the function redirects and returns a promise that resolves on redirect or times out after 5 minutes.
    • -
    • If ``openInPage`` is false, a popup window is opened and the function returns a promise that resolves when the flow completes, or rejects if the window is closed or times out.
    • -
    • On successful authentication, the function either calls the provided ``onOauthSuccess`` callback, triggers the ``onOauthRedirect`` callback from provider callbacks, or completes the OAuth flow internally by calling ``completeOauth``.
    • -
    • Handles all error cases, including missing configuration, popup failures, and timeouts, and throws a ``TurnkeyError`` with appropriate error codes.
    • +
    • + This function initiates the Facebook OAuth flow by either redirecting the + user to the Facebook authorization page or opening it in a popup window. +
    • +
    • + The flow type is determined by the ``openInPage`` parameter: if true, the + current page is redirected; if false (default), a popup window is used. +
    • +
    • + Generates a new ephemeral API key pair and uses its public key as the nonce + for the OAuth request, ensuring cryptographic binding of the session. +
    • +
    • + Uses PKCE (Proof Key for Code Exchange) for enhanced security, generating a + code verifier and challenge for the Facebook OAuth flow. +
    • +
    • + Constructs the Facebook OAuth URL with all required parameters, including + client ID, redirect URI, response type, code challenge, nonce, and state. +
    • +
    • + The ``state`` parameter includes the provider, flow type, public key, and + any additional state parameters for tracking or custom logic. +
    • +
    • + If ``openInPage`` is true, the function redirects and returns a promise that + resolves on redirect or times out after 5 minutes. +
    • +
    • + If ``openInPage`` is false, a popup window is opened and the function + returns a promise that resolves when the flow completes, or rejects if the + window is closed or times out. +
    • +
    • + On successful authentication, the function either calls the provided + ``onOauthSuccess`` callback, triggers the ``onOauthRedirect`` callback from + provider callbacks, or completes the OAuth flow internally by calling + ``completeOauth``. +
    • +
    • + Handles all error cases, including missing configuration, popup failures, + and timeouts, and throws a ``TurnkeyError`` with appropriate error codes. +
    @@ -40,18 +80,20 @@ The Facebook Client ID to use (defaults to the client ID from configuration). Callback function to handle the successful OAuth response (receives `{ oidcToken, providerName }`). onOauthSuccess params: + - oidcToken: The OIDC token received from the OAuth flow. - providerName: The name of the OAuth provider ("facebook"). - + Whether to open the OAuth flow in the current page (redirect) or a popup window (default: false).
    - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout. + A promise that resolves when the OAuth flow is successfully initiated and + completed, or rejects on error or timeout. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-google-oauth.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-google-oauth.mdx index 7d163c1c8..85ca55b13 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-google-oauth.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-google-oauth.mdx @@ -5,24 +5,62 @@ title: "handleGoogleOauth()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:212

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:212 + +

    Handles the Google OAuth flow.
      -
    • This function initiates the Google OAuth flow by redirecting the user to the Google authorization page or opening it in a popup window.
    • -
    • It supports both "popup" and "redirect" flows, determined by the ``openInPage`` parameter.
    • -
    • Generates a new ephemeral API key pair and uses its public key as the nonce for the OAuth request, ensuring cryptographic binding of the session.
    • -
    • Constructs the Google OAuth URL with all required parameters, including client ID, redirect URI, response type, scope, nonce, and state.
    • -
    • The ``state`` parameter includes the provider, flow type, public key, and any additional state parameters for tracking or custom logic.
    • -
    • If ``openInPage`` is true, the current page is redirected to the Google OAuth URL and the function returns a promise that resolves on redirect or times out after 5 minutes.
    • -
    • If ``openInPage`` is false, a popup window is opened for the OAuth flow, and the function returns a promise that resolves when the flow completes or rejects if the window is closed or times out.
    • -
    • On successful authentication, the function either calls the provided ``onOauthSuccess`` callback, triggers the ``onOauthRedirect`` callback from provider callbacks, or completes the OAuth flow internally by calling ``completeOauth``.
    • -
    • Handles all error cases, including missing configuration, popup failures, and timeouts, and throws a ``TurnkeyError`` with appropriate error codes.
    • +
    • + This function initiates the Google OAuth flow by redirecting the user to the + Google authorization page or opening it in a popup window. +
    • +
    • + It supports both "popup" and "redirect" flows, determined by the + ``openInPage`` parameter. +
    • +
    • + Generates a new ephemeral API key pair and uses its public key as the nonce + for the OAuth request, ensuring cryptographic binding of the session. +
    • +
    • + Constructs the Google OAuth URL with all required parameters, including + client ID, redirect URI, response type, scope, nonce, and state. +
    • +
    • + The ``state`` parameter includes the provider, flow type, public key, and + any additional state parameters for tracking or custom logic. +
    • +
    • + If ``openInPage`` is true, the current page is redirected to the Google + OAuth URL and the function returns a promise that resolves on redirect or + times out after 5 minutes. +
    • +
    • + If ``openInPage`` is false, a popup window is opened for the OAuth flow, and + the function returns a promise that resolves when the flow completes or + rejects if the window is closed or times out. +
    • +
    • + On successful authentication, the function either calls the provided + ``onOauthSuccess`` callback, triggers the ``onOauthRedirect`` callback from + provider callbacks, or completes the OAuth flow internally by calling + ``completeOauth``. +
    • +
    • + Handles all error cases, including missing configuration, popup failures, + and timeouts, and throws a ``TurnkeyError`` with appropriate error codes. +
    @@ -39,18 +77,20 @@ The Google Client ID to use (defaults to the client ID from configuration). Callback function to handle the successful OAuth response (receives `{ oidcToken, providerName }`). onOauthSuccess params: + - oidcToken: The OIDC token received from the OAuth flow. - providerName: The name of the OAuth provider ("google"). - + Whether to open the OAuth flow in the current page (redirect) or a popup window (default: false).
    - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves when the OAuth flow is successfully initiated and completed, or rejects on error or timeout. + A promise that resolves when the OAuth flow is successfully initiated and + completed, or rejects on error or timeout. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-import-wallet.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-import-wallet.mdx index e1f128b5d..2f4015387 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-import-wallet.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-import-wallet.mdx @@ -5,41 +5,84 @@ title: "handleImportWallet()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:387

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:387 + +

    Handles the import wallet flow.
      -
    • This function opens a modal with the ImportComponent for importing a wallet.
    • -
    • Supports importing wallets using an encrypted bundle, with optional default accounts or custom account parameters.
    • -
    • Allows users to specify default wallet accounts (address formats or account params) to pre-fill the import form.
    • -
    • Supports customizing the duration of the success page shown after a successful import.
    • -
    • Allows specifying the stamper to use for the import (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • Ensures the imported wallet is added to the user's wallet list and the provider state is refreshed.
    • +
    • + This function opens a modal with the ImportComponent for importing a wallet. +
    • +
    • + Supports importing wallets using an encrypted bundle, with optional default + accounts or custom account parameters. +
    • +
    • + Allows users to specify default wallet accounts (address formats or account + params) to pre-fill the import form. +
    • +
    • + Supports customizing the duration of the success page shown after a + successful import. +
    • +
    • + Allows specifying the stamper to use for the import (StamperType.Passkey, + StamperType.ApiKey, or StamperType.Wallet) for granular authentication + control. +
    • +
    • + Ensures the imported wallet is added to the user's wallet list and the + provider state is refreshed. +
    - + - -array of default wallet accounts (v1AddressFormat[] or v1WalletAccountParams[]) to pre-fill the import form. - - -parameter to specify the stamper to use for the import (Passkey, ApiKey, or Wallet). - - -duration (in ms) for the success page after import (default: 0, no success page). - + + array of default wallet accounts (v1AddressFormat[] or + v1WalletAccountParams[]) to pre-fill the import form. + + + parameter to specify the stamper to use for the import (Passkey, ApiKey, + or Wallet). + + + duration (in ms) for the success page after import (default: 0, no success + page). + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the new wallet's ID. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-link-external-wallet.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-link-external-wallet.mdx new file mode 100644 index 000000000..72c32c5cb --- /dev/null +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-link-external-wallet.mdx @@ -0,0 +1,40 @@ +--- +title: "handleLinkExternalWallet()" +--- + +import { H3Bordered } from "/snippets/h3-bordered.mdx"; +import { NestedParam } from "/snippets/nested-param.mdx"; + +

    Package: react-wallet-kit

    + +

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:596

    + + + +Handles the linking of an external wallet account to the user's Turnkey account. + +
      +
    • This function opens a modal with the LinkWalletModal component, allowing the user to select and connect an external wallet provider (such as MetaMask, Phantom, etc.).
    • +
    • It fetches the list of available wallet providers (for all supported chains) and passes them to the modal for user selection.
    • +
    • After a successful wallet connection, the provider state is refreshed to include the newly linked wallet account.
    • +
    • Optionally, a success page is shown for the specified duration after linking (default: 2000ms).
    • +
    • Supports both Ethereum and Solana wallet providers, and can be extended to additional chains as supported by Turnkey.
    • +
    • Handles all error cases and throws a TurnkeyError with appropriate error codes if the client is not initialized or no active session is found.
    • +
    + + + + + + +duration (in ms) for the success page after linking (default: 2000ms). + + + + + +A successful response returns the following fields: + + + A void promise. + diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-login.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-login.mdx index 134ca45e4..de064acaf 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-login.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-login.mdx @@ -5,34 +5,63 @@ title: "handleLogin()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:111

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:111 + +

    Handles the login or sign-up flow.
      -
    • This function opens a modal with the AuthComponent, allowing the user to log in or sign up using any enabled authentication method (Passkey, Wallet, OTP, or OAuth).
    • -
    • It automatically determines available authentication methods based on the current provider configuration and proxy settings.
    • -
    • The modal-driven flow guides the user through the appropriate authentication steps, including social login if enabled.
    • -
    • After successful authentication, the provider state is updated and all relevant session, user, and wallet data are refreshed.
    • -
    • This function is typically used to trigger authentication from a UI button or navigation event.
    • +
    • + This function opens a modal with the AuthComponent, allowing the user to log + in or sign up using any enabled authentication method (Passkey, Wallet, OTP, + or OAuth). +
    • +
    • + It automatically determines available authentication methods based on the + current provider configuration and proxy settings. +
    • +
    • + The modal-driven flow guides the user through the appropriate authentication + steps, including social login if enabled. +
    • +
    • + After successful authentication, the provider state is updated and all + relevant session, user, and wallet data are refreshed. +
    • +
    • + This function is typically used to trigger authentication from a UI button + or navigation event. +
    - + - -Optional session key to resume an existing session or pre-fill session details in the login modal. - + + Optional session key to resume an existing session or pre-fill session + details in the login modal. + - -A successful response returns the following fields: +A successful response returns the following +fields: A void promise. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-oauth-provider.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-oauth-provider.mdx index 2d32dba90..6504bfcf4 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-oauth-provider.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-oauth-provider.mdx @@ -5,48 +5,105 @@ title: "handleRemoveOauthProvider()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:593

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:593 + +

    Handles the removal of an OAuth provider.
      -
    • This function opens a modal with the RemoveOAuthProvider component, allowing the user to confirm and remove an OAuth provider (such as Google, Apple, or Facebook) from their account.
    • -
    • It supports specifying the provider ID to remove, as well as optional modal title and subtitle for custom UI messaging.
    • -
    • After successful removal, the user details state is refreshed to reflect the updated list of linked OAuth providers.
    • -
    • Optionally, a callback can be provided to handle successful removal, receiving the updated list of provider IDs.
    • -
    • Supports customizing the duration of the success page shown after removal.
    • -
    • Allows specifying the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + This function opens a modal with the RemoveOAuthProvider component, allowing + the user to confirm and remove an OAuth provider (such as Google, Apple, or + Facebook) from their account. +
    • +
    • + It supports specifying the provider ID to remove, as well as optional modal + title and subtitle for custom UI messaging. +
    • +
    • + After successful removal, the user details state is refreshed to reflect the + updated list of linked OAuth providers. +
    • +
    • + Optionally, a callback can be provided to handle successful removal, + receiving the updated list of provider IDs. +
    • +
    • + Supports customizing the duration of the success page shown after removal. +
    • +
    • + Allows specifying the stamper to use for the removal (StamperType.Passkey, + StamperType.ApiKey, or StamperType.Wallet) for granular authentication + control. +
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - -The ID of the OAuth provider to remove (as found in the user's provider list). - - -parameter to specify the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -subtitle for the modal. - - -duration (in ms) for the success page after removal (default: 0, no success page). - - -title for the modal. - + + The ID of the OAuth provider to remove (as found in the user's provider + list). + + + parameter to specify the stamper to use for the removal + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + subtitle for the modal. + + + duration (in ms) for the success page after removal (default: 0, no + success page). + + + title for the modal. + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to an array of provider IDs that were removed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-passkey.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-passkey.mdx index f359cb799..d3f21bbeb 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-passkey.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-passkey.mdx @@ -5,50 +5,108 @@ title: "handleRemovePasskey()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:649

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:649 + +

    Handles the removal of a passkey (authenticator) for the user.
      -
    • This function opens a modal with the RemovePasskey component, allowing the user to confirm and remove a passkey authenticator from their account.
    • -
    • It supports specifying the authenticator ID to remove, as well as optional modal title and subtitle for custom UI messaging.
    • -
    • After successful removal, the user details state is refreshed to reflect the updated list of authenticators.
    • -
    • Supports customizing the duration of the success page shown after removal.
    • -
    • Allows specifying the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet) for granular authentication control.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + This function opens a modal with the RemovePasskey component, allowing the + user to confirm and remove a passkey authenticator from their account. +
    • +
    • + It supports specifying the authenticator ID to remove, as well as optional + modal title and subtitle for custom UI messaging. +
    • +
    • + After successful removal, the user details state is refreshed to reflect the + updated list of authenticators. +
    • +
    • + Supports customizing the duration of the success page shown after removal. +
    • +
    • + Allows specifying the stamper to use for the removal (StamperType.Passkey, + StamperType.ApiKey, or StamperType.Wallet) for granular authentication + control. +
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - -The ID of the authenticator (passkey) to remove. - - -parameter to specify the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -subtitle for the modal. - - -duration (in ms) for the success page after removal (default: 0, no success page). - - -title for the modal. - - -user ID to remove the passkey for a specific user (defaults to current session's userId). - + + The ID of the authenticator (passkey) to remove. + + + parameter to specify the stamper to use for the removal + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + subtitle for the modal. + + + duration (in ms) for the success page after removal (default: 0, no + success page). + + + title for the modal. + + + user ID to remove the passkey for a specific user (defaults to current + session's userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to an array of authenticator IDs that were removed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-email.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-email.mdx index 055b2f4d0..9c2211211 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-email.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-email.mdx @@ -5,36 +5,63 @@ title: "handleRemoveUserEmail()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:717

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:717 + +

    Handles the removal of a user's email address from their Turnkey account.
      -
    • This function opens a modal with the RemoveUserEmail component, allowing the user to confirm and remove their email address.
    • +
    • + This function opens a modal with the RemoveUserEmail component, allowing the + user to confirm and remove their email address. +
    - + - -parameter to specify the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -duration (in ms) for the success page after removal (default: 0, no success page). - - -The user ID to remove the email for (defaults to current session's userId). - + + parameter to specify the stamper to use for the removal + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + duration (in ms) for the success page after removal (default: 0, no + success page). + + + The user ID to remove the email for (defaults to current session's + userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - + diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-phone-number.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-phone-number.mdx index a9205b6f7..441016665 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-phone-number.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-remove-user-phone-number.mdx @@ -5,36 +5,63 @@ title: "handleRemoveUserPhoneNumber()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:732

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:732 + +

    Handles the removal of a user's phone number from their Turnkey account.
      -
    • This function opens a modal with the RemoveUserPhoneNumber component, allowing the user to confirm and remove their phone number.
    • +
    • + This function opens a modal with the RemoveUserPhoneNumber component, + allowing the user to confirm and remove their phone number. +
    - + - -parameter to specify the stamper to use for the removal (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -duration (in ms) for the success page after removal (default: 0, no success page). - - -The user ID to remove the phone number for (defaults to current session's userId). - + + parameter to specify the stamper to use for the removal + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + duration (in ms) for the success page after removal (default: 0, no + success page). + + + The user ID to remove the phone number for (defaults to current session's + userId). + - -A successful response returns the following fields: +A successful response returns the following +fields: - - + diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-sign-message.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-sign-message.mdx index 1d4478f47..05f02cb2e 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-sign-message.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-sign-message.mdx @@ -5,56 +5,123 @@ title: "handleSignMessage()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:678

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:678 + +

    Handles the signing of a message by displaying a modal for user interaction.
      -
    • This function opens a modal with the SignMessageModal component, prompting the user to review and approve the message signing request.
    • -
    • Supports signing with any wallet account managed by Turnkey, including externally connected wallets.
    • -
    • Allows for optional overrides of the encoding and hash function used for the payload, enabling advanced use cases or compatibility with specific blockchains.
    • -
    • Optionally displays a subtext in the modal for additional context or instructions to the user.
    • -
    • Returns a promise that resolves to a ``v1SignRawPayloadResult`` object containing the signed message, signature, and metadata.
    • +
    • + This function opens a modal with the SignMessageModal component, prompting + the user to review and approve the message signing request. +
    • +
    • + Supports signing with any wallet account managed by Turnkey, including + externally connected wallets. +
    • +
    • + Allows for optional overrides of the encoding and hash function used for the + payload, enabling advanced use cases or compatibility with specific + blockchains. +
    • +
    • + Optionally displays a subtext in the modal for additional context or + instructions to the user. +
    • +
    • + Returns a promise that resolves to a ``v1SignRawPayloadResult`` object + containing the signed message, signature, and metadata. +
    - + - -whether to add the Ethereum prefix to the message (default: false). - - -encoding for the payload (defaults to the proper encoding for the account type). - - -hash function to use (defaults to the appropriate function for the account type). - - -The message to sign. - - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -subtext to display in the modal. - - -duration in seconds to display the success page after signing. - - -The wallet account to use for signing. - + + whether to add the Ethereum prefix to the message (default: false). + + + encoding for the payload (defaults to the proper encoding for the account + type). + + + hash function to use (defaults to the appropriate function for the account + type). + + + The message to sign. + + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + subtext to display in the modal. + + + duration in seconds to display the success page after signing. + + + The wallet account to use for signing. + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a `v1SignRawPayloadResult` object containing the signed message. + A promise that resolves to a `v1SignRawPayloadResult` object containing the + signed message. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-email.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-email.mdx index 6dffe3cb3..3e2929d3e 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-email.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-email.mdx @@ -5,42 +5,85 @@ title: "handleUpdateUserEmail()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:436

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:436 + +

    Handles the update user name flow.
      -
    • This function opens a modal with the UpdateUserName component for updating and verifying the user's name.
    • -
    • If a userName is provided, it will directly update the user name without showing the modal.
    • -
    • Uses updateUserName under the hood to perform the update and automatically refreshes the user details state after a successful update.
    • -
    • Optionally displays a success page after the update, with customizable duration.
    • +
    • + This function opens a modal with the UpdateUserName component for updating + and verifying the user's name. +
    • +
    • + If a userName is provided, it will directly update the user name without + showing the modal. +
    • +
    • + Uses updateUserName under the hood to perform the update and automatically + refreshes the user details state after a successful update. +
    • +
    • + Optionally displays a success page after the update, with customizable + duration. +
    • Supports passing a custom title and subtitle for the modal UI.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - - -subtitle for the modal. - - -duration (in ms) for the success page after update (default: 0, no success page). - - -title for the modal. - + + + subtitle for the modal. + + + duration (in ms) for the success page after update (default: 0, no success + page). + + + title for the modal. + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the userId of the user that was changed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-name.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-name.mdx index d63aa1513..8cf792aec 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-name.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-name.mdx @@ -5,46 +5,98 @@ title: "handleUpdateUserName()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:490

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:490 + +

    Handles the update user email flow.
      -
    • This function opens a modal with the UpdateEmail component for updating and verifying the user's email address.
    • -
    • If an email is provided, it will immediately send an OTP request to the user and display the OTP verification modal.
    • -
    • Supports both manual entry and pre-filled email addresses, as well as custom modal titles and subtitles.
    • -
    • Uses the updateEmailContinue helper to manage the OTP flow, verification, and update logic.
    • -
    • After successful verification and update, the user details state is refreshed and an optional success page can be shown.
    • +
    • + This function opens a modal with the UpdateEmail component for updating and + verifying the user's email address. +
    • +
    • + If an email is provided, it will immediately send an OTP request to the user + and display the OTP verification modal. +
    • +
    • + Supports both manual entry and pre-filled email addresses, as well as custom + modal titles and subtitles. +
    • +
    • + Uses the updateEmailContinue helper to manage the OTP flow, verification, + and update logic. +
    • +
    • + After successful verification and update, the user details state is + refreshed and an optional success page can be shown. +
    • Supports customizing the duration of the success page after update.
    • -
    • Handles all error cases and throws a TurnkeyError with appropriate error codes.
    • +
    • + Handles all error cases and throws a TurnkeyError with appropriate error + codes. +
    - + - -parameter to specify the stamper to use for the update (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - - -subtitle for the modal. - - -duration (in ms) for the success page after update (default: 0, no success page). - - -title for the modal. - - + + parameter to specify the stamper to use for the update + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + + + subtitle for the modal. + + + duration (in ms) for the success page after update (default: 0, no success + page). + + + title for the modal. + + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the userId of the user that was changed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-phone-number.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-phone-number.mdx index 6df0de8e2..1f4bfe954 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-phone-number.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-handle-update-user-phone-number.mdx @@ -5,48 +5,99 @@ title: "handleUpdateUserPhoneNumber()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:463

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:463 + +

    Handles the update user phone number flow.
      -
    • This function opens a modal with the UpdatePhoneNumber component for updating and verifying the user's phone number.
    • -
    • If a phoneNumber is provided, it will directly send an OTP request to the user and display the OTP verification modal.
    • -
    • Supports both manual entry and pre-filled phone numbers, as well as custom modal titles and subtitles.
    • -
    • Uses the updatePhoneNumberContinue helper to manage the OTP flow, verification, and update logic.
    • -
    • After successful verification and update, the user details state is refreshed and an optional success page can be shown.
    • +
    • + This function opens a modal with the UpdatePhoneNumber component for + updating and verifying the user's phone number. +
    • +
    • + If a phoneNumber is provided, it will directly send an OTP request to the + user and display the OTP verification modal. +
    • +
    • + Supports both manual entry and pre-filled phone numbers, as well as custom + modal titles and subtitles. +
    • +
    • + Uses the updatePhoneNumberContinue helper to manage the OTP flow, + verification, and update logic. +
    • +
    • + After successful verification and update, the user details state is + refreshed and an optional success page can be shown. +
    • Supports customizing the duration of the success page after update.
    • -
    • Throws a TurnkeyError if the client is not initialized, no active session is found, SMS OTP is not enabled, or if there is an error updating the phone number.
    • +
    • + Throws a TurnkeyError if the client is not initialized, no active session is + found, SMS OTP is not enabled, or if there is an error updating the phone + number. +
    - + - -parameter to specify the formatted phone number. - - -parameter to specify the new phone number. - - -subtitle for the modal. - - -duration for the success page (default: 0, no success page). - - -title for the modal. - + + parameter to specify the formatted phone number. + + + parameter to specify the new phone number. + + + subtitle for the modal. + + + duration for the success page (default: 0, no success page). + + + title for the modal. + - -A successful response returns the following fields: +A successful response returns the following +fields: A promise that resolves to the userId of the user that was changed. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-login-or-signup-with-wallet.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-login-or-signup-with-wallet.mdx index 1459fd5f6..1d662d611 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-login-or-signup-with-wallet.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-login-or-signup-with-wallet.mdx @@ -5,46 +5,87 @@ title: "loginOrSignupWithWallet()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Logs in an existing user or signs up a new user using a wallet, creating a new sub-organization if needed.
      -
    • This function attempts to log in the user by stamping a login request with the provided wallet.
    • -
    • If the wallet’s public key is not associated with an existing sub-organization, a new one is created.
    • -
    • Handles both wallet authentication and sub-organization creation in a single flow.
    • -
    • For Ethereum wallets, derives the public key from the signed request header; for Solana wallets, retrieves it directly from the wallet.
    • -
    • Optionally accepts additional sub-organization parameters, a custom session key, and a custom session expiration.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • +
    • + This function attempts to log in the user by stamping a login request with + the provided wallet. +
    • +
    • + If the wallet’s public key is not associated with an existing + sub-organization, a new one is created. +
    • +
    • + Handles both wallet authentication and sub-organization creation in a single + flow. +
    • +
    • + For Ethereum wallets, derives the public key from the signed request header; + for Solana wallets, retrieves it directly from the wallet. +
    • +
    • + Optionally accepts additional sub-organization parameters, a custom session + key, and a custom session expiration. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    - + - -optional parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -session expiration time in seconds (defaults to the configured default). - - -session key to use for storing the session (defaults to the default session key). - - -wallet provider to use for authentication. - + + optional parameters for creating a sub-organization (e.g., authenticators, + user metadata). + + + session expiration time in seconds (defaults to the configured default). + + + session key to use for storing the session (defaults to the default + session key). + + + wallet provider to use for authentication. + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to an object containing: - - `sessionToken`: the signed JWT session token. - - `address`: the authenticated wallet address. - - `action`: whether the flow resulted in a login or signup (AuthAction). + A promise that resolves to an object containing: - `sessionToken`: the signed + JWT session token. - `address`: the authenticated wallet address. - `action`: + whether the flow resulted in a login or signup (AuthAction). diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-oauth.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-oauth.mdx index 7f4deb810..f881746c5 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-oauth.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-oauth.mdx @@ -5,42 +5,75 @@ title: "loginWithOauth()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Logs in a user using OAuth authentication.
      -
    • This function logs in a user using the provided OIDC token and public key.
    • -
    • Optionally invalidates any existing sessions for the user if ``invalidateExisting`` is set to true.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • +
    • + This function logs in a user using the provided OIDC token and public key. +
    • +
    • + Optionally invalidates any existing sessions for the user if + ``invalidateExisting`` is set to true. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • Handles cleanup of unused key pairs if login fails.
    - + - -flag to invalidate existing sessions for the user. - - -OIDC token received after successful authentication with the OAuth provider. - - -public key to use for authentication. Must be generated prior to calling this function. - - -session key to use for session creation (defaults to the default session key). - + + flag to invalidate existing sessions for the user. + + + OIDC token received after successful authentication with the OAuth + provider. + + + public key to use for authentication. Must be generated prior to calling + this function. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-otp.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-otp.mdx index b5da57529..0c9aabc2a 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-otp.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-otp.mdx @@ -5,43 +5,79 @@ title: "loginWithOtp()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Logs in a user using an OTP verification token.
      -
    • This function logs in a user using the verification token received after OTP verification (from email or SMS).
    • -
    • If a public key is not provided, a new API key pair will be generated for authentication.
    • -
    • Optionally invalidates any existing sessions for the user if ``invalidateExisting`` is set to true.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • +
    • + This function logs in a user using the verification token received after OTP + verification (from email or SMS). +
    • +
    • + If a public key is not provided, a new API key pair will be generated for + authentication. +
    • +
    • + Optionally invalidates any existing sessions for the user if + ``invalidateExisting`` is set to true. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • Handles cleanup of unused key pairs if login fails.
    - + - -flag to invalidate existing session for the user. - - -public key to use for authentication. If not provided, a new key pair will be generated. - - -session key to use for session creation (defaults to the default session key). - - -verification token received after OTP verification. - + + flag to invalidate existing session for the user. + + + public key to use for authentication. If not provided, a new key pair will + be generated. + + + session key to use for session creation (defaults to the default session + key). + + + verification token received after OTP verification. + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-passkey.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-passkey.mdx index 80bb0046b..868e7881a 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-passkey.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-passkey.mdx @@ -5,41 +5,71 @@ title: "loginWithPasskey()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Logs in a user using a passkey, optionally specifying the public key, session key, and session expiration.
      -
    • This function initiates the login process with a passkey and handles session creation and storage.
    • -
    • If a public key is not provided, a new key pair will be generated for authentication.
    • -
    • If a session key is not provided, the default session key will be used.
    • -
    • The session expiration can be customized via the expirationSeconds parameter.
    • +
    • + This function initiates the login process with a passkey and handles session + creation and storage. +
    • +
    • + If a public key is not provided, a new key pair will be generated for + authentication. +
    • +
    • + If a session key is not provided, the default session key will be used. +
    • +
    • + The session expiration can be customized via the expirationSeconds + parameter. +
    • Handles cleanup of unused key pairs if login fails.
    - + - -session expiration time in seconds (defaults to the configured default). - - -public key to use for authentication. If not provided, a new key pair will be generated. - - -session key to use for session creation (defaults to the default session key). - + + session expiration time in seconds (defaults to the configured default). + + + public key to use for authentication. If not provided, a new key pair will + be generated. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a PasskeyAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `credentialId`: an empty string. + A promise that resolves to a PasskeyAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `credentialId`: an empty + string. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-wallet.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-wallet.mdx index b23d56667..d10c1111c 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-wallet.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-login-with-wallet.mdx @@ -5,44 +5,81 @@ title: "loginWithWallet()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Logs in a user using the specified wallet provider.
      -
    • This function logs in a user by authenticating with the provided wallet provider via a wallet-based signature.
    • -
    • If a public key is not provided, a new one will be generated for authentication.
    • +
    • + This function logs in a user by authenticating with the provided wallet + provider via a wallet-based signature. +
    • +
    • + If a public key is not provided, a new one will be generated for + authentication. +
    • Optionally accepts a custom session key and session expiration time.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • -
    • Throws an error if a public key cannot be found or generated, or if the login process fails.
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • +
    • + Throws an error if a public key cannot be found or generated, or if the + login process fails. +
    - + - -optional session expiration time in seconds (defaults to the configured default). - - -optional public key to associate with the session (generated if not provided). - - -optional key to store the session under (defaults to the default session key). - - -wallet provider to use for authentication. - + + optional session expiration time in seconds (defaults to the configured + default). + + + optional public key to associate with the session (generated if not + provided). + + + optional key to store the session under (defaults to the default session + key). + + + wallet provider to use for authentication. + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a WalletAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `address`: the authenticated wallet address. + A promise that resolves to a WalletAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `address`: the authenticated + wallet address. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-user.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-user.mdx index 8ddbba19d..b161207ca 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-user.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-user.mdx @@ -5,40 +5,63 @@ title: "refreshUser()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:74

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:74 + +

    Refreshes the user details.
      -
    • This function fetches the latest user details for the current session (or optionally for a specific user/organization if provided)
    • +
    • + This function fetches the latest user details for the current session (or + optionally for a specific user/organization if provided) +
    -and updates the ``user`` state variable in the provider. +and updates the `user` state variable in the provider.
      -
    • If a ``stampWith`` parameter is provided, it will use that stamper to fetch the user details (supports Passkey, ApiKey, or Wallet stampers).
    • +
    • + If a ``stampWith`` parameter is provided, it will use that stamper to fetch + the user details (supports Passkey, ApiKey, or Wallet stampers). +
    • Automatically handles error reporting via the configured callbacks.
    • -
    • Typically used after authentication, user profile updates, or linking/unlinking authenticators to ensure the provider state is up to date.
    • +
    • + Typically used after authentication, user profile updates, or + linking/unlinking authenticators to ensure the provider state is up to date. +
    • If no user is found, the state will not be updated.
    - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves when the user details are successfully refreshed and state is updated. + A promise that resolves when the user details are successfully refreshed and + state is updated. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-wallets.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-wallets.mdx index d762f4aff..289f0c18c 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-wallets.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-refresh-wallets.mdx @@ -5,29 +5,45 @@ title: "refreshWallets()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    -

    Defined in: react-wallet-kit/src/providers/client/Types.tsx:94

    +

    + Defined in:{" "} + + react-wallet-kit/src/providers/client/Types.tsx:94 + +

    Refreshes the wallets state for the current user session.
      -
    • This function fetches the latest list of wallets associated with the current session or user,
    • +
    • + This function fetches the latest list of wallets associated with the current + session or user, +
    -and updates the ``wallets`` state variable in the provider. +and updates the `wallets` state variable in the provider.
      -
    • If a ``stampWith`` parameter is provided, it will use that stamper to fetch the wallets
    • +
    • + If a ``stampWith`` parameter is provided, it will use that stamper to fetch + the wallets +
    (supports Passkey, ApiKey, or Wallet stampers for granular authentication control).
    • Automatically handles error reporting via the configured callbacks.
    • -
    • Typically used after wallet creation, import, export, account changes, or authentication
    • +
    • + Typically used after wallet creation, import, export, account changes, or + authentication +
    to ensure the provider state is up to date. @@ -38,17 +54,24 @@ to ensure the provider state is up to date. - + - -parameter to stamp the request with a specific stamper (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). - + + parameter to stamp the request with a specific stamper + (StamperType.Passkey, StamperType.ApiKey, or StamperType.Wallet). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves when the wallets are successfully refreshed and state is updated. + A promise that resolves when the wallets are successfully refreshed and state + is updated. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-oauth.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-oauth.mdx index 8d248c6e2..b2d274efe 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-oauth.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-oauth.mdx @@ -5,45 +5,87 @@ title: "signUpWithOauth()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Signs up a user using OAuth authentication.
      -
    • This function creates a new sub-organization for the user using the provided OIDC token, public key, and provider name.
    • -
    • Handles the full OAuth sign-up flow, including sub-organization creation and session management.
    • -
    • Optionally accepts additional sub-organization creation parameters and a custom session key.
    • -
    • After successful sign-up, automatically logs in the user and returns a signed JWT session token.
    • +
    • + This function creates a new sub-organization for the user using the provided + OIDC token, public key, and provider name. +
    • +
    • + Handles the full OAuth sign-up flow, including sub-organization creation and + session management. +
    • +
    • + Optionally accepts additional sub-organization creation parameters and a + custom session key. +
    • +
    • + After successful sign-up, automatically logs in the user and returns a + signed JWT session token. +
    - + - -parameters for sub-organization creation (e.g., authenticators, user metadata). - - -OIDC token received after successful authentication with the OAuth provider. - - -name of the OAuth provider (e.g., "Google", "Apple"). - - -public key to associate with the new sub-organization. - - -session key to use for session creation (defaults to the default session key). - + + parameters for sub-organization creation (e.g., authenticators, user + metadata). + + + OIDC token received after successful authentication with the OAuth + provider. + + + name of the OAuth provider (e.g., "Google", "Apple"). + + + public key to associate with the new sub-organization. + + + session key to use for session creation (defaults to the default session + key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-otp.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-otp.mdx index 23ec9a3e6..9dec5bab0 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-otp.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-otp.mdx @@ -5,49 +5,98 @@ title: "signUpWithOtp()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Signs up a user using an OTP verification token.
      -
    • This function signs up a user using the verification token received after OTP verification (from email or SMS).
    • -
    • Creates a new sub-organization for the user with the provided parameters and associates the contact (email or phone) with the sub-organization.
    • -
    • Automatically generates a new API key pair for authentication and session management.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided.
    • -
    • Handles both email and SMS OTP types, and supports additional sub-organization creation parameters.
    • +
    • + This function signs up a user using the verification token received after + OTP verification (from email or SMS). +
    • +
    • + Creates a new sub-organization for the user with the provided parameters and + associates the contact (email or phone) with the sub-organization. +
    • +
    • + Automatically generates a new API key pair for authentication and session + management. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided. +
    • +
    • + Handles both email and SMS OTP types, and supports additional + sub-organization creation parameters. +
    - + - -contact information for the user (e.g., email address or phone number). - - -parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -flag to invalidate existing session for the user. - - -type of OTP being used (OtpType.Email or OtpType.Sms). - - -session key to use for session creation (defaults to the default session key). - - -verification token received after OTP verification. - + + contact information for the user (e.g., email address or phone number). + + + parameters for creating a sub-organization (e.g., authenticators, user + metadata). + + + flag to invalidate existing session for the user. + + + type of OTP being used (OtpType.Email or OtpType.Sms). + + + session key to use for session creation (defaults to the default session + key). + + + verification token received after OTP verification. + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a BaseAuthResult, which includes: - - `sessionToken`: the signed JWT session token. + A promise that resolves to a BaseAuthResult, which includes: - `sessionToken`: + the signed JWT session token. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-passkey.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-passkey.mdx index a65821467..e99d15f4a 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-passkey.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-passkey.mdx @@ -5,47 +5,92 @@ title: "signUpWithPasskey()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Signs up a user using a passkey, creating a new sub-organization and session.
      -
    • This function creates a new passkey authenticator and uses it to register a new sub-organization for the user.
    • -
    • Handles both passkey creation and sub-organization creation in a single flow.
    • -
    • Optionally accepts additional sub-organization parameters, a custom session key, a custom passkey display name, and a custom session expiration.
    • -
    • Automatically generates a new API key pair for authentication and session management.
    • -
    • Stores the resulting session token and manages cleanup of unused key pairs.
    • +
    • + This function creates a new passkey authenticator and uses it to register a + new sub-organization for the user. +
    • +
    • + Handles both passkey creation and sub-organization creation in a single + flow. +
    • +
    • + Optionally accepts additional sub-organization parameters, a custom session + key, a custom passkey display name, and a custom session expiration. +
    • +
    • + Automatically generates a new API key pair for authentication and session + management. +
    • +
    • + Stores the resulting session token and manages cleanup of unused key pairs. +
    - + - -challenge string to use for passkey registration. If not provided, a new challenge will be generated. - - -parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -session expiration time in seconds (defaults to the configured default). - - -display name for the passkey (defaults to a generated name based on the current timestamp). - - -session key to use for storing the session (defaults to the default session key). - + + challenge string to use for passkey registration. If not provided, a new + challenge will be generated. + + + parameters for creating a sub-organization (e.g., authenticators, user + metadata). + + + session expiration time in seconds (defaults to the configured default). + + + display name for the passkey (defaults to a generated name based on the + current timestamp). + + + session key to use for storing the session (defaults to the default + session key). + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a PasskeyAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `credentialId`: the credential ID associated with the passkey created. + A promise that resolves to a PasskeyAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `credentialId`: the credential + ID associated with the passkey created. diff --git a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-wallet.mdx b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-wallet.mdx index 081914c34..a3921bb94 100644 --- a/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-wallet.mdx +++ b/generated-docs/formatted/react-wallet-kit/client-context-type-sign-up-with-wallet.mdx @@ -5,44 +5,84 @@ title: "signUpWithWallet()" import { H3Bordered } from "/snippets/h3-bordered.mdx"; import { NestedParam } from "/snippets/nested-param.mdx"; -

    Package: react-wallet-kit

    +

    + Package: react-wallet-kit +

    Signs up a user using a wallet, creating a new sub-organization and session.
      -
    • This function creates a new wallet authenticator and uses it to register a new sub-organization for the user.
    • -
    • Handles both wallet authentication and sub-organization creation in a single flow.
    • -
    • Optionally accepts additional sub-organization parameters, a custom session key, and a custom session expiration.
    • -
    • Automatically generates additional API key pairs for authentication and session management.
    • -
    • Stores the resulting session token under the specified session key, or the default session key if not provided, and manages cleanup of unused key pairs.
    • +
    • + This function creates a new wallet authenticator and uses it to register a + new sub-organization for the user. +
    • +
    • + Handles both wallet authentication and sub-organization creation in a single + flow. +
    • +
    • + Optionally accepts additional sub-organization parameters, a custom session + key, and a custom session expiration. +
    • +
    • + Automatically generates additional API key pairs for authentication and + session management. +
    • +
    • + Stores the resulting session token under the specified session key, or the + default session key if not provided, and manages cleanup of unused key + pairs. +
    - + - -parameters for creating a sub-organization (e.g., authenticators, user metadata). - - -session expiration time in seconds (defaults to the configured default). - - -session key to use for storing the session (defaults to the default session key). - - -wallet provider to use for authentication. - + + parameters for creating a sub-organization (e.g., authenticators, user + metadata). + + + session expiration time in seconds (defaults to the configured default). + + + session key to use for storing the session (defaults to the default + session key). + + + wallet provider to use for authentication. + - -A successful response returns the following fields: +A successful response returns the following +fields: - A promise that resolves to a WalletAuthResult, which includes: - - `sessionToken`: the signed JWT session token. - - `address`: the authenticated wallet address. + A promise that resolves to a WalletAuthResult, which includes: - + `sessionToken`: the signed JWT session token. - `address`: the authenticated + wallet address. diff --git a/packages/core/src/__clients__/core.ts b/packages/core/src/__clients__/core.ts index dd2b03886..e0723be80 100644 --- a/packages/core/src/__clients__/core.ts +++ b/packages/core/src/__clients__/core.ts @@ -17,6 +17,7 @@ import { v1PayloadEncoding, v1HashFunction, v1Curve, + TInitFiatOnRampBody, v1PrivateKey, WalletAuthResult, BaseAuthResult, @@ -1139,6 +1140,49 @@ export class TurnkeyClient { ); }; + /** + * Initializes the Fiat Onramp Flow. + * + * - This function initiates the OTP flow by sending a one-time password (OTP) code to the user's contact information (email address or phone number) via the auth proxy. + * - Supports both email and SMS OTP types. + * - Returns an OTP ID that is required for subsequent OTP verification. + * + * @param params.otpType - type of OTP to initialize (OtpType.Email or OtpType.Sms). + * @param params.contact - contact information for the user (e.g., email address or phone number). + * @returns A promise that resolves with the onRampUrl and onRampTransactionId. + * @throws {TurnkeyError} If there is an error during the fiat onramp initialization process. + */ + initFiatOnramp = async ( + params: TInitFiatOnRampBody, + ): Promise<{ + onRampUrl: string; + onRampTransactionId: string; + onRampUrlSignature?: string; + }> => { + return withTurnkeyErrorHandling( + async () => { + const initFiatOnRampRes = await this.httpClient.initFiatOnRamp(params); + + if (!initFiatOnRampRes || !initFiatOnRampRes.onRampUrl) { + throw new TurnkeyError( + "Failed to initialize fiat onramp: onRampUrl is missing", + TurnkeyErrorCodes.INIT_FIAT_ONRAMP_ERROR, + ); + } + + return { + onRampUrl: initFiatOnRampRes.onRampUrl, + onRampTransactionId: initFiatOnRampRes.onRampTransactionId, + onRampUrlSignature: initFiatOnRampRes.onRampUrlSignature ?? "", + }; + }, + { + errorMessage: "Failed to initialize fiat onramp", + errorCode: TurnkeyErrorCodes.INIT_FIAT_ONRAMP_ERROR, + }, + ); + }; + /** * Initializes the OTP process by sending an OTP code to the provided contact. * diff --git a/packages/ethers/CHANGELOG.md b/packages/ethers/CHANGELOG.md index 52965ab96..07f15037d 100644 --- a/packages/ethers/CHANGELOG.md +++ b/packages/ethers/CHANGELOG.md @@ -500,7 +500,6 @@ ### Minor Changes - bdded80: Support awaiting consensus - - Add a few new helper functions: - `serializeSignature` serializes a raw signature diff --git a/packages/http/CHANGELOG.md b/packages/http/CHANGELOG.md index e577b20dc..8b0be87ea 100644 --- a/packages/http/CHANGELOG.md +++ b/packages/http/CHANGELOG.md @@ -119,7 +119,6 @@ ### Patch Changes - [#763](https://github.com/tkhq/sdk/pull/763) [`cb13c26`](https://github.com/tkhq/sdk/commit/cb13c26edb79a01ab651e3b2897334fd154b436a) Author [@andrewkmin](https://github.com/andrewkmin) - Release per mono v2025.7.1. This release contains the following API changes: - - Introduction of `SmartContractInterfaces`: we've now exposed endpoints for uploading ABIs and IDLs to help secure EVM and Solana signing flows. For more information, see our docs [here](https://docs.turnkey.com/concepts/policies/smart-contract-interfaces) ## 3.5.0 @@ -338,7 +337,6 @@ ### Minor Changes - 848f8d3: Add new helpers and update types and errors - - `getSignatureFromActivity` returns the signature corresponding to a completed activity - `getSignedTransactionFromActivity` returns the signed transaction corresponding to a completed activity - `assertActivityCompleted` checks the state of an activity and throws an error if the activity either requires consensus or is otherwise not yet completed @@ -464,7 +462,6 @@ ### Minor Changes - 464ac0e: Update protos for latest release, which includes: - - Support optional expirations for API keys, configurable via the `expirationSeconds` parameter. - Support Email Auth. Details to follow ⚡️ @@ -594,7 +591,6 @@ Note: ### Minor Changes - The `createSubOrganization` request has been updated under the hood: - - Calling `.createSubOrganization` on our HTTP client will trigger an activity of type `CREATE_SUB_ORGANIZATION_V3` instead of `CREATE_SUB_ORGANIZATION_V2` previously. - If there are any policies referencing `CREATE_SUB_ORGANIZATION_V2` specifically, they will no longer work out of the box if creating sub-orgs via SDK. These policies will need to be updated to allow `CREATE_SUB_ORGANIZATION_V3`. See policy examples related to access control [here](https://docs.turnkey.com/managing-policies/examples#access-control) for additional methods of constructing policies. - `CREATE_SUB_ORGANIZATION_V3` supports everything `CREATE_SUB_ORGANIZATION_V2` supports, with the addition of a `privateKeys` field to atomically create a sub-org with private keys. If no private keys are desired, simply provide an empty array. diff --git a/packages/iframe-stamper/CHANGELOG.md b/packages/iframe-stamper/CHANGELOG.md index eeb64516a..885513c8c 100644 --- a/packages/iframe-stamper/CHANGELOG.md +++ b/packages/iframe-stamper/CHANGELOG.md @@ -13,7 +13,6 @@ ### Minor Changes - e501690: Add new utility functions - - Add `clearEmbeddedKey()` async function, which clears the embedded key within an iframe - Add `initEmbeddedKey()` async function, which reinitializes the embedded key within an iframe diff --git a/packages/react-wallet-kit/src/components/auth/Wallet.tsx b/packages/react-wallet-kit/src/components/auth/Wallet.tsx index 1a777521b..6ecd44897 100644 --- a/packages/react-wallet-kit/src/components/auth/Wallet.tsx +++ b/packages/react-wallet-kit/src/components/auth/Wallet.tsx @@ -134,7 +134,6 @@ export function ExternalWalletChainSelector( )}
    - { + const { initFiatOnramp, session } = useTurnkey(); + const { isMobile } = useModal(); + + const generateCoinbaseUrl = async () => { + try { + if (!session) { + throw new Error("Session not found"); + } + + const response = await initFiatOnramp({ + organizationId: session?.organizationId!, + onrampProvider: FiatOnRampProvider.COINBASE, + walletAddress: ethAddress, + network: FiatOnRampBlockchainNetwork.ETHEREUM, + cryptoCurrencyCode: FiatOnRampCryptoCurrency.ETHEREUM, + fiatCurrencyCode: FiatOnRampCurrency.USD, + fiatCurrencyAmount: "10", + paymentMethod: FiatOnRampPaymentMethod.CREDIT_DEBIT_CARD, + countryCode: "US", + countrySubdivisionCode: "ME", + sandboxMode: true, + }); + + if (response?.onRampUrl) { + window.open( + response.onRampUrl, + "_blank", + "popup,width=500,height=700,scrollbars=yes,resizable=yes", + ); + } + } catch (error) { + console.error("Failed to init Coinbase on-ramp:", error); + } + }; + + const generateMoonPayUrl = async () => { + try { + if (!session) { + throw new Error("Session not found"); + } + + const response = await initFiatOnramp({ + organizationId: session?.organizationId!, + onrampProvider: FiatOnRampProvider.MOONPAY, + walletAddress: ethAddress, + network: FiatOnRampBlockchainNetwork.ETHEREUM, + cryptoCurrencyCode: FiatOnRampCryptoCurrency.ETHEREUM, + fiatCurrencyCode: FiatOnRampCurrency.USD, + fiatCurrencyAmount: "10", + paymentMethod: FiatOnRampPaymentMethod.CREDIT_DEBIT_CARD, + sandboxMode: true, + }); + + if (response?.onRampUrl) { + window.open( + response.onRampUrl, + "_blank", + "popup,width=500,height=700,scrollbars=yes,resizable=yes", + ); + } + } catch (error) { + console.error("Failed to init MoonPay on-ramp:", error); + } + }; + + return ( +
    +
    + + +
    +
    + ); +}; diff --git a/packages/react-wallet-kit/src/providers/client/Provider.tsx b/packages/react-wallet-kit/src/providers/client/Provider.tsx index af8a0cfca..e88a2599e 100644 --- a/packages/react-wallet-kit/src/providers/client/Provider.tsx +++ b/packages/react-wallet-kit/src/providers/client/Provider.tsx @@ -64,6 +64,7 @@ import { type v1PayloadEncoding, type v1HashFunction, type v1Curve, + TInitFiatOnRampBody, type v1PrivateKey, BaseAuthResult, WalletAuthResult, @@ -898,7 +899,6 @@ export const ClientProvider: React.FC = ({ if (!session) return; callbacks?.beforeSessionExpiry?.({ sessionKey }); - if (masterConfig?.auth?.autoRefreshSession) { await refreshSession({ expirationSeconds: session.expirationSeconds!, @@ -1346,6 +1346,22 @@ export const ClientProvider: React.FC = ({ [client, callbacks], ); + async function initFiatOnramp( + params: TInitFiatOnRampBody, + ): Promise<{ onRampUrl: string; onRampTransactionId: string }> { + if (!client) { + throw new TurnkeyError( + "Client is not initialized.", + TurnkeyErrorCodes.CLIENT_NOT_INITIALIZED, + ); + } + return withTurnkeyErrorHandling( + () => client.initFiatOnramp(params), + callbacks, + "Failed to initialize OTP", + ); + } + const loginWithWallet = useCallback( async (params: { walletProvider: WalletProvider; @@ -4994,6 +5010,7 @@ export const ClientProvider: React.FC = ({ loginWithWallet, signUpWithWallet, loginOrSignupWithWallet, + initFiatOnramp, initOtp, verifyOtp, loginWithOtp, diff --git a/packages/react-wallet-kit/src/utils.ts b/packages/react-wallet-kit/src/utils.ts new file mode 100644 index 000000000..c7a124a9e --- /dev/null +++ b/packages/react-wallet-kit/src/utils.ts @@ -0,0 +1,372 @@ +import { Session, TurnkeyError, TurnkeyErrorCodes } from "@turnkey/sdk-types"; +import type { TurnkeyCallbacks } from "./types/base"; +import { useCallback, useRef, useState, useEffect } from "react"; +import { WalletInterfaceType, WalletProvider } from "@turnkey/core"; + +export const GOOGLE_AUTH_URL = "https://accounts.google.com/o/oauth2/v2/auth"; +export const APPLE_AUTH_URL = "https://account.apple.com/auth/authorize"; +export const APPLE_AUTH_SCRIPT_URL = + "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"; +export const FACEBOOK_AUTH_URL = "https://www.facebook.com/v11.0/dialog/oauth"; +export const FACEBOOK_GRAPH_URL = + "https://graph.facebook.com/v11.0/oauth/access_token"; +export const popupWidth = 500; +export const popupHeight = 600; + +export const SESSION_WARNING_THRESHOLD_MS = 60 * 1000; // 1 minute in milliseconds + +export const authErrors = { + // Passkey-related errors + passkey: { + createFailed: "Passkey not created. Please try again.", + loginFailed: "Failed to login with passkey. Please try again.", + timeoutOrNotAllowed: + "The operation either timed out or was not allowed. Please try again.", + }, + + // OTP-related errors + otp: { + sendFailed: "Failed to send OTP", + invalidEmail: "Invalid email address.", + invalidPhone: "Invalid phone number.", + }, + + // OAuth-related errors + oauth: { + loginFailed: "Failed to login with OAuth provider", + }, + + // Wallet-related errors + wallet: { + loginFailed: "Failed to login with wallet", + noPublicKey: "No public key found", + }, + + // Sub-organization-related errors + suborg: { + fetchFailed: "Failed to fetch account", + createFailed: "Failed to create account.", + }, +}; + +export const useDebouncedCallback = void>( + fn: T, + wait = 100, +): T => { + const timer = useRef | null>(null); + const fnRef = useRef(fn); + fnRef.current = fn; + + return useCallback( + (...args: any[]) => { + if (timer.current) clearTimeout(timer.current); + timer.current = setTimeout(() => { + fnRef.current(...(args as Parameters)); + timer.current = null; + }, wait); + }, + [wait], + ) as T; +}; + +export const isValidSession = (session?: Session | undefined): boolean => { + return session?.expiry !== undefined && session.expiry * 1000 > Date.now(); +}; + +export async function withTurnkeyErrorHandling( + fn: () => Promise, + callbacks?: { onError?: (error: TurnkeyError) => void }, + fallbackMessage = "An unknown error occurred", + fallbackCode = TurnkeyErrorCodes.UNKNOWN, +): Promise { + try { + return await fn(); + } catch (error) { + if (error instanceof TurnkeyError) { + callbacks?.onError?.(error); + throw error; + } + const tkError = new TurnkeyError(fallbackMessage, fallbackCode, error); + callbacks?.onError?.(tkError); + throw tkError; + } +} + +// Helper function to parse Apple OAuth redirects +function parseAppleOAuthRedirect(hash: string): { + idToken: string | null | undefined; + provider: string | null; + flow: string | null; + publicKey: string | null; + openModal: string | null; +} { + // Apple's format has unencoded parameters in the state portion + const idTokenMatch = hash.match(/id_token=([^&]+)$/); + const idToken = idTokenMatch ? idTokenMatch[1] : null; + + // Extract state parameters - state is at the beginning + // It typically looks like: state=provider=apple&flow=redirect&publicKey=123...&openModal=true&code=...&id_token=... + const stateEndIndex = hash.indexOf("&code="); + if (stateEndIndex === -1) + return { + idToken, + provider: null, + flow: null, + publicKey: null, + openModal: null, + }; + + const stateContent = hash.substring(6, stateEndIndex); // Remove "state=" prefix + const stateParams = new URLSearchParams(stateContent); + + return { + idToken, + provider: stateParams.get("provider"), + flow: stateParams.get("flow"), + publicKey: stateParams.get("publicKey"), + openModal: stateParams.get("openModal"), + }; +} + +// Helper function to parse Google OAuth redirects +function parseGoogleOAuthRedirect(hash: string): { + idToken: string | null; + provider: string | null; + flow: string | null; + publicKey: string | null; + openModal: string | null; +} { + const hashParams = new URLSearchParams(hash); + const idToken = hashParams.get("id_token"); + const state = hashParams.get("state"); + + let provider = null; + let flow = null; + let publicKey = null; + let openModal = null; + + if (state) { + const stateParams = new URLSearchParams(state); + provider = stateParams.get("provider"); + flow = stateParams.get("flow"); + publicKey = stateParams.get("publicKey"); + openModal = stateParams.get("openModal"); + } + + return { + idToken, + provider, + flow, + publicKey, + openModal, + }; +} + +// Main function to determine provider and parse accordingly +export function parseOAuthRedirect(hash: string): { + idToken: string | null | undefined; + provider: string | null; + flow: string | null; + publicKey: string | null; + openModal: string | null; +} { + // Check if this is an Apple redirect + if (hash.startsWith("state=provider=apple")) { + return parseAppleOAuthRedirect(hash); + } else { + return parseGoogleOAuthRedirect(hash); + } +} + +// Function to generate PKCE challenge pair for Facebook OAuth +export async function generateChallengePair(): Promise<{ + verifier: string; + codeChallenge: string; +}> { + const randomBytes = new Uint8Array(32); + window.crypto.getRandomValues(randomBytes); + const verifier = btoa(String.fromCharCode(...randomBytes)) + .replace(/\+/g, "-") + .replace(/\//g, "_") + .replace(/=+$/, ""); + + const encoder = new TextEncoder(); + const data = encoder.encode(verifier); + const digest = await window.crypto.subtle.digest("SHA-256", data); + + const base64Challenge = btoa(String.fromCharCode(...new Uint8Array(digest))) + .replace(/\+/g, "-") + .replace(/\//g, "_") + .replace(/=+$/, ""); + + return { verifier, codeChallenge: base64Challenge }; +} + +// Function to exchange Facebook authorization code for token +export async function exchangeCodeForToken( + clientId: string, + redirectUri: string, + code: string, + codeVerifier: string, +): Promise<{ id_token: string }> { + const params = new URLSearchParams({ + client_id: clientId, + redirect_uri: redirectUri, + code_verifier: codeVerifier, + code: code, + grant_type: "authorization_code", + }); + + const response = await fetch(FACEBOOK_GRAPH_URL, { + method: "POST", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + body: params.toString(), + }); + + if (!response.ok) { + const errorData = await response.json(); + throw new Error( + `Facebook token exchange failed: ${JSON.stringify(errorData)}`, + ); + } + + return await response.json(); +} + +export async function handleFacebookPKCEFlow({ + code, + publicKey, + openModal, + clientId, + redirectURI, + callbacks, + completeOauth, + onPushPage, +}: { + code: string; + publicKey: string; + openModal?: string | null; + clientId: string; + redirectURI: string; + callbacks?: TurnkeyCallbacks | undefined; + completeOauth: (params: { + oidcToken: string; + publicKey: string; + }) => Promise; + onPushPage: (idToken: string) => Promise; +}): Promise { + // Retrieve the verifier stored during OAuth initiation + const verifier = sessionStorage.getItem("facebook_verifier"); + if (!verifier) { + throw new TurnkeyError( + "Missing PKCE verifier for Facebook authentication", + TurnkeyErrorCodes.OAUTH_SIGNUP_ERROR, + ); + } + + try { + // Exchange the code for a token + const tokenData = await exchangeCodeForToken( + clientId, + redirectURI, + code, + verifier, + ); + + // Clean up the verifier as it's no longer needed + sessionStorage.removeItem("facebook_verifier"); + + // Handle different UI flows based on openModal parameter + if (openModal === "true") { + await onPushPage(tokenData.id_token); + } else if (callbacks?.onOauthRedirect) { + callbacks.onOauthRedirect({ + idToken: tokenData.id_token, + publicKey, + }); + } else { + await completeOauth({ + oidcToken: tokenData.id_token, + publicKey, + }); + } + + // Clean up the URL after processing + window.history.replaceState(null, document.title, window.location.pathname); + + return; + } catch (error) { + console.error("Error exchanging Facebook code for token:", error); + throw new TurnkeyError( + "Failed to complete Facebook authentication", + TurnkeyErrorCodes.OAUTH_SIGNUP_ERROR, + error, + ); + } +} + +// Custom hook to get the current screen size +export function useScreenSize() { + const [width, setWidth] = useState( + typeof window !== "undefined" ? window.innerWidth : 1024, + ); + + useEffect(() => { + const handleResize = () => setWidth(window.innerWidth); + window.addEventListener("resize", handleResize); + return () => window.removeEventListener("resize", handleResize); + }, []); + + return { + width, + + // I have no idea why but, Tailwind's responsive design breakpoints do not work. Throughout the modal components, you will see conditional styling using this `isMobile` variable. + // This is fine since we only need to style for 2 screen sizes: mobile and desktop. If anyone can figure out why Tailwind's responsive design breakpoints do not work, please fix it and restyle the components accordingly, changing the `isMobile` to the Tailwind stuff when applicable. + isMobile: width < 640, + }; +} + +export function isWalletConnect(wallet: WalletProvider): boolean { + return wallet.interfaceType == WalletInterfaceType.WalletConnect; +} + +export function useWalletProviderState(initialState: WalletProvider[] = []) { + const [walletProviders, setWalletProviders] = + useState(initialState); + const prevProvidersRef = useRef(initialState); + + function isSameWalletProvider(a: WalletProvider[], b: WalletProvider[]) { + if (a.length !== b.length) return false; + + const key = (provider: WalletProvider) => { + const name = provider.info.name; + const namespace = provider.chainInfo.namespace; + const interfaceType = provider.interfaceType; + const connectedAddresses = [...provider.connectedAddresses] + .map((x) => x.toLowerCase()) + .sort() + .join(","); + return `${namespace}|${interfaceType}|${name}|${connectedAddresses}`; + }; + + const A = a.map(key).sort(); + const B = b.map(key).sort(); + for (let i = 0; i < A.length; i++) if (A[i] !== B[i]) return false; + return true; + } + + const updateWalletProviders = useCallback( + (newProviders: WalletProvider[]) => { + if (!isSameWalletProvider(prevProvidersRef.current, newProviders)) { + prevProvidersRef.current = newProviders; + setWalletProviders(newProviders); + } + // we do nothing if the wallet providers are the same + }, + [], + ); + + return [walletProviders, updateWalletProviders] as const; +} diff --git a/packages/sdk-react-native/CHANGELOG.md b/packages/sdk-react-native/CHANGELOG.md index 7387903e2..1bb1ffcd0 100644 --- a/packages/sdk-react-native/CHANGELOG.md +++ b/packages/sdk-react-native/CHANGELOG.md @@ -336,7 +336,6 @@ handleGoogleOAuth({ ### Major Changes - fcf9503: This breaking change adds support for multiple sessions: - - The concept of a **selected session** has been introduced: - Users can switch between sessions using `setSelectedSession({ sessionKey: })`. - The selected session determines the active `client`, `user`, and `session` state. diff --git a/packages/sdk-types/src/index.ts b/packages/sdk-types/src/index.ts index 554b7522d..425cbc282 100644 --- a/packages/sdk-types/src/index.ts +++ b/packages/sdk-types/src/index.ts @@ -54,6 +54,7 @@ export enum TurnkeyErrorCodes { WALLET_SIGNUP_AUTH_ERROR = "WALLET_SIGNUP_AUTH_ERROR", WALLET_LOGIN_AUTH_ERROR = "WALLET_LOGIN_AUTH_ERROR", WALLET_LOGIN_OR_SIGNUP_ERROR = "WALLET_LOGIN_OR_SIGNUP_ERROR", + INIT_FIAT_ONRAMP_ERROR = "INIT_FIAT_ONRAMP_ERROR", INIT_OTP_ERROR = "INIT_OTP_ERROR", VERIFY_OTP_ERROR = "VERIFY_OTP_ERROR", OTP_LOGIN_ERROR = "OTP_LOGIN_ERROR", diff --git a/packages/viem/CHANGELOG.md b/packages/viem/CHANGELOG.md index b4496cd4a..fd2d8cfcc 100644 --- a/packages/viem/CHANGELOG.md +++ b/packages/viem/CHANGELOG.md @@ -541,7 +541,6 @@ ### Minor Changes - 2bb9ea0: Add synchronous createAccount variant (thank you @mshrieve) - - Closes https://github.com/tkhq/sdk/issues/349 - Originally attributed to https://github.com/tkhq/sdk/pull/348 - Upshot: no change required if your setup was working. However, if you would like a synchronous option for creating a Viem account, now you may do so with `createAccountWithAddress` @@ -560,7 +559,6 @@ ### Minor Changes - 848f8d3: Support awaiting consensus and improve error handling - - Add new error types that extend `BaseError` (and thus implement `error.walk`) - `TurnkeyConsensusNeededError` wraps consensus-related errors - `TurnkeyActivityError` wraps base Turnkey errors diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7efbde954..cb8d36447 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -594,6 +594,9 @@ importers: '@hello-pangea/dnd': specifier: ^17.0.0 version: 17.0.0(@types/react@18.2.14)(react-dom@18.2.0(react@18.2.0))(react@18.2.0) + '@moonpay/moonpay-js': + specifier: ^0.7.0 + version: 0.7.0 '@noble/hashes': specifier: 1.4.0 version: 1.4.0