
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
@turnkey/sdk-react
Advanced tools
The @turnkey/sdk-react package simplifies the integration of the Turnkey API into React-based applications. It builds on top of the @turnkey/sdk-browser package, enabling developers to implement authentication and wallet functionalities using React components.
passkeyClient, indexedDbClient, authIframeClient, and more.Use @turnkey/sdk-react when building Next/React applications that interact with the Turnkey API.
Install the package using npm or Yarn:
npm install @turnkey/sdk-react
Set up the TurnkeyProvider in your application entry point (e.g., App.tsx):
import { TurnkeyProvider } from "@turnkey/sdk-react";
const turnkeyConfig = {
  apiBaseUrl: "https://api.turnkey.com",
  defaultOrganizationId: process.env.TURNKEY_ORGANIZATION_ID,
  rpId: process.env.RPID, // Your application's domain for WebAuthn flows
  iframeUrl: "https://auth.turnkey.com",
  serverSignUrl: "http://localhost:3000/api", // Backend endpoint for signing operations (optional)
};
function App() {
  return (
    <TurnkeyProvider config={turnkeyConfig}>
      {/* Rest of the app */}
    </TurnkeyProvider>
  );
}
export default App;
In components nested under the TurnkeyProvider, you can access Turnkey utilities using the useTurnkey hook:
import { useTurnkey } from "@turnkey/sdk-react";
function ExampleComponent() {
  const { turnkey, passkeyClient, indexedDbClient } = useTurnkey();
  const loginWithPasskey = async () => {
    // Creates a read only session with passkey
    await passkeyClient?.loginWithPasskey();
  };
  const initEmailAuth = async () => {
    const publicKey = await indexedDbClient?.getPublicKey();
    await turnkey?.serverSign("emailAuth", [
      {
        email: "<target user email>",
        targetPublicKey: publicKey,
        organizationId: "<target user suborg-id>",
      },
    ]);
  };
  const loginWithSession = async (credentialBundle: string) => {
    await indexedDbClient?.loginWithSession(sessionResponse.session); // Saves the session returned Turnkey's auth activities to indexedDB storage
  };
  return (
    <div>
      <button onClick={loginWithPasskey}>Login with Passkey</button>
      <button onClick={() => initEmailAuth()}>Initialize Email Auth</button>
    </div>
  );
}
export default ExampleComponent;
All components require Next.js 13+ with the /app directory structure to leverage server actions. Before using components be sure to Import Turnkey's default styles in your layout.tsx or equivalent entry point:
import "@turnkey/sdk-react/styles";
The Auth component provides a complete authentication solution with support for various login methods.
import { Auth } from "@turnkey/sdk-react";
import { toast } from "sonner";
function AuthPage() {
  const handleAuthSuccess = () => {
    console.log("Auth successful!");
  };
  const handleAuthError = (errorMessage: string) => {
    toast.error(errorMessage);
  };
  const authConfig = {
    emailEnabled: true,
    passkeyEnabled: true,
    phoneEnabled: false,
    googleEnabled: true,
    appleEnabled: false,
    facebookEnabled: false,
    socialLinking: true, // Enable social linking
    sessionLengthSeconds: 3600, //1 hour r/w session
  };
  const configOrder = ["socials", "email", "phone", "passkey"];
  return (
    <Auth
      authConfig={authConfig}
      configOrder={configOrder}
      onAuthSuccess={handleAuthSuccess}
      onError={handleAuthError}
    />
  );
}
export default AuthPage;
import { Import } from "@turnkey/sdk-react";
import { toast } from "sonner";
function ImportWallet() {
  const handleImportSuccess = () => {
    toast.success("Wallet successfully imported!");
  };
  const handleImportError = (errorMessage: string) => {
    toast.error(errorMessage);
  };
  return (
    <Import
      onHandleImportSuccess={handleImportSuccess}
      onError={handleImportError}
    />
  );
}
export default ImportWallet;
import { Export } from "@turnkey/sdk-react";
import { toast } from "sonner";
function ExportWallet() {
  const walletId = "your-wallet-id";
  const handleExportSuccess = () => {
    toast.success("Wallet successfully exported!");
  };
  const handleExportError = (errorMessage: string) => {
    toast.error(errorMessage);
  };
  return (
    <Export
      walletId={walletId}
      onHandleExportSuccess={handleExportSuccess}
      onError={handleExportError}
    />
  );
}
export default ExportWallet;
TurnkeyThemeProviderCustomize Turnkey components using CSS variables with the TurnkeyThemeProvider.
import { TurnkeyThemeProvider } from "@turnkey/sdk-react";
const customTheme = {
  "--text-primary": "#333333",
  "--button-bg": "#4c48ff",
  "--button-hover-bg": "#3b38e6",
};
export default function App() {
  return (
    <TurnkeyThemeProvider theme={customTheme}>
      <YourComponent />
    </TurnkeyThemeProvider>
  );
}
For detailed examples and advanced use cases, refer to our documentation here
FAQs
React SDK
The npm package @turnkey/sdk-react receives a total of 1,565 weekly downloads. As such, @turnkey/sdk-react popularity was classified as popular.
We found that @turnkey/sdk-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.