Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.0xkey.io/llms.txt

Use this file to discover all available pages before exploring further.

By calling loginWithPasskey(), the SDK stores the session and active client in localStorage. The signing key material remains securely stored in the browser’s IndexedDB and is never extractable. 0xkey uses this public key to scope and encrypt the session to the appropriate user. For custom UI without React, see @0xkey-io/core — session and stamper setup is handled by ZeroXKeyClient after init().

Steps using @0xkey-io/react-wallet-kit

1

Initialize the React Provider

import { ZeroXKeyProvider } from "@0xkey-io/react-wallet-kit";

const oxkeyConfig = {
  apiBaseUrl: "https://api.0xkey.io",
  defaultOrganizationId: process.env.OXKEY_ORGANIZATION_ID,
  rpId: process.env.RPID,
};

...

<div className="App">
  <ZeroXKeyProvider config={oxkeyConfig}>
    {/* Your app components */}
  </ZeroXKeyProvider>
</div>
2

Login with a Passkey and Create a Session

import { useZeroXKey } from "@0xkey-io/react-wallet-kit";

const { passkeyClient, indexedDbClient } = useZeroXKey();

await indexedDbClient.init();
const publicKey = await indexedDbClient.getPublicKey();

await passkeyClient.loginWithPasskey({
  publicKey,
  sessionType: "SESSION_TYPE_READ_WRITE", // or "SESSION_TYPE_READ_ONLY"
  expirationSeconds: 900,
});
3

Use the session to make requests

const { getActiveClient } = useZeroXKey();
const client = await getActiveClient();

const whoami = await client.getWhoami({
  organizationId: <your-org-id>,
});
getActiveClient() returns the currently active client (e.g. IndexedDb-backed), refreshing automatically if needed.