Skip to content

Support Sign-In With Solana (SIWS) for WalletConnect signMessage #1153

@0xh3rman

Description

@0xh3rman

Phantom-pioneered Sign-In With Solana (solana:signIn) is the Solana analog of SIWE: dApp sends a structured SolanaSignInInput, wallet formats canonical text, signs Ed25519, returns { signedMessage, signature }. Phantom (extension + mobile), Solflare, Backpack already implement it on the wallet side, so requests will show up via WalletConnect. Production dApp adoption is still small (DRiP Haus, Phantom demos, Supabase-backed apps) but growing.

Scope (~300-400 LOC, mirrors gem_evm::siwe):

  • New gem_solana::siws module with parser + builder for the canonical text format
  • New SignDigestType::SolanaSignIn variant
  • WC handler maps solana:signIn -> SignMessage with the new type
  • MessageSigner::preview / payload_preview surface structured fields (domain, statement, expiration) the same way SIWE does
  • Domain validation against WC session origin (reuse validate_session_domain from crates/gem_wallet_connect/src/validator.rs)

Gotchas:

  • chainId is a string (mainnet/devnet/solana:<genesisHash>), not a u64 — don't reuse the SIWE parser
  • Verify against output.signedMessage bytes; Phantom mobile prepends an OCMS header before signing
  • Enforce issuedAt <= notBefore <= expirationTime with ~10min skew
  • Ledger can't display SIWS messages today; fall back to plain signMessage gracefully

Spec: https://github.com/anza-xyz/wallet-standard/blob/master/packages/core/util/src/signIn.ts
Phantom blog: https://phantom.com/learn/developers/sign-in-with-solana

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions