Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Quick Start

Install the SDK

npm
npm install @rhinestone/1auth

Get a JWT signing key

Every user intent is authenticated with your app's JWT — there is no anonymous fallback. Create an app in the Rhinestone dashboard to generate a signing key, then expose two same-origin endpoints that mint the JWTs the SDK attaches to each intent. See Fee Sponsorship for the full server setup.

Initialize Client

import { OneAuthClient } from "@rhinestone/1auth";
 
const client = new OneAuthClient({
  providerUrl: "https://passkey.1auth.app",
  clientId: "my-app",
  // Required for intents — points at the endpoints you created above.
  sponsorship: {
    accessTokenUrl: "/api/sponsorship/access-token",
    extensionTokenUrl: "/api/sponsorship/extension-token",
  },
});

The WebAuthn ceremony runs in your own page, and every distinct hostname gets its own passkey and smart account. See App-origin passkeys.

Send your first transaction

A sponsored intent needs nothing sourced from the user, so this runs on a brand-new account with a zero balance. Mint yourself 1 mUSD — a faucet token on Base Sepolia that anyone can mint — and the whole chain proves out at once: credentials, origin, passkey, orchestrator, sponsorship.

import { encodeFunctionData, parseAbi, parseUnits } from "viem";
 
const MUSD_BASE_SEPOLIA = "0x2f6fdE5E2AeAB6335d8f978B4d8B2a9c1129AcFb";
 
const auth = await client.authenticate();
if (!auth.success) throw new Error(auth.error.message);
 
const result = await client.sendIntent({
  accountAddress: auth.session.accountAddress,
  targetChain: 84532, // Base Sepolia
  calls: [
    {
      to: MUSD_BASE_SEPOLIA,
      data: encodeFunctionData({
        abi: parseAbi(["function mint(address to, uint256 amount)"]),
        functionName: "mint",
        args: [auth.session.accountAddress, parseUnits("1", 6)],
      }),
      label: "Mint",
      sublabel: "1 mUSD",
    },
  ],
});
 
console.log(result.success ? result.intentId : result.error?.code);

There is no tokenRequests here, which is why an empty account works — nothing has to be sourced or bridged. Add tokenRequests once a target-chain call needs tokens delivered to it first; see Crosschain, which starts from the mUSD you just minted.

Next Steps

React Components

Drop-in components like PayButton and BatchQueue. No viem or wagmi required.

Viem / Wagmi

Use createPasskeyWalletClient for viem-compatible signing in existing web3 apps.

References