@@ -74,7 +74,7 @@ func TestConfigParsing(t *testing.T) {
7474 // Run test
7575 assert .Error (t , config .Load ("" , fsys ))
7676 })
77- t .Run ("config file with passkey settings" , func (t * testing.T ) {
77+ t .Run ("config file with passkey and webauthn settings" , func (t * testing.T ) {
7878 config := NewConfig ()
7979 fsys := fs.MapFS {
8080 "supabase/config.toml" : & fs.MapFile {Data : []byte (`
@@ -83,6 +83,7 @@ enabled = true
8383site_url = "http://127.0.0.1:3000"
8484[auth.passkey]
8585enabled = true
86+ [auth.webauthn]
8687rp_display_name = "Supabase CLI"
8788rp_id = "localhost"
8889rp_origins = ["http://127.0.0.1:3000", "https://localhost:3000"]
@@ -93,15 +94,56 @@ rp_origins = ["http://127.0.0.1:3000", "https://localhost:3000"]
9394 // Check result
9495 if assert .NotNil (t , config .Auth .Passkey ) {
9596 assert .True (t , config .Auth .Passkey .Enabled )
96- assert .Equal (t , "Supabase CLI" , config .Auth .Passkey .RpDisplayName )
97- assert .Equal (t , "localhost" , config .Auth .Passkey .RpId )
97+ }
98+ if assert .NotNil (t , config .Auth .Webauthn ) {
99+ assert .Equal (t , "Supabase CLI" , config .Auth .Webauthn .RpDisplayName )
100+ assert .Equal (t , "localhost" , config .Auth .Webauthn .RpId )
98101 assert .Equal (t , []string {
99102 "http://127.0.0.1:3000" ,
100103 "https://localhost:3000" ,
101- }, config .Auth .Passkey .RpOrigins )
104+ }, config .Auth .Webauthn .RpOrigins )
102105 }
103106 })
104107
108+ t .Run ("webauthn section without passkey loads successfully" , func (t * testing.T ) {
109+ config := NewConfig ()
110+ fsys := fs.MapFS {
111+ "supabase/config.toml" : & fs.MapFile {Data : []byte (`
112+ [auth]
113+ enabled = true
114+ site_url = "http://127.0.0.1:3000"
115+ [auth.webauthn]
116+ rp_display_name = "Supabase CLI"
117+ rp_id = "localhost"
118+ rp_origins = ["http://127.0.0.1:3000"]
119+ ` )},
120+ }
121+ // Run test
122+ assert .NoError (t , config .Load ("" , fsys ))
123+ // Check result
124+ assert .Nil (t , config .Auth .Passkey )
125+ if assert .NotNil (t , config .Auth .Webauthn ) {
126+ assert .Equal (t , "localhost" , config .Auth .Webauthn .RpId )
127+ }
128+ })
129+
130+ t .Run ("passkey enabled requires webauthn section" , func (t * testing.T ) {
131+ config := NewConfig ()
132+ fsys := fs.MapFS {
133+ "supabase/config.toml" : & fs.MapFile {Data : []byte (`
134+ [auth]
135+ enabled = true
136+ site_url = "http://127.0.0.1:3000"
137+ [auth.passkey]
138+ enabled = true
139+ ` )},
140+ }
141+ // Run test
142+ err := config .Load ("" , fsys )
143+ // Check result
144+ assert .ErrorContains (t , err , "Missing required config section: auth.webauthn" )
145+ })
146+
105147 t .Run ("passkey enabled requires rp_id" , func (t * testing.T ) {
106148 config := NewConfig ()
107149 fsys := fs.MapFS {
@@ -111,13 +153,14 @@ enabled = true
111153site_url = "http://127.0.0.1:3000"
112154[auth.passkey]
113155enabled = true
156+ [auth.webauthn]
114157rp_origins = ["http://127.0.0.1:3000"]
115158` )},
116159 }
117160 // Run test
118161 err := config .Load ("" , fsys )
119162 // Check result
120- assert .ErrorContains (t , err , "Missing required field in config: auth.passkey .rp_id" )
163+ assert .ErrorContains (t , err , "Missing required field in config: auth.webauthn .rp_id" )
121164 })
122165
123166 t .Run ("passkey enabled requires rp_origins" , func (t * testing.T ) {
@@ -129,13 +172,14 @@ enabled = true
129172site_url = "http://127.0.0.1:3000"
130173[auth.passkey]
131174enabled = true
175+ [auth.webauthn]
132176rp_id = "localhost"
133177` )},
134178 }
135179 // Run test
136180 err := config .Load ("" , fsys )
137181 // Check result
138- assert .ErrorContains (t , err , "Missing required field in config: auth.passkey .rp_origins" )
182+ assert .ErrorContains (t , err , "Missing required field in config: auth.webauthn .rp_origins" )
139183 })
140184
141185 t .Run ("parses experimental pgdelta config" , func (t * testing.T ) {
0 commit comments