Better Auth plugin for TON Connect — sign in with TON wallets using ton_proof. Version 0.2.3. Provides server-side verification of TON Connect ton_proof payloads (nonce challenge, signature verification, wallet state-init parsing for v1–v5, on-chain get_public_key fallback) and a client plugin with typed helpers. Release cadence: active development. Key differentiators: integrates directly with Better Auth's session and user management, supports wildcard domain policies, per-network domain rules, anti-abuse cooldowns, and events. Requires @better-auth/core >=1.3.0, better-auth >=1.3.0, and optional react >=18 for client. Ships TypeScript types. Node >=20.
npm install ton-better-authNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Server plugin configuration with domain policies, anti-abuse settings, and client plugin initialization.
Upgrade Node to version 20 or later.
Use dynamic import() or convert project to ESM (type: module in package.json).
Use the per-network object in allowedDomains (e.g., allowedDomains: { '-3': [...] }) and avoid allowedDomainsByNetwork.Run 'npx @better-auth/cli@latest generate' to generate migration files, then apply them.
Retry the challenge endpoint on failure; do not reuse a previous nonce.
Use correct import path: import { tonConnectClient } from 'ton-better-auth/client'.Ensure import path is 'ton-better-auth/client' and Node >=20. For older Node, you may need to enable exports resolution.
Use import instead of require, or use dynamic import() in CommonJS.
Use named import: import { tonConnect } from 'ton-better-auth'Run 'npx @better-auth/cli@latest migrate' to create the table, or generate migration files.