@atproto/oauth-types 0.6.3 → 0.7.0

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.
Files changed (107) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/atproto-loopback-client-id.js +17 -21
  3. package/dist/atproto-loopback-client-id.js.map +1 -1
  4. package/dist/atproto-loopback-client-metadata.js +6 -10
  5. package/dist/atproto-loopback-client-metadata.js.map +1 -1
  6. package/dist/atproto-loopback-client-redirect-uris.js +1 -4
  7. package/dist/atproto-loopback-client-redirect-uris.js.map +1 -1
  8. package/dist/atproto-oauth-scope.js +11 -17
  9. package/dist/atproto-oauth-scope.js.map +1 -1
  10. package/dist/atproto-oauth-token-response.d.ts +3 -3
  11. package/dist/atproto-oauth-token-response.js +9 -12
  12. package/dist/atproto-oauth-token-response.js.map +1 -1
  13. package/dist/constants.js +1 -4
  14. package/dist/constants.js.map +1 -1
  15. package/dist/index.js +49 -65
  16. package/dist/index.js.map +1 -1
  17. package/dist/oauth-access-token.js +2 -5
  18. package/dist/oauth-access-token.js.map +1 -1
  19. package/dist/oauth-authorization-code-grant-token-request.js +7 -10
  20. package/dist/oauth-authorization-code-grant-token-request.js.map +1 -1
  21. package/dist/oauth-authorization-details.js +10 -13
  22. package/dist/oauth-authorization-details.js.map +1 -1
  23. package/dist/oauth-authorization-request-jar.js +4 -7
  24. package/dist/oauth-authorization-request-jar.js.map +1 -1
  25. package/dist/oauth-authorization-request-par.js +6 -9
  26. package/dist/oauth-authorization-request-par.js.map +1 -1
  27. package/dist/oauth-authorization-request-parameters.js +35 -38
  28. package/dist/oauth-authorization-request-parameters.js.map +1 -1
  29. package/dist/oauth-authorization-request-query.js +11 -14
  30. package/dist/oauth-authorization-request-query.js.map +1 -1
  31. package/dist/oauth-authorization-request-uri.js +4 -7
  32. package/dist/oauth-authorization-request-uri.js.map +1 -1
  33. package/dist/oauth-authorization-response-error.js +2 -5
  34. package/dist/oauth-authorization-response-error.js.map +1 -1
  35. package/dist/oauth-authorization-server-metadata.js +52 -55
  36. package/dist/oauth-authorization-server-metadata.js.map +1 -1
  37. package/dist/oauth-client-credentials-grant-token-request.js +3 -6
  38. package/dist/oauth-client-credentials-grant-token-request.js.map +1 -1
  39. package/dist/oauth-client-credentials.js +17 -20
  40. package/dist/oauth-client-credentials.js.map +1 -1
  41. package/dist/oauth-client-id-discoverable.js +26 -33
  42. package/dist/oauth-client-id-discoverable.js.map +1 -1
  43. package/dist/oauth-client-id-loopback.js +20 -29
  44. package/dist/oauth-client-id-loopback.js.map +1 -1
  45. package/dist/oauth-client-id.js +2 -5
  46. package/dist/oauth-client-id.js.map +1 -1
  47. package/dist/oauth-client-metadata.d.ts.map +1 -1
  48. package/dist/oauth-client-metadata.js +41 -44
  49. package/dist/oauth-client-metadata.js.map +1 -1
  50. package/dist/oauth-code-challenge-method.js +2 -5
  51. package/dist/oauth-code-challenge-method.js.map +1 -1
  52. package/dist/oauth-endpoint-auth-method.js +2 -5
  53. package/dist/oauth-endpoint-auth-method.js.map +1 -1
  54. package/dist/oauth-endpoint-name.js +1 -4
  55. package/dist/oauth-endpoint-name.js.map +1 -1
  56. package/dist/oauth-grant-type.js +2 -5
  57. package/dist/oauth-grant-type.js.map +1 -1
  58. package/dist/oauth-introspection-response.js +1 -2
  59. package/dist/oauth-issuer-identifier.js +7 -10
  60. package/dist/oauth-issuer-identifier.js.map +1 -1
  61. package/dist/oauth-par-response.js +4 -7
  62. package/dist/oauth-par-response.js.map +1 -1
  63. package/dist/oauth-password-grant-token-request.js +5 -8
  64. package/dist/oauth-password-grant-token-request.js.map +1 -1
  65. package/dist/oauth-prompt-mode.js +2 -5
  66. package/dist/oauth-prompt-mode.js.map +1 -1
  67. package/dist/oauth-protected-resource-metadata.js +14 -17
  68. package/dist/oauth-protected-resource-metadata.js.map +1 -1
  69. package/dist/oauth-redirect-uri.js +10 -13
  70. package/dist/oauth-redirect-uri.js.map +1 -1
  71. package/dist/oauth-refresh-token-grant-token-request.js +5 -8
  72. package/dist/oauth-refresh-token-grant-token-request.js.map +1 -1
  73. package/dist/oauth-refresh-token.js +2 -5
  74. package/dist/oauth-refresh-token.js.map +1 -1
  75. package/dist/oauth-request-uri.js +2 -5
  76. package/dist/oauth-request-uri.js.map +1 -1
  77. package/dist/oauth-response-mode.js +2 -5
  78. package/dist/oauth-response-mode.js.map +1 -1
  79. package/dist/oauth-response-type.js +2 -5
  80. package/dist/oauth-response-type.js.map +1 -1
  81. package/dist/oauth-scope.js +4 -8
  82. package/dist/oauth-scope.js.map +1 -1
  83. package/dist/oauth-token-identification.js +6 -9
  84. package/dist/oauth-token-identification.js.map +1 -1
  85. package/dist/oauth-token-request.js +10 -13
  86. package/dist/oauth-token-request.js.map +1 -1
  87. package/dist/oauth-token-response.js +12 -15
  88. package/dist/oauth-token-response.js.map +1 -1
  89. package/dist/oauth-token-type.js +4 -7
  90. package/dist/oauth-token-type.js.map +1 -1
  91. package/dist/oidc-authorization-error-response.js +2 -5
  92. package/dist/oidc-authorization-error-response.js.map +1 -1
  93. package/dist/oidc-claims-parameter.js +2 -5
  94. package/dist/oidc-claims-parameter.js.map +1 -1
  95. package/dist/oidc-claims-properties.js +5 -8
  96. package/dist/oidc-claims-properties.js.map +1 -1
  97. package/dist/oidc-entity-type.js +2 -5
  98. package/dist/oidc-entity-type.js.map +1 -1
  99. package/dist/oidc-userinfo.js +10 -13
  100. package/dist/oidc-userinfo.js.map +1 -1
  101. package/dist/uri.js +25 -28
  102. package/dist/uri.js.map +1 -1
  103. package/dist/util.js +12 -26
  104. package/dist/util.js.map +1 -1
  105. package/package.json +8 -7
  106. package/src/atproto-oauth-token-response.ts +1 -1
  107. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthAuthorizationRequestParSchema = void 0;
