@rhinestone/1auth
v0.6.8
Published
Passkey-based authentication SDK for Web3 applications
Keywords
Readme
@rhinestone/1auth
Passkey-based authentication SDK for Web3 applications. Build seamless, secure authentication flows using passkeys (WebAuthn) for smart accounts.
Installation
npm install @rhinestone/1auth
# or
pnpm add @rhinestone/1auth
# or
yarn add @rhinestone/1authPeer Dependencies
npm install viem @wagmi/core
# React (optional, for PayButton component)
npm install reactEntry Points
The SDK provides multiple entry points for different use cases:
| Entry Point | Import | Use Case |
|-------------|--------|----------|
| Default | @rhinestone/1auth | Core client, provider, types |
| React | @rhinestone/1auth/react | PayButton component |
| Server | @rhinestone/1auth/server | Server-side intent signing |
| Wagmi | @rhinestone/1auth/wagmi | Wagmi connector integration |
Quick Start
Basic Setup
import { OneAuthClient, createOneAuthProvider } from '@rhinestone/1auth';
// Create the client
const client = new OneAuthClient({
passkeyServerUrl: 'https://passkey.1auth.box',
});
// Create an EIP-1193 compatible provider
const provider = createOneAuthProvider(client);React Integration
import { PayButton } from '@rhinestone/1auth/react';
function CheckoutPage() {
return (
<PayButton
intent={intent}
onSuccess={(result) => console.log('Payment successful', result)}
onError={(error) => console.error('Payment failed', error)}
/>
);
}Wagmi Connector
import { oneAuth } from '@rhinestone/1auth/wagmi';
import { createConfig, http } from 'wagmi';
import { mainnet, sepolia } from 'wagmi/chains';
const config = createConfig({
chains: [mainnet, sepolia],
connectors: [
oneAuth({
passkeyServerUrl: 'https://passkey.1auth.box',
}),
],
transports: {
[mainnet.id]: http(),
[sepolia.id]: http(),
},
});Server-Side Intent Signing
import { signIntent, createSignIntentHandler } from '@rhinestone/1auth/server';
// Sign an intent with Ed25519
const signedIntent = await signIntent(intent, privateKey);
// Or create a request handler
const handler = createSignIntentHandler({
privateKey: process.env.SIGNING_KEY,
});Core Exports
@rhinestone/1auth
OneAuthClient- Main client for passkey operationscreateOneAuthProvider()- EIP-1193 compatible provider factorycreatePasskeyWalletClient()- viem WalletClient with passkey supportgetSupportedChains()- Get list of supported chainsgetSupportedTokens()- Get list of supported tokens- Type exports for intents, accounts, and more
@rhinestone/1auth/react
PayButton- Pre-built payment/intent button componentBatchQueueProvider- Context provider for batch operationsBatchQueueWidget- UI widget for batch queue managementuseBatchQueue- Hook for batch queue operations
@rhinestone/1auth/server
signIntent()- Server-side intent signing with Ed25519createSignIntentHandler()- Express/fetch handler for intent signing
@rhinestone/1auth/wagmi
oneAuth()- Wagmi connector factory
License
MIT
