@@ -135,78 +135,66 @@ export const OAuthTokensSchema = z
135
135
/**
136
136
* OAuth 2.1 error response
137
137
*/
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
+ } ) ;
143
144
144
145
/**
145
146
* RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
146
147
*/
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 ( ) ;
171
166
172
167
/**
173
168
* RFC 7591 OAuth 2.0 Dynamic Client Registration client information
174
169
*/
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 ( ) ;
183
176
184
177
/**
185
178
* RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
186
179
*/
187
- export const OAuthClientInformationFullSchema = OAuthClientMetadataSchema . merge (
188
- OAuthClientInformationSchema
189
- ) ;
180
+ export const OAuthClientInformationFullSchema =
181
+ OAuthClientMetadataSchema . merge ( OAuthClientInformationSchema ) ;
190
182
191
183
/**
192
184
* RFC 7591 OAuth 2.0 Dynamic Client Registration error response
193
185
*/
194
- export const OAuthClientRegistrationErrorSchema = z
195
- . object ( {
196
- error : z . string ( ) ,
197
- error_description : z . string ( ) . optional ( ) ,
198
- } )
199
- . strip ( ) ;
186
+ export const OAuthClientRegistrationErrorSchema = z . object ( {
187
+ error : z . string ( ) ,
188
+ error_description : z . string ( ) . optional ( ) ,
189
+ } ) . strip ( ) ;
200
190
201
191
/**
202
192
* RFC 7009 OAuth 2.0 Token Revocation request
203
193
*/
204
- export const OAuthTokenRevocationRequestSchema = z
205
- . object ( {
206
- token : z . string ( ) ,
207
- token_type_hint : z . string ( ) . optional ( ) ,
208
- } )
209
- . strip ( ) ;
194
+ export const OAuthTokenRevocationRequestSchema = z . object ( {
195
+ token : z . string ( ) ,
196
+ token_type_hint : z . string ( ) . optional ( ) ,
197
+ } ) . strip ( ) ;
210
198
211
199
export type OAuthMetadata = z . infer < typeof OAuthMetadataSchema > ;
212
200
export type OpenIdProviderMetadata = z . infer <
@@ -220,23 +208,11 @@ export type OpenIdProviderDiscoveryMetadata = z.infer<
220
208
export type OAuthTokens = z . infer < typeof OAuthTokensSchema > ;
221
209
export type OAuthErrorResponse = z . infer < typeof OAuthErrorResponseSchema > ;
222
210
export 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
- > ;
211
+ export type OAuthClientInformation = z . infer < typeof OAuthClientInformationSchema > ;
212
+ export type OAuthClientInformationFull = z . infer < typeof OAuthClientInformationFullSchema > ;
213
+ export type OAuthClientRegistrationError = z . infer < typeof OAuthClientRegistrationErrorSchema > ;
214
+ export type OAuthTokenRevocationRequest = z . infer < typeof OAuthTokenRevocationRequestSchema > ;
215
+ export type OAuthProtectedResourceMetadata = z . infer < typeof OAuthProtectedResourceMetadataSchema > ;
238
216
239
217
// Unified type for authorization server metadata
240
- export type AuthorizationServerMetadata =
241
- | OAuthMetadata
242
- | OpenIdProviderDiscoveryMetadata ;
218
+ export type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata ;
0 commit comments