4
- const zod_1 = require("zod");
5
- const oauth_authorization_request_jar_js_1 = require("./oauth-authorization-request-jar.js");
6
- const oauth_authorization_request_parameters_js_1 = require("./oauth-authorization-request-parameters.js");
7
- exports.oauthAuthorizationRequestParSchema = zod_1.z.union([
8
- oauth_authorization_request_parameters_js_1.oauthAuthorizationRequestParametersSchema,
9
- oauth_authorization_request_jar_js_1.oauthAuthorizationRequestJarSchema,
1
+ import { z } from 'zod';
2
+ import { oauthAuthorizationRequestJarSchema } from './oauth-authorization-request-jar.js';
3
+ import { oauthAuthorizationRequestParametersSchema } from './oauth-authorization-request-parameters.js';
4
+ export const oauthAuthorizationRequestParSchema = z.union([
5
+ oauthAuthorizationRequestParametersSchema,
6
+ oauthAuthorizationRequestJarSchema,
10
7
  ]);
11
8
  //# sourceMappingURL=oauth-authorization-request-par.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-request-par.js","sourceRoot":"","sources":["../src/oauth-authorization-request-par.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,6FAAyF;AACzF,2GAAuG;AAE1F,QAAA,kCAAkC,GAAG,OAAC,CAAC,KAAK,CAAC;IACxD,qFAAyC;IACzC,uEAAkC;CACnC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthAuthorizationRequestJarSchema } from './oauth-authorization-request-jar.js'\nimport { oauthAuthorizationRequestParametersSchema } from './oauth-authorization-request-parameters.js'\n\nexport const oauthAuthorizationRequestParSchema = z.union([\n oauthAuthorizationRequestParametersSchema,\n oauthAuthorizationRequestJarSchema,\n])\n\nexport type OAuthAuthorizationRequestPar = z.infer<\n typeof oauthAuthorizationRequestParSchema\n>\n"]}
1
+ {"version":3,"file":"oauth-authorization-request-par.js","sourceRoot":"","sources":["../src/oauth-authorization-request-par.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AACzF,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAA;AAEvG,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC;IACxD,yCAAyC;IACzC,kCAAkC;CACnC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthAuthorizationRequestJarSchema } from './oauth-authorization-request-jar.js'\nimport { oauthAuthorizationRequestParametersSchema } from './oauth-authorization-request-parameters.js'\n\nexport const oauthAuthorizationRequestParSchema = z.union([\n oauthAuthorizationRequestParametersSchema,\n oauthAuthorizationRequestJarSchema,\n])\n\nexport type OAuthAuthorizationRequestPar = z.infer<\n typeof oauthAuthorizationRequestParSchema\n>\n"]}
@@ -1,43 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthAuthorizationRequestParametersSchema = void 0;
4
- const zod_1 = require("zod");
5
- const jwk_1 = require("@atproto/jwk");
6
- const oauth_authorization_details_js_1 = require("./oauth-authorization-details.js");
7
- const oauth_client_id_js_1 = require("./oauth-client-id.js");
8
- const oauth_code_challenge_method_js_1 = require("./oauth-code-challenge-method.js");
9
- const oauth_prompt_mode_js_1 = require("./oauth-prompt-mode.js");
10
- const oauth_redirect_uri_js_1 = require("./oauth-redirect-uri.js");
11
- const oauth_response_mode_js_1 = require("./oauth-response-mode.js");
12
- const oauth_response_type_js_1 = require("./oauth-response-type.js");
13
- const oauth_scope_js_1 = require("./oauth-scope.js");
14
- const oidc_claims_parameter_js_1 = require("./oidc-claims-parameter.js");
15
- const oidc_claims_properties_js_1 = require("./oidc-claims-properties.js");
16
- const oidc_entity_type_js_1 = require("./oidc-entity-type.js");
17
- const util_js_1 = require("./util.js");
1
+ import { z } from 'zod';
2
+ import { signedJwtSchema } from '@atproto/jwk';
3
+ import { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js';
4
+ import { oauthClientIdSchema } from './oauth-client-id.js';
5
+ import { oauthCodeChallengeMethodSchema } from './oauth-code-challenge-method.js';
6
+ import { oauthPromptModeSchema } from './oauth-prompt-mode.js';
7
+ import { oauthRedirectUriSchema } from './oauth-redirect-uri.js';
8
+ import { oauthResponseModeSchema } from './oauth-response-mode.js';
9
+ import { oauthResponseTypeSchema } from './oauth-response-type.js';
10
+ import { oauthScopeSchema } from './oauth-scope.js';
11
+ import { oidcClaimsParameterSchema } from './oidc-claims-parameter.js';
12
+ import { oidcClaimsPropertiesSchema } from './oidc-claims-properties.js';
13
+ import { oidcEntityTypeSchema } from './oidc-entity-type.js';
14
+ import { jsonObjectPreprocess, numberPreprocess } from './util.js';
18
15
  /**
19
16
  * @note non string parameters will be converted from their string
20
17
  * representation since oauth request parameters are typically sent as URL
21
18
  * encoded form data or URL encoded query string.
22
19
  * @see {@link https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest | OIDC}
23
20
  */
24
- exports.oauthAuthorizationRequestParametersSchema = zod_1.z.object({
25
- client_id: oauth_client_id_js_1.oauthClientIdSchema,
26
- state: zod_1.z.string().optional(),
27
- redirect_uri: oauth_redirect_uri_js_1.oauthRedirectUriSchema.optional(),
28
- scope: oauth_scope_js_1.oauthScopeSchema.optional(),
29
- response_type: oauth_response_type_js_1.oauthResponseTypeSchema,
21
+ export const oauthAuthorizationRequestParametersSchema = z.object({
22
+ client_id: oauthClientIdSchema,
23
+ state: z.string().optional(),
24
+ redirect_uri: oauthRedirectUriSchema.optional(),
25
+ scope: oauthScopeSchema.optional(),
26
+ response_type: oauthResponseTypeSchema,
30
27
  // PKCE
31
28
  // https://datatracker.ietf.org/doc/html/rfc7636#section-4.3
32
- code_challenge: zod_1.z.string().optional(),
33
- code_challenge_method: oauth_code_challenge_method_js_1.oauthCodeChallengeMethodSchema.optional(),
29
+ code_challenge: z.string().optional(),
30
+ code_challenge_method: oauthCodeChallengeMethodSchema.optional(),
34
31
  // DPOP
35
32
  // https://datatracker.ietf.org/doc/html/rfc9449#section-12.3
36
- dpop_jkt: zod_1.z.string().optional(),
33
+ dpop_jkt: z.string().optional(),
37
34
  // OIDC
38
35
  // Default depend on response_type
39
- response_mode: oauth_response_mode_js_1.oauthResponseModeSchema.optional(),
40
- nonce: zod_1.z.string().optional(),
36
+ response_mode: oauthResponseModeSchema.optional(),
37
+ nonce: z.string().optional(),
41
38
  // Specifies the allowable elapsed time in seconds since the last time the
42
39
  // End-User was actively authenticated by the OP. If the elapsed time is
43
40
  // greater than this value, the OP MUST attempt to actively re-authenticate
@@ -45,27 +42,27 @@ exports.oauthAuthorizationRequestParametersSchema = zod_1.z.object({
45
42
  // PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used,
46
43
  // the ID Token returned MUST include an auth_time Claim Value. Note that
47
44
  // max_age=0 is equivalent to prompt=login.
48
- max_age: zod_1.z.preprocess(util_js_1.numberPreprocess, zod_1.z.number().int().min(0)).optional(),
49
- claims: zod_1.z
50
- .preprocess(util_js_1.jsonObjectPreprocess, zod_1.z.record(oidc_entity_type_js_1.oidcEntityTypeSchema, zod_1.z.record(oidc_claims_parameter_js_1.oidcClaimsParameterSchema, zod_1.z.union([zod_1.z.literal(null), oidc_claims_properties_js_1.oidcClaimsPropertiesSchema]))))
45
+ max_age: z.preprocess(numberPreprocess, z.number().int().min(0)).optional(),
46
+ claims: z
47
+ .preprocess(jsonObjectPreprocess, z.record(oidcEntityTypeSchema, z.record(oidcClaimsParameterSchema, z.union([z.literal(null), oidcClaimsPropertiesSchema]))))
51
48
  .optional(),
52
49
  // https://openid.net/specs/openid-connect-core-1_0.html#RegistrationParameter
53
50
  // Not supported by this library (yet?)
54
51
  // registration: clientMetadataSchema.optional(),
55
- login_hint: zod_1.z.string().min(1).optional(),
56
- ui_locales: zod_1.z
52
+ login_hint: z.string().min(1).optional(),
53
+ ui_locales: z
57
54
  .string()
58
55
  .regex(/^[a-z]{2,3}(-[A-Z]{2})?( [a-z]{2,3}(-[A-Z]{2})?)*$/) // fr-CA fr en
59
56
  .optional(),
60
57
  // Previous ID Token, should be provided when prompt=none is used
61
- id_token_hint: jwk_1.signedJwtSchema.optional(),
58
+ id_token_hint: signedJwtSchema.optional(),
62
59
  // Type of UI the AS is displayed on
63
- display: zod_1.z.enum(['page', 'popup', 'touch', 'wap']).optional(),
60
+ display: z.enum(['page', 'popup', 'touch', 'wap']).optional(),
64
61
  // How the AS should prompt the user for authorization:
65
- prompt: oauth_prompt_mode_js_1.oauthPromptModeSchema.optional(),
62
+ prompt: oauthPromptModeSchema.optional(),
66
63
  // https://datatracker.ietf.org/doc/html/rfc9396
67
- authorization_details: zod_1.z
68
- .preprocess(util_js_1.jsonObjectPreprocess, oauth_authorization_details_js_1.oauthAuthorizationDetailsSchema)
64
+ authorization_details: z
65
+ .preprocess(jsonObjectPreprocess, oauthAuthorizationDetailsSchema)
69
66
  .optional(),
70
67
  });
71
68
  //# sourceMappingURL=oauth-authorization-request-parameters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-request-parameters.js","sourceRoot":"","sources":["../src/oauth-authorization-request-parameters.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,sCAA8C;AAC9C,qFAAkF;AAClF,6DAA0D;AAC1D,qFAAiF;AACjF,iEAA8D;AAC9D,mEAAgE;AAChE,qEAAkE;AAClE,qEAAkE;AAClE,qDAAmD;AACnD,yEAAsE;AACtE,2EAAwE;AACxE,+DAA4D;AAC5D,uCAAkE;AAElE;;;;;GAKG;AACU,QAAA,yCAAyC,GAAG,OAAC,CAAC,MAAM,CAAC;IAChE,SAAS,EAAE,wCAAmB;IAC9B,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,8CAAsB,CAAC,QAAQ,EAAE;IAC/C,KAAK,EAAE,iCAAgB,CAAC,QAAQ,EAAE;IAClC,aAAa,EAAE,gDAAuB;IAEtC,OAAO;IAEP,4DAA4D;IAC5D,cAAc,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,qBAAqB,EAAE,+DAA8B,CAAC,QAAQ,EAAE;IAEhE,OAAO;IAEP,6DAA6D;IAC7D,QAAQ,EAAE,OAA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C;SACrB,UAAU,CAAC,8BAAoB,EAAE,gEAA+B,CAAC;SACjE,QAAQ,EAAE;CACd,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { signedJwtSchema } from '@atproto/jwk'\nimport { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\nimport { oauthCodeChallengeMethodSchema } from './oauth-code-challenge-method.js'\nimport { oauthPromptModeSchema } from './oauth-prompt-mode.js'\nimport { oauthRedirectUriSchema } from './oauth-redirect-uri.js'\nimport { oauthResponseModeSchema } from './oauth-response-mode.js'\nimport { oauthResponseTypeSchema } from './oauth-response-type.js'\nimport { oauthScopeSchema } from './oauth-scope.js'\nimport { oidcClaimsParameterSchema } from './oidc-claims-parameter.js'\nimport { oidcClaimsPropertiesSchema } from './oidc-claims-properties.js'\nimport { oidcEntityTypeSchema } from './oidc-entity-type.js'\nimport { jsonObjectPreprocess, numberPreprocess } from './util.js'\n\n/**\n * @note non string parameters will be converted from their string\n * representation since oauth request parameters are typically sent as URL\n * encoded form data or URL encoded query string.\n * @see {@link https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest | OIDC}\n */\nexport const oauthAuthorizationRequestParametersSchema = z.object({\n client_id: oauthClientIdSchema,\n state: z.string().optional(),\n redirect_uri: oauthRedirectUriSchema.optional(),\n scope: oauthScopeSchema.optional(),\n response_type: oauthResponseTypeSchema,\n\n // PKCE\n\n // https://datatracker.ietf.org/doc/html/rfc7636#section-4.3\n code_challenge: z.string().optional(),\n code_challenge_method: oauthCodeChallengeMethodSchema.optional(),\n\n // DPOP\n\n // https://datatracker.ietf.org/doc/html/rfc9449#section-12.3\n dpop_jkt: z.string().optional(),\n\n // OIDC\n\n // Default depend on response_type\n response_mode: oauthResponseModeSchema.optional(),\n\n nonce: z.string().optional(),\n\n // Specifies the allowable elapsed time in seconds since the last time the\n // End-User was actively authenticated by the OP. If the elapsed time is\n // greater than this value, the OP MUST attempt to actively re-authenticate\n // the End-User. (The max_age request parameter corresponds to the OpenID 2.0\n // PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used,\n // the ID Token returned MUST include an auth_time Claim Value. Note that\n // max_age=0 is equivalent to prompt=login.\n max_age: z.preprocess(numberPreprocess, z.number().int().min(0)).optional(),\n\n claims: z\n .preprocess(\n jsonObjectPreprocess,\n z.record(\n oidcEntityTypeSchema,\n z.record(\n oidcClaimsParameterSchema,\n z.union([z.literal(null), oidcClaimsPropertiesSchema]),\n ),\n ),\n )\n .optional(),\n\n // https://openid.net/specs/openid-connect-core-1_0.html#RegistrationParameter\n // Not supported by this library (yet?)\n // registration: clientMetadataSchema.optional(),\n\n login_hint: z.string().min(1).optional(),\n\n ui_locales: z\n .string()\n .regex(/^[a-z]{2,3}(-[A-Z]{2})?( [a-z]{2,3}(-[A-Z]{2})?)*$/) // fr-CA fr en\n .optional(),\n\n // Previous ID Token, should be provided when prompt=none is used\n id_token_hint: signedJwtSchema.optional(),\n\n // Type of UI the AS is displayed on\n display: z.enum(['page', 'popup', 'touch', 'wap']).optional(),\n\n // How the AS should prompt the user for authorization:\n prompt: oauthPromptModeSchema.optional(),\n\n // https://datatracker.ietf.org/doc/html/rfc9396\n authorization_details: z\n .preprocess(jsonObjectPreprocess, oauthAuthorizationDetailsSchema)\n .optional(),\n})\n\n/**\n * @see {oauthAuthorizationRequestParametersSchema}\n */\nexport type OAuthAuthorizationRequestParameters = z.infer<\n typeof oauthAuthorizationRequestParametersSchema\n>\n"]}
1
+ {"version":3,"file":"oauth-authorization-request-parameters.js","sourceRoot":"","sources":["../src/oauth-authorization-request-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAA;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,E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C3E,6EAA6E;IAC7E,4EAA4E;IAC5E,yEAAyE;IACzE,2CAA2C;IAC3C,OAAO,EAAE,CAAC,CAAC,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAE3E,MAAM,EAAE,CAAC;SACN,UAAU,CACT,oBAAoB,EACpB,CAAC,CAAC,MAAM,CACN,oBAAoB,EACpB,CAAC,CAAC,MAAM,CACN,yBAAyB,EACzB,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,0BAA0B,CAAC,CAAC,CACvD,CACF,CACF;SACA,QAAQ,EAAE;IAEb,8EAA8E;IAC9E,uCAAuC;IACvC,iDAAiD;IAEjD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAExC,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,KAAK,CAAC,oDAAoD,CAAC,CAAC,cAAc;SAC1E,QAAQ,EAAE;IAEb,iEAAiE;IACjE,aAAa,EAAE,eAAe,CAAC,QAAQ,EAAE;IAEzC,oCAAoC;IACpC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE;IAE7D,uDAAuD;IACvD,MAAM,EAAE,qBAAqB,CAAC,QAAQ,EAAE;IAExC,gDAAgD;IAChD,qBAAqB,EAAE,CAAC;SACrB,UAAU,CAAC,oBAAoB,EAAE,+BAA+B,CAAC;SACjE,QAAQ,EAAE;CACd,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { signedJwtSchema } from '@atproto/jwk'\nimport { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\nimport { oauthCodeChallengeMethodSchema } from './oauth-code-challenge-method.js'\nimport { oauthPromptModeSchema } from './oauth-prompt-mode.js'\nimport { oauthRedirectUriSchema } from './oauth-redirect-uri.js'\nimport { oauthResponseModeSchema } from './oauth-response-mode.js'\nimport { oauthResponseTypeSchema } from './oauth-response-type.js'\nimport { oauthScopeSchema } from './oauth-scope.js'\nimport { oidcClaimsParameterSchema } from './oidc-claims-parameter.js'\nimport { oidcClaimsPropertiesSchema } from './oidc-claims-properties.js'\nimport { oidcEntityTypeSchema } from './oidc-entity-type.js'\nimport { jsonObjectPreprocess, numberPreprocess } from './util.js'\n\n/**\n * @note non string parameters will be converted from their string\n * representation since oauth request parameters are typically sent as URL\n * encoded form data or URL encoded query string.\n * @see {@link https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest | OIDC}\n */\nexport const oauthAuthorizationRequestParametersSchema = z.object({\n client_id: oauthClientIdSchema,\n state: z.string().optional(),\n redirect_uri: oauthRedirectUriSchema.optional(),\n scope: oauthScopeSchema.optional(),\n response_type: oauthResponseTypeSchema,\n\n // PKCE\n\n // https://datatracker.ietf.org/doc/html/rfc7636#section-4.3\n code_challenge: z.string().optional(),\n code_challenge_method: oauthCodeChallengeMethodSchema.optional(),\n\n // DPOP\n\n // https://datatracker.ietf.org/doc/html/rfc9449#section-12.3\n dpop_jkt: z.string().optional(),\n\n // OIDC\n\n // Default depend on response_type\n response_mode: oauthResponseModeSchema.optional(),\n\n nonce: z.string().optional(),\n\n // Specifies the allowable elapsed time in seconds since the last time the\n // End-User was actively authenticated by the OP. If the elapsed time is\n // greater than this value, the OP MUST attempt to actively re-authenticate\n // the End-User. (The max_age request parameter corresponds to the OpenID 2.0\n // PAPE [OpenID.PAPE] max_auth_age request parameter.) When max_age is used,\n // the ID Token returned MUST include an auth_time Claim Value. Note that\n // max_age=0 is equivalent to prompt=login.\n max_age: z.preprocess(numberPreprocess, z.number().int().min(0)).optional(),\n\n claims: z\n .preprocess(\n jsonObjectPreprocess,\n z.record(\n oidcEntityTypeSchema,\n z.record(\n oidcClaimsParameterSchema,\n z.union([z.literal(null), oidcClaimsPropertiesSchema]),\n ),\n ),\n )\n .optional(),\n\n // https://openid.net/specs/openid-connect-core-1_0.html#RegistrationParameter\n // Not supported by this library (yet?)\n // registration: clientMetadataSchema.optional(),\n\n login_hint: z.string().min(1).optional(),\n\n ui_locales: z\n .string()\n .regex(/^[a-z]{2,3}(-[A-Z]{2})?( [a-z]{2,3}(-[A-Z]{2})?)*$/) // fr-CA fr en\n .optional(),\n\n // Previous ID Token, should be provided when prompt=none is used\n id_token_hint: signedJwtSchema.optional(),\n\n // Type of UI the AS is displayed on\n display: z.enum(['page', 'popup', 'touch', 'wap']).optional(),\n\n // How the AS should prompt the user for authorization:\n prompt: oauthPromptModeSchema.optional(),\n\n // https://datatracker.ietf.org/doc/html/rfc9396\n authorization_details: z\n .preprocess(jsonObjectPreprocess, oauthAuthorizationDetailsSchema)\n .optional(),\n})\n\n/**\n * @see {oauthAuthorizationRequestParametersSchema}\n */\nexport type OAuthAuthorizationRequestParameters = z.infer<\n typeof oauthAuthorizationRequestParametersSchema\n>\n"]}
@@ -1,17 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthAuthorizationRequestQuerySchema = void 0;
4
- const zod_1 = require("zod");
5
- const oauth_authorization_request_jar_js_1 = require("./oauth-authorization-request-jar.js");
6
- const oauth_authorization_request_parameters_js_1 = require("./oauth-authorization-request-parameters.js");
7
- const oauth_authorization_request_uri_js_1 = require("./oauth-authorization-request-uri.js");
8
- const oauth_client_id_js_1 = require("./oauth-client-id.js");
9
- exports.oauthAuthorizationRequestQuerySchema = zod_1.z.intersection(zod_1.z.object({
1
+ import { z } from 'zod';
2
+ import { oauthAuthorizationRequestJarSchema } from './oauth-authorization-request-jar.js';
3
+ import { oauthAuthorizationRequestParametersSchema } from './oauth-authorization-request-parameters.js';
4
+ import { oauthAuthorizationRequestUriSchema } from './oauth-authorization-request-uri.js';
5
+ import { oauthClientIdSchema } from './oauth-client-id.js';
6
+ export const oauthAuthorizationRequestQuerySchema = z.intersection(z.object({
10
7
  // REQUIRED. OAuth 2.0 [RFC6749] client_id.
11
- client_id: oauth_client_id_js_1.oauthClientIdSchema,
12
- }), zod_1.z.union([
13
- oauth_authorization_request_parameters_js_1.oauthAuthorizationRequestParametersSchema,
14
- oauth_authorization_request_jar_js_1.oauthAuthorizationRequestJarSchema,
15
- oauth_authorization_request_uri_js_1.oauthAuthorizationRequestUriSchema,
8
+ client_id: oauthClientIdSchema,
9
+ }), z.union([
10
+ oauthAuthorizationRequestParametersSchema,
11
+ oauthAuthorizationRequestJarSchema,
12
+ oauthAuthorizationRequestUriSchema,
16
13
  ]));
17
14
  //# sourceMappingURL=oauth-authorization-request-query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-request-query.js","sourceRoot":"","sources":["../src/oauth-authorization-request-query.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,6FAAyF;AACzF,2GAAuG;AACvG,6FAAyF;AACzF,6DAA0D;AAE7C,QAAA,oCAAoC,GAAG,OAAC,CAAC,YAAY,CAChE,OAAC,CAAC,MAAM,CAAC;IACP,2CAA2C;IAC3C,SAAS,EAAE,wCAAmB;CAC/B,CAAC,EACF,OAAC,CAAC,KAAK,CAAC;IACN,qFAAyC;IACzC,uEAAkC;IAClC,uEAAkC;CACnC,CAAC,CACH,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthAuthorizationRequestJarSchema } from './oauth-authorization-request-jar.js'\nimport { oauthAuthorizationRequestParametersSchema } from './oauth-authorization-request-parameters.js'\nimport { oauthAuthorizationRequestUriSchema } from './oauth-authorization-request-uri.js'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\n\nexport const oauthAuthorizationRequestQuerySchema = z.intersection(\n z.object({\n // REQUIRED. OAuth 2.0 [RFC6749] client_id.\n client_id: oauthClientIdSchema,\n }),\n z.union([\n oauthAuthorizationRequestParametersSchema,\n oauthAuthorizationRequestJarSchema,\n oauthAuthorizationRequestUriSchema,\n ]),\n)\n\nexport type OAuthAuthorizationRequestQuery = z.infer<\n typeof oauthAuthorizationRequestQuerySchema\n>\n"]}
1
+ {"version":3,"file":"oauth-authorization-request-query.js","sourceRoot":"","sources":["../src/oauth-authorization-request-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AACzF,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAA;AACvG,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,YAAY,CAChE,CAAC,CAAC,MAAM,CAAC;IACP,2CAA2C;IAC3C,SAAS,EAAE,mBAAmB;CAC/B,CAAC,EACF,CAAC,CAAC,KAAK,CAAC;IACN,yCAAyC;IACzC,kCAAkC;IAClC,kCAAkC;CACnC,CAAC,CACH,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthAuthorizationRequestJarSchema } from './oauth-authorization-request-jar.js'\nimport { oauthAuthorizationRequestParametersSchema } from './oauth-authorization-request-parameters.js'\nimport { oauthAuthorizationRequestUriSchema } from './oauth-authorization-request-uri.js'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\n\nexport const oauthAuthorizationRequestQuerySchema = z.intersection(\n z.object({\n // REQUIRED. OAuth 2.0 [RFC6749] client_id.\n client_id: oauthClientIdSchema,\n }),\n z.union([\n oauthAuthorizationRequestParametersSchema,\n oauthAuthorizationRequestJarSchema,\n oauthAuthorizationRequestUriSchema,\n ]),\n)\n\nexport type OAuthAuthorizationRequestQuery = z.infer<\n typeof oauthAuthorizationRequestQuerySchema\n>\n"]}
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthAuthorizationRequestUriSchema = void 0;
4
- const zod_1 = require("zod");
5
- const oauth_request_uri_js_1 = require("./oauth-request-uri.js");
6
- exports.oauthAuthorizationRequestUriSchema = zod_1.z.object({
7
- request_uri: oauth_request_uri_js_1.oauthRequestUriSchema,
1
+ import { z } from 'zod';
2
+ import { oauthRequestUriSchema } from './oauth-request-uri.js';
3
+ export const oauthAuthorizationRequestUriSchema = z.object({
4
+ request_uri: oauthRequestUriSchema,
8
5
  });
9
6
  //# sourceMappingURL=oauth-authorization-request-uri.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-request-uri.js","sourceRoot":"","sources":["../src/oauth-authorization-request-uri.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,iEAA8D;AAEjD,QAAA,kCAAkC,GAAG,OAAC,CAAC,MAAM,CAAC;IACzD,WAAW,EAAE,4CAAqB;CACnC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthRequestUriSchema } from './oauth-request-uri.js'\n\nexport const oauthAuthorizationRequestUriSchema = z.object({\n request_uri: oauthRequestUriSchema,\n})\n\nexport type OAuthAuthorizationRequestUri = z.infer<\n typeof oauthAuthorizationRequestUriSchema\n>\n"]}
1
+ {"version":3,"file":"oauth-authorization-request-uri.js","sourceRoot":"","sources":["../src/oauth-authorization-request-uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD,WAAW,EAAE,qBAAqB;CACnC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthRequestUriSchema } from './oauth-request-uri.js'\n\nexport const oauthAuthorizationRequestUriSchema = z.object({\n request_uri: oauthRequestUriSchema,\n})\n\nexport type OAuthAuthorizationRequestUri = z.infer<\n typeof oauthAuthorizationRequestUriSchema\n>\n"]}
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthAuthorizationResponseErrorSchema = void 0;
4
- const zod_1 = require("zod");
1
+ import { z } from 'zod';
5
2
  /**
6
3
  * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#name-error-response-2}
7
4
  */
8
- exports.oauthAuthorizationResponseErrorSchema = zod_1.z.enum([
5
+ export const oauthAuthorizationResponseErrorSchema = z.enum([
9
6
  // The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.
10
7
  'invalid_request',
11
8
  // The client is not authorized to request an authorization code using this method.
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-response-error.js","sourceRoot":"","sources":["../src/oauth-authorization-response-error.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEvB;;GAEG;AACU,QAAA,qCAAqC,GAAG,OAAC,CAAC,IAAI,CAAC;IAC1D,oJAAoJ;IACpJ,iBAAiB;IACjB,mFAAmF;IACnF,qBAAqB;IACrB,iEAAiE;IACjE,eAAe;IACf,+FAA+F;IAC/F,2BAA2B;IAC3B,yDAAyD;IACzD,eAAe;IACf,sPAAsP;IACtP,cAAc;IACd,wQAAwQ;IACxQ,yBAAyB;CAC1B,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\n/**\n * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#name-error-response-2}\n */\nexport const oauthAuthorizationResponseErrorSchema = z.enum([\n // The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.\n 'invalid_request',\n // The client is not authorized to request an authorization code using this method.\n 'unauthorized_client',\n // The resource owner or authorization server denied the request.\n 'access_denied',\n // The authorization server does not support obtaining an authorization code using this method.\n 'unsupported_response_type',\n // The requested scope is invalid, unknown, or malformed.\n 'invalid_scope',\n // The authorization server encountered an unexpected condition that prevented it from fulfilling the request. (This error code is needed because a 500 Internal Server Error HTTP status code cannot be returned to the client via an HTTP redirect.)\n 'server_error',\n // The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server. (This error code is needed because a 503 Service Unavailable HTTP status code cannot be returned to the client via an HTTP redirect.)\n 'temporarily_unavailable',\n])\n\nexport type OAuthAuthorizationResponseError = z.infer<\n typeof oauthAuthorizationResponseErrorSchema\n>\n"]}
1
+ {"version":3,"file":"oauth-authorization-response-error.js","sourceRoot":"","sources":["../src/oauth-authorization-response-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1D,oJAAoJ;IACpJ,iBAAiB;IACjB,mFAAmF;IACnF,qBAAqB;IACrB,iEAAiE;IACjE,eAAe;IACf,+FAA+F;IAC/F,2BAA2B;IAC3B,yDAAyD;IACzD,eAAe;IACf,sPAAsP;IACtP,cAAc;IACd,wQAAwQ;IACxQ,yBAAyB;CAC1B,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\n/**\n * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-12#name-error-response-2}\n */\nexport const oauthAuthorizationResponseErrorSchema = z.enum([\n // The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed.\n 'invalid_request',\n // The client is not authorized to request an authorization code using this method.\n 'unauthorized_client',\n // The resource owner or authorization server denied the request.\n 'access_denied',\n // The authorization server does not support obtaining an authorization code using this method.\n 'unsupported_response_type',\n // The requested scope is invalid, unknown, or malformed.\n 'invalid_scope',\n // The authorization server encountered an unexpected condition that prevented it from fulfilling the request. (This error code is needed because a 500 Internal Server Error HTTP status code cannot be returned to the client via an HTTP redirect.)\n 'server_error',\n // The authorization server is currently unable to handle the request due to a temporary overloading or maintenance of the server. (This error code is needed because a 503 Service Unavailable HTTP status code cannot be returned to the client via an HTTP redirect.)\n 'temporarily_unavailable',\n])\n\nexport type OAuthAuthorizationResponseError = z.infer<\n typeof oauthAuthorizationResponseErrorSchema\n>\n"]}
@@ -1,79 +1,76 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthAuthorizationServerMetadataValidator = exports.oauthAuthorizationServerMetadataSchema = void 0;
4
- const zod_1 = require("zod");
5
- const oauth_code_challenge_method_js_1 = require("./oauth-code-challenge-method.js");
6
- const oauth_issuer_identifier_js_1 = require("./oauth-issuer-identifier.js");
7
- const oauth_prompt_mode_js_1 = require("./oauth-prompt-mode.js");
8
- const uri_js_1 = require("./uri.js");
1
+ import { z } from 'zod';
2
+ import { oauthCodeChallengeMethodSchema } from './oauth-code-challenge-method.js';
3
+ import { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js';
4
+ import { oauthPromptModeSchema } from './oauth-prompt-mode.js';
5
+ import { webUriSchema } from './uri.js';
9
6
  /**
10
7
  * @see {@link https://datatracker.ietf.org/doc/html/rfc8414}
11
8
  * @note we do not enforce https: scheme in URIs to support development
12
9
  * environments. Make sure to validate the URIs before using it in a production
13
10
  * environment.
14
11
  */
15
- exports.oauthAuthorizationServerMetadataSchema = zod_1.z.object({
16
- issuer: oauth_issuer_identifier_js_1.oauthIssuerIdentifierSchema,
17
- claims_supported: zod_1.z.array(zod_1.z.string()).optional(),
18
- claims_locales_supported: zod_1.z.array(zod_1.z.string()).optional(),
19
- claims_parameter_supported: zod_1.z.boolean().optional(),
20
- request_parameter_supported: zod_1.z.boolean().optional(),
21
- request_uri_parameter_supported: zod_1.z.boolean().optional(),
22
- require_request_uri_registration: zod_1.z.boolean().optional(),
23
- scopes_supported: zod_1.z.array(zod_1.z.string()).optional(),
24
- subject_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
25
- response_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
26
- response_modes_supported: zod_1.z.array(zod_1.z.string()).optional(),
27
- grant_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
28
- code_challenge_methods_supported: zod_1.z
29
- .array(oauth_code_challenge_method_js_1.oauthCodeChallengeMethodSchema)
12
+ export const oauthAuthorizationServerMetadataSchema = z.object({
13
+ issuer: oauthIssuerIdentifierSchema,
14
+ claims_supported: z.array(z.string()).optional(),
15
+ claims_locales_supported: z.array(z.string()).optional(),
16
+ claims_parameter_supported: z.boolean().optional(),
17
+ request_parameter_supported: z.boolean().optional(),
18
+ request_uri_parameter_supported: z.boolean().optional(),
19
+ require_request_uri_registration: z.boolean().optional(),
20
+ scopes_supported: z.array(z.string()).optional(),
21
+ subject_types_supported: z.array(z.string()).optional(),
22
+ response_types_supported: z.array(z.string()).optional(),
23
+ response_modes_supported: z.array(z.string()).optional(),
24
+ grant_types_supported: z.array(z.string()).optional(),
25
+ code_challenge_methods_supported: z
26
+ .array(oauthCodeChallengeMethodSchema)
30
27
  .min(1)
31
28
  .optional(),
32
- ui_locales_supported: zod_1.z.array(zod_1.z.string()).optional(),
33
- id_token_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
34
- display_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
35
- request_object_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
36
- authorization_response_iss_parameter_supported: zod_1.z.boolean().optional(),
37
- authorization_details_types_supported: zod_1.z.array(zod_1.z.string()).optional(),
38
- request_object_encryption_alg_values_supported: zod_1.z
39
- .array(zod_1.z.string())
29
+ ui_locales_supported: z.array(z.string()).optional(),
30
+ id_token_signing_alg_values_supported: z.array(z.string()).optional(),
31
+ display_values_supported: z.array(z.string()).optional(),
32
+ request_object_signing_alg_values_supported: z.array(z.string()).optional(),
33
+ authorization_response_iss_parameter_supported: z.boolean().optional(),
34
+ authorization_details_types_supported: z.array(z.string()).optional(),
35
+ request_object_encryption_alg_values_supported: z
36
+ .array(z.string())
40
37
  .optional(),
41
- request_object_encryption_enc_values_supported: zod_1.z
42
- .array(zod_1.z.string())
38
+ request_object_encryption_enc_values_supported: z
39
+ .array(z.string())
43
40
  .optional(),
44
- jwks_uri: uri_js_1.webUriSchema.optional(),
45
- authorization_endpoint: uri_js_1.webUriSchema, // .optional(),
46
- token_endpoint: uri_js_1.webUriSchema, // .optional(),
41
+ jwks_uri: webUriSchema.optional(),
42
+ authorization_endpoint: webUriSchema, // .optional(),
43
+ token_endpoint: webUriSchema, // .optional(),
47
44
  // https://www.rfc-editor.org/rfc/rfc8414.html#section-2
48
- token_endpoint_auth_methods_supported: zod_1.z
49
- .array(zod_1.z.string())
45
+ token_endpoint_auth_methods_supported: z
46
+ .array(z.string())
50
47
  // > If omitted, the default is "client_secret_basic" [...].
51
48
  .default(['client_secret_basic']),
52
- token_endpoint_auth_signing_alg_values_supported: zod_1.z
53
- .array(zod_1.z.string())
49
+ token_endpoint_auth_signing_alg_values_supported: z
50
+ .array(z.string())
54
51
  .optional(),
55
- revocation_endpoint: uri_js_1.webUriSchema.optional(),
56
- introspection_endpoint: uri_js_1.webUriSchema.optional(),
57
- pushed_authorization_request_endpoint: uri_js_1.webUriSchema.optional(),
58
- require_pushed_authorization_requests: zod_1.z.boolean().optional(),
59
- userinfo_endpoint: uri_js_1.webUriSchema.optional(),
60
- end_session_endpoint: uri_js_1.webUriSchema.optional(),
61
- registration_endpoint: uri_js_1.webUriSchema.optional(),
52
+ revocation_endpoint: webUriSchema.optional(),
53
+ introspection_endpoint: webUriSchema.optional(),
54
+ pushed_authorization_request_endpoint: webUriSchema.optional(),
55
+ require_pushed_authorization_requests: z.boolean().optional(),
56
+ userinfo_endpoint: webUriSchema.optional(),
57
+ end_session_endpoint: webUriSchema.optional(),
58
+ registration_endpoint: webUriSchema.optional(),
62
59
  // https://datatracker.ietf.org/doc/html/rfc9449#section-5.1
63
- dpop_signing_alg_values_supported: zod_1.z.array(zod_1.z.string()).optional(),
60
+ dpop_signing_alg_values_supported: z.array(z.string()).optional(),
64
61
  // https://www.rfc-editor.org/rfc/rfc9728.html#section-4
65
- protected_resources: zod_1.z.array(uri_js_1.webUriSchema).optional(),
62
+ protected_resources: z.array(webUriSchema).optional(),
66
63
  // https://www.ietf.org/archive/id/draft-ietf-oauth-client-id-metadata-document-00.html
67
- client_id_metadata_document_supported: zod_1.z.boolean().optional(),
64
+ client_id_metadata_document_supported: z.boolean().optional(),
68
65
  // https://openid.net/specs/openid-connect-prompt-create-1_0.html#section-4.2
69
- prompt_values_supported: zod_1.z.array(oauth_prompt_mode_js_1.oauthPromptModeSchema).optional(),
66
+ prompt_values_supported: z.array(oauthPromptModeSchema).optional(),
70
67
  });
71
- exports.oauthAuthorizationServerMetadataValidator = exports.oauthAuthorizationServerMetadataSchema
68
+ export const oauthAuthorizationServerMetadataValidator = oauthAuthorizationServerMetadataSchema
72
69
  .superRefine((data, ctx) => {
73
70
  if (data.require_pushed_authorization_requests &&
74
71
  !data.pushed_authorization_request_endpoint) {
75
72
  ctx.addIssue({
76
- code: zod_1.z.ZodIssueCode.custom,
73
+ code: z.ZodIssueCode.custom,
77
74
  message: '"pushed_authorization_request_endpoint" required when "require_pushed_authorization_requests" is true',
78
75
  });
79
76
  }
@@ -82,7 +79,7 @@ exports.oauthAuthorizationServerMetadataValidator = exports.oauthAuthorizationSe
82
79
  if (data.response_types_supported) {
83
80
  if (!data.response_types_supported.includes('code')) {
84
81
  ctx.addIssue({
85
- code: zod_1.z.ZodIssueCode.custom,
82
+ code: z.ZodIssueCode.custom,
86
83
  message: 'Response type "code" is required',
87
84
  });
88
85
  }
@@ -93,7 +90,7 @@ exports.oauthAuthorizationServerMetadataValidator = exports.oauthAuthorizationSe
93
90
  // https://openid.net/specs/openid-connect-discovery-1_0.html#rfc.section.3
94
91
  // > The value `none` MUST NOT be used.
95
92
  ctx.addIssue({
96
- code: zod_1.z.ZodIssueCode.custom,
93
+ code: z.ZodIssueCode.custom,
97
94
  message: 'Client authentication method "none" is not allowed',
98
95
  });
99
96
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-server-metadata.js","sourceRoot":"","sources":["../src/oauth-authorization-server-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AAC;AACH,CAAC,CAAC;KACD,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IACzB,IACE,IAAI,CAAC,gDAAgD,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvE,CAAC;QACD,2EAA2E;QAC3E,uCAAuC;QACvC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,oDAAoD;SAC9D,CAAC,CAAA;IACJ,CAAC;AACH,CAAC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthCodeChallengeMethodSchema } from './oauth-code-challenge-method.js'\nimport { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js'\nimport { oauthPromptModeSchema } from './oauth-prompt-mode.js'\nimport { webUriSchema } from './uri.js'\n\n/**\n * @see {@link https://datatracker.ietf.org/doc/html/rfc8414}\n * @note we do not enforce https: scheme in URIs to support development\n * environments. Make sure to validate the URIs before using it in a production\n * environment.\n */\nexport const oauthAuthorizationServerMetadataSchema = z.object({\n issuer: oauthIssuerIdentifierSchema,\n\n claims_supported: z.array(z.string()).optional(),\n claims_locales_supported: z.array(z.string()).optional(),\n claims_parameter_supported: z.boolean().optional(),\n request_parameter_supported: z.boolean().optional(),\n request_uri_parameter_supported: z.boolean().optional(),\n require_request_uri_registration: z.boolean().optional(),\n scopes_supported: z.array(z.string()).optional(),\n subject_types_supported: z.array(z.string()).optional(),\n response_types_supported: z.array(z.string()).optional(),\n response_modes_supported: z.array(z.string()).optional(),\n grant_types_supported: z.array(z.string()).optional(),\n code_challenge_methods_supported: z\n .array(oauthCodeChallengeMethodSchema)\n .min(1)\n .optional(),\n ui_locales_supported: z.array(z.string()).optional(),\n id_token_signing_alg_values_supported: z.array(z.string()).optional(),\n display_values_supported: z.array(z.string()).optional(),\n request_object_signing_alg_values_supported: z.array(z.string()).optional(),\n authorization_response_iss_parameter_supported: z.boolean().optional(),\n authorization_details_types_supported: z.array(z.string()).optional(),\n request_object_encryption_alg_values_supported: z\n .array(z.string())\n .optional(),\n request_object_encryption_enc_values_supported: z\n .array(z.string())\n .optional(),\n\n jwks_uri: webUriSchema.optional(),\n\n authorization_endpoint: webUriSchema, // .optional(),\n\n token_endpoint: webUriSchema, // .optional(),\n // https://www.rfc-editor.org/rfc/rfc8414.html#section-2\n token_endpoint_auth_methods_supported: z\n .array(z.string())\n // > If omitted, the default is \"client_secret_basic\" [...].\n .default(['client_secret_basic']),\n token_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n\n revocation_endpoint: webUriSchema.optional(),\n introspection_endpoint: webUriSchema.optional(),\n pushed_authorization_request_endpoint: webUriSchema.optional(),\n\n require_pushed_authorization_requests: z.boolean().optional(),\n\n userinfo_endpoint: webUriSchema.optional(),\n end_session_endpoint: webUriSchema.optional(),\n registration_endpoint: webUriSchema.optional(),\n\n // https://datatracker.ietf.org/doc/html/rfc9449#section-5.1\n dpop_signing_alg_values_supported: z.array(z.string()).optional(),\n\n // https://www.rfc-editor.org/rfc/rfc9728.html#section-4\n protected_resources: z.array(webUriSchema).optional(),\n\n // https://www.ietf.org/archive/id/draft-ietf-oauth-client-id-metadata-document-00.html\n client_id_metadata_document_supported: z.boolean().optional(),\n\n // https://openid.net/specs/openid-connect-prompt-create-1_0.html#section-4.2\n prompt_values_supported: z.array(oauthPromptModeSchema).optional(),\n})\n\nexport type OAuthAuthorizationServerMetadata = z.infer<\n typeof oauthAuthorizationServerMetadataSchema\n>\n\nexport const oauthAuthorizationServerMetadataValidator =\n oauthAuthorizationServerMetadataSchema\n .superRefine((data, ctx) => {\n if (\n data.require_pushed_authorization_requests &&\n !data.pushed_authorization_request_endpoint\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message:\n '\"pushed_authorization_request_endpoint\" required when \"require_pushed_authorization_requests\" is true',\n })\n }\n })\n .superRefine((data, ctx) => {\n if (data.response_types_supported) {\n if (!data.response_types_supported.includes('code')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Response type \"code\" is required',\n })\n }\n }\n })\n .superRefine((data, ctx) => {\n if (\n data.token_endpoint_auth_signing_alg_values_supported?.includes('none')\n ) {\n // https://openid.net/specs/openid-connect-discovery-1_0.html#rfc.section.3\n // > The value `none` MUST NOT be used.\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Client authentication method \"none\" is not allowed',\n })\n }\n })\n"]}
1
+ {"version":3,"file":"oauth-authorization-server-metadata.js","sourceRoot":"","sources":["../src/oauth-authorization-server-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAA;AACjF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,2BAA2B;IAEnC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChD,wBAAwB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxD,0BAA0B,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAClD,2BAA2B,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACnD,+BAA+B,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACvD,gCAAgC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACxD,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,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CAAqC;QAC1C,CAAC,IAAI,CAAC,qCAAqC,EAC3C,CAAC;QACD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EACL,uGAAuG;SAC1G,CAAC,CAAA;IACJ,CAAC;AACH,CAAC,CAAC;KACD,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IACzB,IAAI,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAClC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACpD,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;gBAC3B,OAAO,EAAE,kCAAkC;aAC5C,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;AACH,CAAC,CAAC;KACD,WAAW,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;IACzB,IACE,IAAI,CAAC,gDAAgD,EAAE,QAAQ,CAAC,MAAM,CAAC,EACvE,CAAC;QACD,2EAA2E;QAC3E,uCAAuC;QACvC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,oDAAoD;SAC9D,CAAC,CAAA;IACJ,CAAC;AACH,CAAC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthCodeChallengeMethodSchema } from './oauth-code-challenge-method.js'\nimport { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js'\nimport { oauthPromptModeSchema } from './oauth-prompt-mode.js'\nimport { webUriSchema } from './uri.js'\n\n/**\n * @see {@link https://datatracker.ietf.org/doc/html/rfc8414}\n * @note we do not enforce https: scheme in URIs to support development\n * environments. Make sure to validate the URIs before using it in a production\n * environment.\n */\nexport const oauthAuthorizationServerMetadataSchema = z.object({\n issuer: oauthIssuerIdentifierSchema,\n\n claims_supported: z.array(z.string()).optional(),\n claims_locales_supported: z.array(z.string()).optional(),\n claims_parameter_supported: z.boolean().optional(),\n request_parameter_supported: z.boolean().optional(),\n request_uri_parameter_supported: z.boolean().optional(),\n require_request_uri_registration: z.boolean().optional(),\n scopes_supported: z.array(z.string()).optional(),\n subject_types_supported: z.array(z.string()).optional(),\n response_types_supported: z.array(z.string()).optional(),\n response_modes_supported: z.array(z.string()).optional(),\n grant_types_supported: z.array(z.string()).optional(),\n code_challenge_methods_supported: z\n .array(oauthCodeChallengeMethodSchema)\n .min(1)\n .optional(),\n ui_locales_supported: z.array(z.string()).optional(),\n id_token_signing_alg_values_supported: z.array(z.string()).optional(),\n display_values_supported: z.array(z.string()).optional(),\n request_object_signing_alg_values_supported: z.array(z.string()).optional(),\n authorization_response_iss_parameter_supported: z.boolean().optional(),\n authorization_details_types_supported: z.array(z.string()).optional(),\n request_object_encryption_alg_values_supported: z\n .array(z.string())\n .optional(),\n request_object_encryption_enc_values_supported: z\n .array(z.string())\n .optional(),\n\n jwks_uri: webUriSchema.optional(),\n\n authorization_endpoint: webUriSchema, // .optional(),\n\n token_endpoint: webUriSchema, // .optional(),\n // https://www.rfc-editor.org/rfc/rfc8414.html#section-2\n token_endpoint_auth_methods_supported: z\n .array(z.string())\n // > If omitted, the default is \"client_secret_basic\" [...].\n .default(['client_secret_basic']),\n token_endpoint_auth_signing_alg_values_supported: z\n .array(z.string())\n .optional(),\n\n revocation_endpoint: webUriSchema.optional(),\n introspection_endpoint: webUriSchema.optional(),\n pushed_authorization_request_endpoint: webUriSchema.optional(),\n\n require_pushed_authorization_requests: z.boolean().optional(),\n\n userinfo_endpoint: webUriSchema.optional(),\n end_session_endpoint: webUriSchema.optional(),\n registration_endpoint: webUriSchema.optional(),\n\n // https://datatracker.ietf.org/doc/html/rfc9449#section-5.1\n dpop_signing_alg_values_supported: z.array(z.string()).optional(),\n\n // https://www.rfc-editor.org/rfc/rfc9728.html#section-4\n protected_resources: z.array(webUriSchema).optional(),\n\n // https://www.ietf.org/archive/id/draft-ietf-oauth-client-id-metadata-document-00.html\n client_id_metadata_document_supported: z.boolean().optional(),\n\n // https://openid.net/specs/openid-connect-prompt-create-1_0.html#section-4.2\n prompt_values_supported: z.array(oauthPromptModeSchema).optional(),\n})\n\nexport type OAuthAuthorizationServerMetadata = z.infer<\n typeof oauthAuthorizationServerMetadataSchema\n>\n\nexport const oauthAuthorizationServerMetadataValidator =\n oauthAuthorizationServerMetadataSchema\n .superRefine((data, ctx) => {\n if (\n data.require_pushed_authorization_requests &&\n !data.pushed_authorization_request_endpoint\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message:\n '\"pushed_authorization_request_endpoint\" required when \"require_pushed_authorization_requests\" is true',\n })\n }\n })\n .superRefine((data, ctx) => {\n if (data.response_types_supported) {\n if (!data.response_types_supported.includes('code')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Response type \"code\" is required',\n })\n }\n }\n })\n .superRefine((data, ctx) => {\n if (\n data.token_endpoint_auth_signing_alg_values_supported?.includes('none')\n ) {\n // https://openid.net/specs/openid-connect-discovery-1_0.html#rfc.section.3\n // > The value `none` MUST NOT be used.\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Client authentication method \"none\" is not allowed',\n })\n }\n })\n"]}
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthClientCredentialsGrantTokenRequestSchema = void 0;
4
- const zod_1 = require("zod");
5
- exports.oauthClientCredentialsGrantTokenRequestSchema = zod_1.z.object({
6
- grant_type: zod_1.z.literal('client_credentials'),
1
+ import { z } from 'zod';
2
+ export const oauthClientCredentialsGrantTokenRequestSchema = z.object({
3
+ grant_type: z.literal('client_credentials'),
7
4
  });
8
5
  //# sourceMappingURL=oauth-client-credentials-grant-token-request.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-client-credentials-grant-token-request.js","sourceRoot":"","sources":["../src/oauth-client-credentials-grant-token-request.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,6CAA6C,GAAG,OAAC,CAAC,MAAM,CAAC;IACpE,UAAU,EAAE,OAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;CAC5C,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthClientCredentialsGrantTokenRequestSchema = z.object({\n grant_type: z.literal('client_credentials'),\n})\n\nexport type OAuthClientCredentialsGrantTokenRequest = z.infer<\n typeof oauthClientCredentialsGrantTokenRequestSchema\n>\n"]}
1
+ {"version":3,"file":"oauth-client-credentials-grant-token-request.js","sourceRoot":"","sources":["../src/oauth-client-credentials-grant-token-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,6CAA6C,GAAG,CAAC,CAAC,MAAM,CAAC;IACpE,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC;CAC5C,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthClientCredentialsGrantTokenRequestSchema = z.object({\n grant_type: z.literal('client_credentials'),\n})\n\nexport type OAuthClientCredentialsGrantTokenRequest = z.infer<\n typeof oauthClientCredentialsGrantTokenRequestSchema\n>\n"]}
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.oauthClientCredentialsSchema = exports.oauthClientCredentialsNoneSchema = exports.oauthClientCredentialsSecretPostSchema = exports.oauthClientCredentialsJwtBearerSchema = void 0;
4
- const zod_1 = require("zod");
5
- const jwk_1 = require("@atproto/jwk");
6
- const constants_js_1 = require("./constants.js");
7
- const oauth_client_id_js_1 = require("./oauth-client-id.js");
8
- exports.oauthClientCredentialsJwtBearerSchema = zod_1.z.object({
9
- client_id: oauth_client_id_js_1.oauthClientIdSchema,
10
- client_assertion_type: zod_1.z.literal(constants_js_1.CLIENT_ASSERTION_TYPE_JWT_BEARER),
1
+ import { z } from 'zod';
2
+ import { signedJwtSchema } from '@atproto/jwk';
3
+ import { CLIENT_ASSERTION_TYPE_JWT_BEARER } from './constants.js';
4
+ import { oauthClientIdSchema } from './oauth-client-id.js';
5
+ export const oauthClientCredentialsJwtBearerSchema = z.object({
6
+ client_id: oauthClientIdSchema,
7
+ client_assertion_type: z.literal(CLIENT_ASSERTION_TYPE_JWT_BEARER),
11
8
  /**
12
9
  * - "sub" the subject MUST be the "client_id" of the OAuth client
13
10
  * - "iat" is required and MUST be less than one minute
@@ -17,20 +14,20 @@ exports.oauthClientCredentialsJwtBearerSchema = zod_1.z.object({
17
14
  *
18
15
  * @see {@link https://datatracker.ietf.org/doc/html/rfc7523#section-3}
19
16
  */
20
- client_assertion: jwk_1.signedJwtSchema,
17
+ client_assertion: signedJwtSchema,
21
18
  });
22
- exports.oauthClientCredentialsSecretPostSchema = zod_1.z.object({
23
- client_id: oauth_client_id_js_1.oauthClientIdSchema,
24
- client_secret: zod_1.z.string(),
19
+ export const oauthClientCredentialsSecretPostSchema = z.object({
20
+ client_id: oauthClientIdSchema,
21
+ client_secret: z.string(),
25
22
  });
26
- exports.oauthClientCredentialsNoneSchema = zod_1.z.object({
27
- client_id: oauth_client_id_js_1.oauthClientIdSchema,
23
+ export const oauthClientCredentialsNoneSchema = z.object({
24
+ client_id: oauthClientIdSchema,
28
25
  });
29
26
  //
30
- exports.oauthClientCredentialsSchema = zod_1.z.union([
31
- exports.oauthClientCredentialsJwtBearerSchema,
32
- exports.oauthClientCredentialsSecretPostSchema,
27
+ export const oauthClientCredentialsSchema = z.union([
28
+ oauthClientCredentialsJwtBearerSchema,
29
+ oauthClientCredentialsSecretPostSchema,
33
30
  // Must be last since it is less specific
34
- exports.oauthClientCredentialsNoneSchema,
31
+ oauthClientCredentialsNoneSchema,
35
32
  ]);
36
33
  //# sourceMappingURL=oauth-client-credentials.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-client-credentials.js","sourceRoot":"","sources":["../src/oauth-client-credentials.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AACvB,sCAA8C;AAC9C,iDAAiE;AACjE,6DAA0D;AAE7C,QAAA,qCAAqC,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5D,SAAS,EAAE,wCAAmB;IAC9B,qBAAqB,EAAE,OAAC,CAAC,OAAO,CAAC,+CAAgC,CAAC;IAClE;;;;;;;;OAQG;IACH,gBAAgB,EAAE,qBAAe;CAClC,CAAC,CAAA;AAMW,QAAA,sCAAsC,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,wCAAmB;IAC9B,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAA;AAMW,QAAA,gCAAgC,GAAG,OAAC,CAAC,MAAM,CAAC;IACvD,SAAS,EAAE,wCAAmB;CAC/B,CAAC,CAAA;AAMF,EAAE;AAEW,QAAA,4BAA4B,GAAG,OAAC,CAAC,KAAK,CAAC;IAClD,6CAAqC;IACrC,8CAAsC;IACtC,yCAAyC;IACzC,wCAAgC;CACjC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { signedJwtSchema } from '@atproto/jwk'\nimport { CLIENT_ASSERTION_TYPE_JWT_BEARER } from './constants.js'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\n\nexport const oauthClientCredentialsJwtBearerSchema = z.object({\n client_id: oauthClientIdSchema,\n client_assertion_type: z.literal(CLIENT_ASSERTION_TYPE_JWT_BEARER),\n /**\n * - \"sub\" the subject MUST be the \"client_id\" of the OAuth client\n * - \"iat\" is required and MUST be less than one minute\n * - \"aud\" must containing a value that identifies the authorization server\n * - The JWT MAY contain a \"jti\" (JWT ID) claim that provides a unique identifier for the token.\n * - Note that the authorization server may reject JWTs with an \"exp\" claim value that is unreasonably far in the future.\n *\n * @see {@link https://datatracker.ietf.org/doc/html/rfc7523#section-3}\n */\n client_assertion: signedJwtSchema,\n})\n\nexport type OAuthClientCredentialsJwtBearer = z.infer<\n typeof oauthClientCredentialsJwtBearerSchema\n>\n\nexport const oauthClientCredentialsSecretPostSchema = z.object({\n client_id: oauthClientIdSchema,\n client_secret: z.string(),\n})\n\nexport type OAuthClientCredentialsSecretPost = z.infer<\n typeof oauthClientCredentialsSecretPostSchema\n>\n\nexport const oauthClientCredentialsNoneSchema = z.object({\n client_id: oauthClientIdSchema,\n})\n\nexport type OAuthClientCredentialsNone = z.infer<\n typeof oauthClientCredentialsNoneSchema\n>\n\n//\n\nexport const oauthClientCredentialsSchema = z.union([\n oauthClientCredentialsJwtBearerSchema,\n oauthClientCredentialsSecretPostSchema,\n // Must be last since it is less specific\n oauthClientCredentialsNoneSchema,\n])\n\nexport type OAuthClientCredentials = z.infer<\n typeof oauthClientCredentialsSchema\n>\n"]}
1
+ {"version":3,"file":"oauth-client-credentials.js","sourceRoot":"","sources":["../src/oauth-client-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,OAAO,EAAE,gCAAgC,EAAE,MAAM,gBAAgB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5D,SAAS,EAAE,mBAAmB;IAC9B,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,gCAAgC,CAAC;IAClE;;;;;;;;OAQG;IACH,gBAAgB,EAAE,eAAe;CAClC,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,SAAS,EAAE,mBAAmB;IAC9B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,SAAS,EAAE,mBAAmB;CAC/B,CAAC,CAAA;AAMF,EAAE;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC;IAClD,qCAAqC;IACrC,sCAAsC;IACtC,yCAAyC;IACzC,gCAAgC;CACjC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { signedJwtSchema } from '@atproto/jwk'\nimport { CLIENT_ASSERTION_TYPE_JWT_BEARER } from './constants.js'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\n\nexport const oauthClientCredentialsJwtBearerSchema = z.object({\n client_id: oauthClientIdSchema,\n client_assertion_type: z.literal(CLIENT_ASSERTION_TYPE_JWT_BEARER),\n /**\n * - \"sub\" the subject MUST be the \"client_id\" of the OAuth client\n * - \"iat\" is required and MUST be less than one minute\n * - \"aud\" must containing a value that identifies the authorization server\n * - The JWT MAY contain a \"jti\" (JWT ID) claim that provides a unique identifier for the token.\n * - Note that the authorization server may reject JWTs with an \"exp\" claim value that is unreasonably far in the future.\n *\n * @see {@link https://datatracker.ietf.org/doc/html/rfc7523#section-3}\n */\n client_assertion: signedJwtSchema,\n})\n\nexport type OAuthClientCredentialsJwtBearer = z.infer<\n typeof oauthClientCredentialsJwtBearerSchema\n>\n\nexport const oauthClientCredentialsSecretPostSchema = z.object({\n client_id: oauthClientIdSchema,\n client_secret: z.string(),\n})\n\nexport type OAuthClientCredentialsSecretPost = z.infer<\n typeof oauthClientCredentialsSecretPostSchema\n>\n\nexport const oauthClientCredentialsNoneSchema = z.object({\n client_id: oauthClientIdSchema,\n})\n\nexport type OAuthClientCredentialsNone = z.infer<\n typeof oauthClientCredentialsNoneSchema\n>\n\n//\n\nexport const oauthClientCredentialsSchema = z.union([\n oauthClientCredentialsJwtBearerSchema,\n oauthClientCredentialsSecretPostSchema,\n // Must be last since it is less specific\n oauthClientCredentialsNoneSchema,\n])\n\nexport type OAuthClientCredentials = z.infer<\n typeof oauthClientCredentialsSchema\n>\n"]}