@@ -135,108 +135,78 @@ export const OAuthTokensSchema = z
135135/**
136136 * OAuth 2.1 error response
137137 */
138- export const OAuthErrorResponseSchema = z . object ( {
139- error : z . string ( ) ,
140- error_description : z . string ( ) . optional ( ) ,
141- error_uri : z . string ( ) . optional ( ) ,
142- } ) ;
138+ export const OAuthErrorResponseSchema = z
139+ . object ( {
140+ error : z . string ( ) ,
141+ error_description : z . string ( ) . optional ( ) ,
142+ error_uri : z . string ( ) . optional ( ) ,
143+ } ) ;
143144
144145/**
145146 * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
146147 */
147- export const OAuthClientMetadataSchema = z
148- . object ( {
149- redirect_uris : z
150- . array ( z . string ( ) )
151- . refine ( ( uris ) => uris . every ( ( uri ) => URL . canParse ( uri ) ) , {
152- message : "redirect_uris must contain valid URLs" ,
153- } ) ,
154- token_endpoint_auth_method : z . string ( ) . optional ( ) ,
155- grant_types : z . array ( z . string ( ) ) . optional ( ) ,
156- response_types : z . array ( z . string ( ) ) . optional ( ) ,
157- client_name : z . string ( ) . optional ( ) ,
158- client_uri : z . string ( ) . optional ( ) ,
159- logo_uri : z . string ( ) . optional ( ) ,
160- scope : z . string ( ) . optional ( ) ,
161- contacts : z . array ( z . string ( ) ) . optional ( ) ,
162- tos_uri : z . string ( ) . optional ( ) ,
163- policy_uri : z . string ( ) . optional ( ) ,
164- jwks_uri : z . string ( ) . optional ( ) ,
165- jwks : z . any ( ) . optional ( ) ,
166- software_id : z . string ( ) . optional ( ) ,
167- software_version : z . string ( ) . optional ( ) ,
168- software_statement : z . string ( ) . optional ( ) ,
169- } )
170- . strip ( ) ;
148+ export const OAuthClientMetadataSchema = z . object ( {
149+ redirect_uris : z . array ( z . string ( ) ) . refine ( ( uris ) => uris . every ( ( uri ) => URL . canParse ( uri ) ) , { message : "redirect_uris must contain valid URLs" } ) ,
150+ token_endpoint_auth_method : z . string ( ) . optional ( ) ,
151+ grant_types : z . array ( z . string ( ) ) . optional ( ) ,
152+ response_types : z . array ( z . string ( ) ) . optional ( ) ,
153+ client_name : z . string ( ) . optional ( ) ,
154+ client_uri : z . string ( ) . optional ( ) ,
155+ logo_uri : z . string ( ) . optional ( ) ,
156+ scope : z . string ( ) . optional ( ) ,
157+ contacts : z . array ( z . string ( ) ) . optional ( ) ,
158+ tos_uri : z . string ( ) . optional ( ) ,
159+ policy_uri : z . string ( ) . optional ( ) ,
160+ jwks_uri : z . string ( ) . optional ( ) ,
161+ jwks : z . any ( ) . optional ( ) ,
162+ software_id : z . string ( ) . optional ( ) ,
163+ software_version : z . string ( ) . optional ( ) ,
164+ software_statement : z . string ( ) . optional ( ) ,
165+ } ) . strip ( ) ;
171166
172167/**
173168 * RFC 7591 OAuth 2.0 Dynamic Client Registration client information
174169 */
175- export const OAuthClientInformationSchema = z
176- . object ( {
177- client_id : z . string ( ) ,
178- client_secret : z . string ( ) . optional ( ) ,
179- client_id_issued_at : z . number ( ) . optional ( ) ,
180- client_secret_expires_at : z . number ( ) . optional ( ) ,
181- } )
182- . strip ( ) ;
170+ export const OAuthClientInformationSchema = z . object ( {
171+ client_id : z . string ( ) ,
172+ client_secret : z . string ( ) . optional ( ) ,
173+ client_id_issued_at : z . number ( ) . optional ( ) ,
174+ client_secret_expires_at : z . number ( ) . optional ( ) ,
175+ } ) . strip ( ) ;
183176
184177/**
185178 * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
186179 */
187- export const OAuthClientInformationFullSchema = OAuthClientMetadataSchema . merge (
188- OAuthClientInformationSchema
189- ) ;
180+ export const OAuthClientInformationFullSchema = OAuthClientMetadataSchema . merge ( OAuthClientInformationSchema ) ;
190181
191182/**
192183 * RFC 7591 OAuth 2.0 Dynamic Client Registration error response
193184 */
194- export const OAuthClientRegistrationErrorSchema = z
195- . object ( {
196- error : z . string ( ) ,
197- error_description : z . string ( ) . optional ( ) ,
198- } )
199- . strip ( ) ;
185+ export const OAuthClientRegistrationErrorSchema = z . object ( {
186+ error : z . string ( ) ,
187+ error_description : z . string ( ) . optional ( ) ,
188+ } ) . strip ( ) ;
200189
201190/**
202191 * RFC 7009 OAuth 2.0 Token Revocation request
203192 */
204- export const OAuthTokenRevocationRequestSchema = z
205- . object ( {
206- token : z . string ( ) ,
207- token_type_hint : z . string ( ) . optional ( ) ,
208- } )
209- . strip ( ) ;
193+ export const OAuthTokenRevocationRequestSchema = z . object ( {
194+ token : z . string ( ) ,
195+ token_type_hint : z . string ( ) . optional ( ) ,
196+ } ) . strip ( ) ;
210197
211198export type OAuthMetadata = z . infer < typeof OAuthMetadataSchema > ;
212- export type OpenIdProviderMetadata = z . infer <
213- typeof OpenIdProviderMetadataSchema
214- > ;
215-
216- export type OpenIdProviderDiscoveryMetadata = z . infer <
217- typeof OpenIdProviderDiscoveryMetadataSchema
218- > ;
199+ export type OpenIdProviderMetadata = z . infer < typeof OpenIdProviderMetadataSchema > ;
200+ export type OpenIdProviderDiscoveryMetadata = z . infer < typeof OpenIdProviderDiscoveryMetadataSchema > ;
219201
220202export type OAuthTokens = z . infer < typeof OAuthTokensSchema > ;
221203export type OAuthErrorResponse = z . infer < typeof OAuthErrorResponseSchema > ;
222204export type OAuthClientMetadata = z . infer < typeof OAuthClientMetadataSchema > ;
223- export type OAuthClientInformation = z . infer <
224- typeof OAuthClientInformationSchema
225- > ;
226- export type OAuthClientInformationFull = z . infer <
227- typeof OAuthClientInformationFullSchema
228- > ;
229- export type OAuthClientRegistrationError = z . infer <
230- typeof OAuthClientRegistrationErrorSchema
231- > ;
232- export type OAuthTokenRevocationRequest = z . infer <
233- typeof OAuthTokenRevocationRequestSchema
234- > ;
235- export type OAuthProtectedResourceMetadata = z . infer <
236- typeof OAuthProtectedResourceMetadataSchema
237- > ;
205+ export type OAuthClientInformation = z . infer < typeof OAuthClientInformationSchema > ;
206+ export type OAuthClientInformationFull = z . infer < typeof OAuthClientInformationFullSchema > ;
207+ export type OAuthClientRegistrationError = z . infer < typeof OAuthClientRegistrationErrorSchema > ;
208+ export type OAuthTokenRevocationRequest = z . infer < typeof OAuthTokenRevocationRequestSchema > ;
209+ export type OAuthProtectedResourceMetadata = z . infer < typeof OAuthProtectedResourceMetadataSchema > ;
238210
239211// Unified type for authorization server metadata
240- export type AuthorizationServerMetadata =
241- | OAuthMetadata
242- | OpenIdProviderDiscoveryMetadata ;
212+ export type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata ;
0 commit comments