better-auth-solana is a specialized plugin for the Better Auth authentication framework, designed to facilitate "Sign in With Solana" (SIWS) functionality. Currently at version 1.0.0, it provides a stable, initial release enabling Solana wallet integration into Better Auth applications. The package includes server-side endpoints for managing the SIWS flow (nonce generation, signature verification, wallet linking) and client-side utilities for constructing SIWS messages and interacting with the Better Auth client. It natively handles session establishment and account creation/linking within the Better Auth ecosystem, using its dedicated `siws` plugin namespace. The package is published as ESM-only, aligning with better-auth's modern module strategy.
npm install better-auth-solanaVerified import paths — ran on the pinned version, not inferred.
Demonstrates a complete client-side 'Sign in With Solana' (SIWS) flow, including nonce retrieval, message creation, wallet signing (mocked), and session verification with Better Auth.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) or use dynamic `import()` for CJS compatibility layers where appropriate.
Run `npm install @solana/kit@^6.8.0 better-auth@^1.5.0 better-auth-solana` (or use `yarn`/`bun`) to ensure all required peer dependencies are present and compatible.
Use `verify` for initial sign-in flows and `link` only when a user is already logged in and wants to add another wallet address to their existing account.
When configuring frontend API calls or proxies, ensure the full path including the `/siws/` segment is correctly used for all interactions with the plugin's endpoints.
Migrate your file or project to use ES Modules (`import ... from '...'`) or dynamically import the package using `await import(...)`.
Verify the server is running and the `siws` plugin is correctly configured. Check network requests in your browser's developer tools for errors from the `/siws/nonce` endpoint and ensure `walletAddress` is valid.
Ensure `createSIWSInput` or `createSIWSMessage` is used correctly to generate the message. Confirm the wallet's `signMessage` function is returning the expected message and a valid signature. The `domain`, `uri`, and other SIWS fields must match those expected by the server.