Files
Synapsis/drizzle/0009_sweet_chat.sql
T
Christopher 5903022f8a Add encrypted key support for chat and nodes
Introduces encrypted private key storage for nodes and users, updates chat message schema to support sender-side encryption, and adds supporting libraries and tests for cryptographic signing and identity unlock flows. Includes new database migrations, API route updates, and React components for identity unlock prompts.
2026-01-27 17:13:28 -08:00

21 lines
964 B
SQL

CREATE TABLE "remote_identity_cache" (
"did" text PRIMARY KEY NOT NULL,
"public_key" text NOT NULL,
"fetched_at" timestamp NOT NULL,
"expires_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "signed_action_dedupe" (
"action_id" text PRIMARY KEY NOT NULL,
"did" text NOT NULL,
"nonce" text NOT NULL,
"ts" bigint NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "chat_messages" ADD COLUMN "sender_encrypted_content" text;--> statement-breakpoint
ALTER TABLE "chat_messages" ADD COLUMN "sender_chat_public_key" text;--> statement-breakpoint
ALTER TABLE "nodes" ADD COLUMN "private_key_encrypted" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "chat_public_key" text;--> statement-breakpoint
ALTER TABLE "users" ADD COLUMN "chat_private_key_encrypted" text;--> statement-breakpoint
CREATE INDEX "signed_action_dedupe_created_idx" ON "signed_action_dedupe" USING btree ("created_at");