> For the complete documentation index, see [llms.txt](https://seekspeed.gitbook.io/seekspeed-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://seekspeed.gitbook.io/seekspeed-docs/security/solana.md).

# Solana Wallet Auth

A passwordless login path for users who already have a Solana wallet (Phantom or Solflare). No email, no OAuth bounce.

## Flow

```
1. Client requests a nonce from the server.
2. Server returns { nonce, issuedAt, expiresAt } and stores it server-side.
3. Wallet signs `SeekSpeed login: <nonce>` with the user's secret key.
4. Client posts { publicKey, signature } back.
5. Server verifies with tweetnacl.sign.detached.verify(...).
6. Server mints a Supabase session for the deterministic internal email
   `sol-<base58(pubkey)>@wallet.seekspeed.local`.
7. Client stores the session and proceeds.
```

## Server fn

```ts
// src/lib/solana-auth.functions.ts (excerpt)
export const exchangeSolanaSignature = createServerFn({ method: "POST" })
  .inputValidator((d) => Schema.parse(d))
  .handler(async ({ data }) => {
    const nonce = await consumeNonce(data.nonce);
    if (!nonce) throw new Error("nonce expired");

    const msg = new TextEncoder().encode(`SeekSpeed login: ${data.nonce}`);
    const sig = bs58.decode(data.signature);
    const pk  = bs58.decode(data.publicKey);
    if (!nacl.sign.detached.verify(msg, sig, pk)) {
      throw new Error("invalid signature");
    }

    const email = `sol-${data.publicKey.toLowerCase()}@wallet.seekspeed.local`;
    return mintOrLoginSupabaseSession(email);
  });
```

## Why this matters

For research teams running self-hosted inference on rented GPU pools, a wallet-based login removes the email round-trip and the password-management surface entirely. Same workspace model, same RLS, different credential.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://seekspeed.gitbook.io/seekspeed-docs/security/solana.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
