@spfn/auth 0.3.0-beta.21 → 0.3.0-beta.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,35 @@
1
+ CREATE TABLE "spfn_auth"."mfa_totp" (
2
+ "id" bigserial PRIMARY KEY,
3
+ "user_id" bigint NOT NULL,
4
+ "secret_enc" text NOT NULL,
5
+ "confirmed_at" timestamp with time zone,
6
+ "last_used_step" bigint,
7
+ "failed_confirm_attempts" integer DEFAULT 0 NOT NULL,
8
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
9
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
10
+ );
11
+ --> statement-breakpoint
12
+ CREATE TABLE "spfn_auth"."mfa_recovery_codes" (
13
+ "id" bigserial PRIMARY KEY,
14
+ "user_id" bigint NOT NULL,
15
+ "generation" integer NOT NULL,
16
+ "code_hash" text NOT NULL,
17
+ "used_at" timestamp with time zone,
18
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
19
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
20
+ );
21
+ --> statement-breakpoint
22
+ CREATE TABLE "spfn_auth"."mfa_verifications" (
23
+ "key_id" text PRIMARY KEY,
24
+ "user_id" bigint NOT NULL,
25
+ "method" text NOT NULL,
26
+ "verified_at" timestamp with time zone DEFAULT now() NOT NULL
27
+ );
28
+ --> statement-breakpoint
29
+ ALTER TABLE "spfn_auth"."passkeys" ADD COLUMN "second_factor" boolean DEFAULT false NOT NULL;--> statement-breakpoint
30
+ CREATE UNIQUE INDEX "mfa_totp_user_id_idx" ON "spfn_auth"."mfa_totp" ("user_id");--> statement-breakpoint
31
+ CREATE INDEX "mfa_recovery_codes_user_generation_idx" ON "spfn_auth"."mfa_recovery_codes" ("user_id","generation");--> statement-breakpoint
32
+ ALTER TABLE "spfn_auth"."mfa_totp" ADD CONSTRAINT "mfa_totp_user_id_users_id_fkey" FOREIGN KEY ("user_id") REFERENCES "spfn_auth"."users"("id") ON DELETE CASCADE;--> statement-breakpoint
33
+ ALTER TABLE "spfn_auth"."mfa_recovery_codes" ADD CONSTRAINT "mfa_recovery_codes_user_id_users_id_fkey" FOREIGN KEY ("user_id") REFERENCES "spfn_auth"."users"("id") ON DELETE CASCADE;--> statement-breakpoint
34
+ ALTER TABLE "spfn_auth"."mfa_verifications" ADD CONSTRAINT "mfa_verifications_key_id_user_public_keys_key_id_fkey" FOREIGN KEY ("key_id") REFERENCES "spfn_auth"."user_public_keys"("key_id") ON DELETE CASCADE;--> statement-breakpoint
35
+ ALTER TABLE "spfn_auth"."mfa_verifications" ADD CONSTRAINT "mfa_verifications_user_id_users_id_fkey" FOREIGN KEY ("user_id") REFERENCES "spfn_auth"."users"("id") ON DELETE CASCADE;