Management API Reference

Quickstart

Get started with Openfort libraries

Openfort Kit is the easiest way to onboard your users onchain.

    Providers
  • Guest
  • Email
  • Wallet
  • Google
  • Facebook
  • X
  • Drag and drop to reorder providers
    Click to enable or disable providers
Themes
Social login configuration
Login with social login oauth providers (e.g. Google, X) will not work in this demo due to iframe cross-origin restrictions.View live demo

You will get out of the box support for:

  1. Simple UX — Give users a simple, attractive experience.
  2. Multiple login methods - Email, Social, WalletConnect, and more.
  3. Non-custodial embedded signer - Secure, self-custodied signing without complexity
  4. Connection with Web3 wallets
  5. Beautiful Themes - Predesigned themes or full customization

1. Install#

Start by installing Openfort Kit and its peer dependencies using your package manager of choice:

Terminal

_10
npm install @openfort/openfort-kit wagmi viem@^2.22.0 @tanstack/react-query

2. Get your API keys#

In the API keys section of Openfort dashboard, you will find:

  • Publishable Key: Safe to expose in client-side environment
  • Secret Key: Must be kept secure and used only server-side

To generate non-custodial wallets:

  1. Scroll to the Shield section and click Create Shield keys
  2. Store the encryption share safely when it appears (you'll only see it once)
  3. You'll receive:
    • Shield Publishable Key: Safe for client-side use
    • Shield Secret Key: Keep secure, server-side only

3. Set up providers.#

Set up providers for Wagmi, TanStack Query, and OpenfortKit.

To set up a config for Wagmi, we will use Wagmi's createConfig function with @openfort/openfort-kit's getDefaultConfig function. This automatically sets up the Wagmi instance to support all chains and transports supported by Openfort. If you need more configuration go to the Wagmi configuration guide.

To set up OpenfortKitProvider we will need the publishable key from the Openfort dashboard, and the wallet configuration. More information on the wallet configuration can be found here.

Providers.tsx

_49
'use client'
_49
_49
import React from 'react'
_49
import { AuthProvider, OpenfortKitProvider, getDefaultConfig, RecoveryMethod } from '@openfort/openfort-kit';
_49
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
_49
import { WagmiProvider, createConfig } from 'wagmi'
_49
import { polygonAmoy } from 'viem/chains'
_49
_49
const config = createConfig(
_49
getDefaultConfig({
_49
appName: 'OpenfortKit demo',
_49
walletConnectProjectId: "YOUR_WALLET_CONNECT_PROJECT_ID",
_49
chains: [polygonAmoy],
_49
ssr: true, // Enable server-side rendering if needed
_49
})
_49
);
_49
_49
const queryClient = new QueryClient()
_49
_49
export function Providers({ children }: { children: React.ReactNode }) {
_49
return (
_49
<WagmiProvider config={config}>
_49
<QueryClientProvider client={queryClient}>
_49
<OpenfortKitProvider
_49
// Set the publishable key of your OpenfortKit account. This field is required.
_49
publishableKey={"YOUR_PUBLISHABLE_KEY"}
_49
_49
// Set the wallet configuration. In this example, we will be using the embedded signer.
_49
walletConfig={{
_49
createEmbeddedSigner: true,
_49
_49
embeddedSignerConfiguration: {
_49
shieldPublishableKey: "YOUR_SHIELD_PUBLISHABLE_KEY",
_49
_49
// Set the recovery method you want to use, in this case we will use the password recovery method
_49
recoveryMethod: RecoveryMethod.PASSWORD,
_49
_49
// With password recovery we can set the encryption key to encrypt the recovery data
_49
// This way we don't have a backend to store the recovery data
_49
shieldEncryptionKey: "YOUR_SHIELD_ENCRYPTION_SHARE"!,
_49
}
_49
}}
_49
>
_49
{children}
_49
</OpenfortKitProvider>
_49
</QueryClientProvider>
_49
</WagmiProvider>
_49
)
_49
}

Wrap your app in the Providers component.

App.tsx

_10
import React from 'react'
_10
import { Providers } from './Providers'
_10
_10
export default function App() {
_10
return (
_10
<Providers>
_10
{/* Your app content */}
_10
</Providers>
_10
)
_10
}

4. You're good to go!#

Once you've configured your app, you can now use OpenfortKitButton to onboard your users.

page.tsx

_11
import { OpenfortKitButton } from '@openfort/openfort-kit';
_11
_11
function App() {
_11
return (
_11
<div>
_11
<OpenfortKitButton />
_11
</div>
_11
);
_11
};
_11
_11
export default App;

5. Next steps#

Now that you've set up Openfort Kit, you can explore more features and customization options: