[PR #7238] SIWX #7166

Open
opened 2026-03-13 13:26:22 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7238
Author: @coopbri
Created: 1/10/2026
Status: 🔄 Open

Base: canaryHead: feature/siwx


📝 Commits (10+)

  • 86c5816 build(deps): add bs58, tweetnacl
  • c811ffb feature(plugins): add SIWX plugin
  • 534b1a2 docs: add SIWX docs
  • 781c023 chore(knip): ignore SIWX deps
  • ec78832 fix(plugins,siwx): increase safety of redirect URL construction
  • 29218a9 fix(plugins,siwx): increase safety of redirect URL construction
  • 17a5498 fix(siwx): fix callback account creation, add inline comments
  • 6b9a4cf Update packages/better-auth/src/plugins/siwx/index.ts
  • 1898e70 Update packages/better-auth/src/plugins/siwx/index.ts
  • ab74020 fix(plugins,siwx): calculate expiration timestamp once

📊 Changes

14 files changed (+2775 additions, -0 deletions)

View changed files

📝 .cspell/tech-terms.txt (+2 -0)
docs/content/docs/plugins/siwx.mdx (+453 -0)
📝 knip.jsonc (+7 -0)
📝 packages/better-auth/package.json (+3 -0)
packages/siwx/package.json (+76 -0)
packages/siwx/src/client.ts (+9 -0)
packages/siwx/src/index.ts (+607 -0)
packages/siwx/src/types.ts (+88 -0)
packages/siwx/src/utils.ts (+37 -0)
packages/siwx/test/siwx.test.ts (+1401 -0)
packages/siwx/tsconfig.json (+11 -0)
packages/siwx/tsdown.config.ts (+15 -0)
packages/siwx/vitest.config.ts (+3 -0)
📝 pnpm-lock.yaml (+63 -0)

📄 Description

Closes #6738

Implemented multi-chain wallet authentication supporting both EVM and Solana chains via a unified plugin based on the SIWX spec.

Unlike the SIWE plugin, this plugin does not currently have core schema changes. This is intentional based on conversation in #6738, but I can change this if there is strong community consensus otherwise.

More notes WIP nvm wow cubic is awesome


Summary by cubic

Add a new SIWX plugin as a dedicated @better-auth/siwx package to enable multi-chain wallet sign-in for EVM and Solana, with nonce/verify endpoints and optional native wallet callbacks. No core schema changes.

  • New Features

    • Dedicated @better-auth/siwx package and client export.
    • POST /siwx/nonce issues a 15‑min nonce with statement and default chainIds (evm=1, solana=mainnet-beta).
    • POST /siwx/verify builds a CAIP‑122 CACAO, calls verifyMessage, links/creates user and session; supports anonymous or email-required flows; optional signatureType (defaults: evm:eip191, solana:ed25519).
    • EVM checksum normalization, CAIP‑10 issuer, cross‑chain address linking.
    • Optional nameLookup for display name and avatar.
    • GET /siwx/callback/:provider (phantom, solflare, backpack) decrypts payload and signs in with configurable success/error redirects.
    • Added docs and comprehensive tests.
  • Bug Fixes

    • Safer success/error redirect URL construction in native callbacks.
    • Fixed callback account creation to reliably link wallets and start sessions.
    • Calculate nonce expiration once to avoid drift.

Written for commit da96ad61e4. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7238 **Author:** [@coopbri](https://github.com/coopbri) **Created:** 1/10/2026 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `feature/siwx` --- ### 📝 Commits (10+) - [`86c5816`](https://github.com/better-auth/better-auth/commit/86c58169b47704a0b008d27b30ea69cd9ecb5a20) build(deps): add bs58, tweetnacl - [`c811ffb`](https://github.com/better-auth/better-auth/commit/c811ffb19b9cdb2c20e6d51ab4252d55ef44e892) feature(plugins): add SIWX plugin - [`534b1a2`](https://github.com/better-auth/better-auth/commit/534b1a23b57eefc95f8c446a38399333bced77a4) docs: add SIWX docs - [`781c023`](https://github.com/better-auth/better-auth/commit/781c0230936e186ec02979da71af906aadf94cc9) chore(knip): ignore SIWX deps - [`ec78832`](https://github.com/better-auth/better-auth/commit/ec78832ad8dc93c8fbf0a92a7e5c8198c6ed5061) fix(plugins,siwx): increase safety of redirect URL construction - [`29218a9`](https://github.com/better-auth/better-auth/commit/29218a98aa2354c9b4227b366810b8ea277df911) fix(plugins,siwx): increase safety of redirect URL construction - [`17a5498`](https://github.com/better-auth/better-auth/commit/17a5498500bb4e67c02fcdb8d34178eddf91d39a) fix(siwx): fix callback account creation, add inline comments - [`6b9a4cf`](https://github.com/better-auth/better-auth/commit/6b9a4cfc59c3b7a0b5429beb2380fb99ece57e3d) Update packages/better-auth/src/plugins/siwx/index.ts - [`1898e70`](https://github.com/better-auth/better-auth/commit/1898e705e802f2be510b41ae0c2ebd0cd27686d1) Update packages/better-auth/src/plugins/siwx/index.ts - [`ab74020`](https://github.com/better-auth/better-auth/commit/ab740201fdb459182818774187b716862cb0c729) fix(plugins,siwx): calculate expiration timestamp once ### 📊 Changes **14 files changed** (+2775 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `.cspell/tech-terms.txt` (+2 -0) ➕ `docs/content/docs/plugins/siwx.mdx` (+453 -0) 📝 `knip.jsonc` (+7 -0) 📝 `packages/better-auth/package.json` (+3 -0) ➕ `packages/siwx/package.json` (+76 -0) ➕ `packages/siwx/src/client.ts` (+9 -0) ➕ `packages/siwx/src/index.ts` (+607 -0) ➕ `packages/siwx/src/types.ts` (+88 -0) ➕ `packages/siwx/src/utils.ts` (+37 -0) ➕ `packages/siwx/test/siwx.test.ts` (+1401 -0) ➕ `packages/siwx/tsconfig.json` (+11 -0) ➕ `packages/siwx/tsdown.config.ts` (+15 -0) ➕ `packages/siwx/vitest.config.ts` (+3 -0) 📝 `pnpm-lock.yaml` (+63 -0) </details> ### 📄 Description Closes #6738 Implemented multi-chain wallet authentication supporting both EVM and Solana chains via a unified plugin based on the [SIWX spec](https://docs.reown.com/appkit/react/core/siwx). Unlike the SIWE plugin, this plugin does not currently have core schema changes. This is intentional based on conversation in #6738, but I can change this if there is strong community consensus otherwise. ~~More notes WIP~~ nvm wow cubic is awesome <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add a new SIWX plugin as a dedicated @better-auth/siwx package to enable multi-chain wallet sign-in for EVM and Solana, with nonce/verify endpoints and optional native wallet callbacks. No core schema changes. - **New Features** - Dedicated @better-auth/siwx package and client export. - POST /siwx/nonce issues a 15‑min nonce with statement and default chainIds (evm=1, solana=mainnet-beta). - POST /siwx/verify builds a CAIP‑122 CACAO, calls verifyMessage, links/creates user and session; supports anonymous or email-required flows; optional signatureType (defaults: evm:eip191, solana:ed25519). - EVM checksum normalization, CAIP‑10 issuer, cross‑chain address linking. - Optional nameLookup for display name and avatar. - GET /siwx/callback/:provider (phantom, solflare, backpack) decrypts payload and signs in with configurable success/error redirects. - Added docs and comprehensive tests. - **Bug Fixes** - Safer success/error redirect URL construction in native callbacks. - Fixed callback account creation to reliably link wallets and start sessions. - Calculate nonce expiration once to avoid drift. <sup>Written for commit da96ad61e4c4dd3143e3b93e064c1d7d19e0007a. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:26:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7166