- Create @reviq/utils package with PBKDF2-SHA256 password hashing compatible with Cloudflare Workers (uses crypto.subtle) - Update api-server and CLI to use new utils package for consistent password hashing format across the codebase - Add pino logging to api-server for better request debugging - Make login request tokens cryptographically secure base58 strings instead of database IDs - Add migration to make login_requests.token non-nullable with unique constraint - Fix RPCLink URL construction for client-side API calls - Add db:codegen script to root package.json Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
18 lines
588 B
SQL
18 lines
588 B
SQL
-- migrate:up
|
|
-- First, delete any existing login requests (they're temporary auth state anyway)
|
|
DELETE FROM login_requests;
|
|
|
|
-- Make token column required and add unique constraint
|
|
ALTER TABLE login_requests
|
|
ALTER COLUMN token SET NOT NULL,
|
|
ADD CONSTRAINT login_requests_token_unique UNIQUE (token);
|
|
|
|
-- Create index for token lookups
|
|
CREATE INDEX idx_login_requests_token ON login_requests(token);
|
|
|
|
-- migrate:down
|
|
DROP INDEX IF EXISTS idx_login_requests_token;
|
|
ALTER TABLE login_requests
|
|
DROP CONSTRAINT IF EXISTS login_requests_token_unique,
|
|
ALTER COLUMN token DROP NOT NULL;
|