@@ -7,6 +7,92 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77
88## [ Unreleased]
99
10+ ## [ 8.1.0]
11+
12+ - Adds support for webauthn (passkeys)
13+
14+ ### Migration
15+
16+ ``` sql
17+ CREATE INDEX IF NOT EXISTS emailverification_verified_emails_app_id_email_index ON emailverification_verified_emails
18+ (app_id, email);
19+
20+ CREATE TABLE IF NOT EXISTS webauthn_account_recovery_tokens (
21+ app_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
22+ tenant_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
23+ user_id CHAR (36 ) NOT NULL ,
24+ email VARCHAR (256 ) NOT NULL ,
25+ token VARCHAR (256 ) NOT NULL ,
26+ expires_at BIGINT NOT NULL ,
27+ CONSTRAINT webauthn_account_recovery_token_pkey PRIMARY KEY (app_id, tenant_id, user_id, token),
28+ CONSTRAINT webauthn_account_recovery_token_user_id_fkey FOREIGN KEY (app_id, tenant_id, user_id) REFERENCES
29+ all_auth_recipe_users(app_id, tenant_id, user_id) ON DELETE CASCADE
30+ );
31+
32+ CREATE TABLE IF NOT EXISTS webauthn_credentials (
33+ id VARCHAR (256 ) NOT NULL ,
34+ app_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
35+ rp_id VARCHAR (256 ) NOT NULL ,
36+ user_id CHAR (36 ),
37+ counter BIGINT NOT NULL ,
38+ public_key BYTEA NOT NULL ,
39+ transports TEXT NOT NULL ,
40+ created_at BIGINT NOT NULL ,
41+ updated_at BIGINT NOT NULL ,
42+ CONSTRAINT webauthn_credentials_pkey PRIMARY KEY (app_id, rp_id, id),
43+ CONSTRAINT webauthn_credentials_user_id_fkey FOREIGN KEY (app_id, user_id) REFERENCES webauthn_users
44+ (app_id, user_id) ON DELETE CASCADE
45+ );
46+
47+ CREATE TABLE IF NOT EXISTS webauthn_generated_options (
48+ app_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
49+ tenant_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
50+ id CHAR (36 ) NOT NULL ,
51+ challenge VARCHAR (256 ) NOT NULL ,
52+ email VARCHAR (256 ),
53+ rp_id VARCHAR (256 ) NOT NULL ,
54+ rp_name VARCHAR (256 ) NOT NULL ,
55+ origin VARCHAR (256 ) NOT NULL ,
56+ expires_at BIGINT NOT NULL ,
57+ created_at BIGINT NOT NULL ,
58+ user_presence_required BOOLEAN DEFAULT false NOT NULL ,
59+ user_verification VARCHAR (12 ) DEFAULT ' preferred' NOT NULL ,
60+ CONSTRAINT webauthn_generated_options_pkey PRIMARY KEY (app_id, tenant_id, id),
61+ CONSTRAINT webauthn_generated_options_tenant_id_fkey FOREIGN KEY (app_id, tenant_id) REFERENCES tenants
62+ (app_id, tenant_id) ON DELETE CASCADE
63+ );
64+
65+ CREATE TABLE IF NOT EXISTS webauthn_user_to_tenant (
66+ app_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
67+ tenant_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
68+ user_id CHAR (36 ) NOT NULL ,
69+ email VARCHAR (256 ) NOT NULL ,
70+ CONSTRAINT webauthn_user_to_tenant_email_key UNIQUE (app_id, tenant_id, email),
71+ CONSTRAINT webauthn_user_to_tenant_pkey PRIMARY KEY (app_id, tenant_id, user_id),
72+ CONSTRAINT webauthn_user_to_tenant_user_id_fkey FOREIGN KEY (app_id, tenant_id, user_id) REFERENCES
73+ all_auth_recipe_users(app_id, tenant_id, user_id) ON DELETE CASCADE
74+ );
75+
76+ CREATE TABLE IF NOT EXISTS webauthn_users (
77+ app_id VARCHAR (64 ) DEFAULT ' public' NOT NULL ,
78+ user_id CHAR (36 ) NOT NULL ,
79+ email VARCHAR (256 ) NOT NULL ,
80+ rp_id VARCHAR (256 ) NOT NULL ,
81+ time_joined BIGINT NOT NULL ,
82+ CONSTRAINT webauthn_users_pkey PRIMARY KEY (app_id, user_id),
83+ CONSTRAINT webauthn_users_user_id_fkey FOREIGN KEY (app_id, user_id) REFERENCES app_id_to_user_id(app_id,
84+ user_id) ON DELETE CASCADE
85+ );
86+
87+ CREATE INDEX IF NOT EXISTS webauthn_user_to_tenant_email_index ON webauthn_user_to_tenant (app_id, email);
88+ CREATE INDEX IF NOT EXISTS webauthn_user_challenges_expires_at_index ON webauthn_generated_options (app_id, tenant_id, expires_at);
89+ CREATE INDEX IF NOT EXISTS webauthn_credentials_user_id_index ON webauthn_credentials (user_id);
90+ CREATE INDEX IF NOT EXISTS webauthn_account_recovery_token_token_index ON webauthn_account_recovery_tokens (app_id, tenant_id, token);
91+ CREATE INDEX IF NOT EXISTS webauthn_account_recovery_token_expires_at_index ON webauthn_account_recovery_tokens (expires_at DESC );
92+ CREATE INDEX IF NOT EXISTS webauthn_account_recovery_token_email_index ON webauthn_account_recovery_tokens (app_id, tenant_id, email);
93+ ```
94+
95+
1096## [ 8.0.2]
1197
1298- Fixes ` NullPointerException ` in user search API
0 commit comments