Appearance
Quickstart
Install the SDK and configure the wallet iframe (origin, service path, headers) so sensitive flows run in an isolated wallet origin. For a more detailed walkthrough, see Installation.
1. Install the SDK
bash
pnpm add @tatchi-xyz/sdkbash
npm i @tatchi-xyz/sdkbash
yarn add @tatchi-xyz/sdk2. Configure Vite
Install framework packages. We'll be using Vite.
bash
pnpm add react react-dom
pnpm add -D vite @vitejs/plugin-reactbash
npm add react react-dom
npm add -D vite @vitejs/plugin-reactbash
yarn add react react-dom
yarn add -D vite @vitejs/plugin-reactThen add the following Tatchi plugins to your vite.config.ts file:
typescript
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { tatchiAppServer, tatchiBuildHeaders } from '@tatchi-xyz/sdk/plugins/vite'
export default defineConfig(({ mode }) => {
const walletOrigin = 'https://wallet.web3authn.org'
return {
plugins: [
react(),
tatchiAppServer({ walletOrigin }),
tatchiBuildHeaders({ walletOrigin }),
],
}
})These plugins add the right headers that allow your app to access the wallet origin which serves the wallet SDK from a secure iframe.
You may also choose to self-host the wallet SDK (more on this later in the selfhosting section).
3. Enable HTTPS (Caddy setup)
Passkeys require a secure context (HTTPS). You can use Caddy for local development:
bash
brew install caddy # macOS (see caddyserver.com for other OSes)
caddy trust # trust local CA so browsers accept TLSAdd a Caddyfile in the root directory:
caddy
example.localhost {
tls internal
encode gzip
reverse_proxy localhost:5173 # Vite default port
}4. React Setup
Setup the React provider:
tsx
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App.jsx'
import { TatchiPasskeyProvider } from '@tatchi-xyz/sdk/react/provider'
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<TatchiPasskeyProvider
config={{
iframeWallet: {
walletOrigin: "https://wallet.web3authn.org",
},
relayer: {
url: "https://relay.tatchi.xyz",
},
}}
>
<App />
</TatchiPasskeyProvider>
</React.StrictMode>,
)Then in your App.tsx:
tsx
import { useTatchi } from '@tatchi-xyz/sdk/react';
function App() {
const { tatchi } = useTatchi();
const { configs } = tatchi;
return (
<main>
<h1>Tatchi Example</h1>
<button onClick={() => {
const id = Date.now();
tatchi.registerPasskey(`tatchi-test-${id}.${configs.contractId}`, {
onEvent: (event) => console.log('registration event: ', event)
});
}}>
Register Tatchi Account
</button>
</main>
)
}
export default App5. Your first run
Open two separate tabs and run the Caddy and Vite servers:
Caddy:
bash
caddy run --config Caddyfile --adapter caddyfileVite:
bash
pnpm devThen navigate to:
https://example.localhostYou should see a registration button, which registers passkey derived wallets onchain.
Next Steps
After you've got the SDK installed, we will walk through login, and sending your first transaction in next Steps.
Troubleshooting (new users)
WebAuthn requires HTTPS
- Symptom: no TouchID/biometric prompt or errors like “Operation is insecure”.
- Fix: use Caddy and open
https://example.localhost(nothttp://localhost). If the browser warns about certs, runcaddy trustand try again.
Wallet iframe not connecting
- Symptom: actions hang; no network requests to the wallet origin.
- Fix: ensure
walletOriginis set and useshttps(Quickstart useshttps://wallet.web3authn.org). If you changed it, verify the URL is reachable from the browser.
Buttons do nothing (no prompt)
- Symptom: calling register/login from effects or timers does nothing.
- Fix: WebAuthn must run from a user gesture. Trigger flows from
onClickhandlers as shown.