- apps/api: POST /v1/auth/wallet/nonce + /v1/auth/wallet/login (zod-validated, sets the signed sk_session cookie like password/magic-link). - apps/dashboard: 'Connect Wallet' SIWE sign-in (plain viem + EIP-1193 personal_sign, no heavy deps) on login + signup; lib/auth wallet helpers. - persistence: PgAuthStore.findAccountByWallet/saveWalletNonce/consumeWalletNonce (atomic single-use consume); accounts.wallet_address projection. - database: auth_accounts.wallet_address column + auth_wallet_nonces table, migration 0006_auth_web3 + journal; re-export gt/lt operators. - 1302 tests / 213 suites, typecheck + full build green.
16 lines
773 B
SQL
16 lines
773 B
SQL
ALTER TABLE "auth_accounts" ADD COLUMN "wallet_address" text;--> statement-breakpoint
|
|
CREATE TABLE "auth_wallet_nonces" (
|
|
"id" text PRIMARY KEY NOT NULL,
|
|
"nonce" text NOT NULL,
|
|
"address" text NOT NULL,
|
|
"expires_at" timestamp with time zone NOT NULL,
|
|
"consumed_at" timestamp with time zone,
|
|
"metadata" jsonb DEFAULT '{}'::jsonb NOT NULL,
|
|
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
|
|
CONSTRAINT "auth_wallet_nonces_nonce_unique" UNIQUE("nonce")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX "auth_accounts_wallet_address_idx" ON "auth_accounts" USING btree ("wallet_address");--> statement-breakpoint
|
|
CREATE INDEX "auth_wallet_nonces_nonce_idx" ON "auth_wallet_nonces" USING btree ("nonce");
|