@atcute/oauth-types 0.1.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 (158) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +48 -0
  3. package/dist/build-client-metadata.d.ts +168 -0
  4. package/dist/build-client-metadata.d.ts.map +1 -0
  5. package/dist/build-client-metadata.js +53 -0
  6. package/dist/build-client-metadata.js.map +1 -0
  7. package/dist/constants.d.ts +5 -0
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/constants.js +5 -0
  10. package/dist/constants.js.map +1 -0
  11. package/dist/index.d.ts +31 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +37 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/schemas/atcute-confidential-client-metadata.d.ts +21 -0
  16. package/dist/schemas/atcute-confidential-client-metadata.d.ts.map +1 -0
  17. package/dist/schemas/atcute-confidential-client-metadata.js +112 -0
  18. package/dist/schemas/atcute-confidential-client-metadata.js.map +1 -0
  19. package/dist/schemas/atproto-authorization-server-metadata.d.ts +55 -0
  20. package/dist/schemas/atproto-authorization-server-metadata.d.ts.map +1 -0
  21. package/dist/schemas/atproto-authorization-server-metadata.js +25 -0
  22. package/dist/schemas/atproto-authorization-server-metadata.js.map +1 -0
  23. package/dist/schemas/atproto-oauth-scope.d.ts +8 -0
  24. package/dist/schemas/atproto-oauth-scope.d.ts.map +1 -0
  25. package/dist/schemas/atproto-oauth-scope.js +12 -0
  26. package/dist/schemas/atproto-oauth-scope.js.map +1 -0
  27. package/dist/schemas/atproto-oauth-token-response.d.ts +19 -0
  28. package/dist/schemas/atproto-oauth-token-response.d.ts.map +1 -0
  29. package/dist/schemas/atproto-oauth-token-response.js +16 -0
  30. package/dist/schemas/atproto-oauth-token-response.js.map +1 -0
  31. package/dist/schemas/atproto-protected-resource-metadata.d.ts +21 -0
  32. package/dist/schemas/atproto-protected-resource-metadata.d.ts.map +1 -0
  33. package/dist/schemas/atproto-protected-resource-metadata.js +18 -0
  34. package/dist/schemas/atproto-protected-resource-metadata.js.map +1 -0
  35. package/dist/schemas/jwk.d.ts +241 -0
  36. package/dist/schemas/jwk.d.ts.map +1 -0
  37. package/dist/schemas/jwk.js +138 -0
  38. package/dist/schemas/jwk.js.map +1 -0
  39. package/dist/schemas/jwks.d.ts +242 -0
  40. package/dist/schemas/jwks.d.ts.map +1 -0
  41. package/dist/schemas/jwks.js +34 -0
  42. package/dist/schemas/jwks.js.map +1 -0
  43. package/dist/schemas/oauth-authorization-details.d.ts +64 -0
  44. package/dist/schemas/oauth-authorization-details.d.ts.map +1 -0
  45. package/dist/schemas/oauth-authorization-details.js +37 -0
  46. package/dist/schemas/oauth-authorization-details.js.map +1 -0
  47. package/dist/schemas/oauth-authorization-server-metadata.d.ts +96 -0
  48. package/dist/schemas/oauth-authorization-server-metadata.d.ts.map +1 -0
  49. package/dist/schemas/oauth-authorization-server-metadata.js +81 -0
  50. package/dist/schemas/oauth-authorization-server-metadata.js.map +1 -0
  51. package/dist/schemas/oauth-client-id-discoverable.d.ts +6 -0
  52. package/dist/schemas/oauth-client-id-discoverable.d.ts.map +1 -0
  53. package/dist/schemas/oauth-client-id-discoverable.js +43 -0
  54. package/dist/schemas/oauth-client-id-discoverable.js.map +1 -0
  55. package/dist/schemas/oauth-client-id.d.ts +5 -0
  56. package/dist/schemas/oauth-client-id.d.ts.map +1 -0
  57. package/dist/schemas/oauth-client-id.js +4 -0
  58. package/dist/schemas/oauth-client-id.js.map +1 -0
  59. package/dist/schemas/oauth-client-metadata.d.ts +164 -0
  60. package/dist/schemas/oauth-client-metadata.d.ts.map +1 -0
  61. package/dist/schemas/oauth-client-metadata.js +74 -0
  62. package/dist/schemas/oauth-client-metadata.js.map +1 -0
  63. package/dist/schemas/oauth-code-challenge-method.d.ts +4 -0
  64. package/dist/schemas/oauth-code-challenge-method.d.ts.map +1 -0
  65. package/dist/schemas/oauth-code-challenge-method.js +3 -0
  66. package/dist/schemas/oauth-code-challenge-method.js.map +1 -0
  67. package/dist/schemas/oauth-endpoint-auth-method.d.ts +4 -0
  68. package/dist/schemas/oauth-endpoint-auth-method.d.ts.map +1 -0
  69. package/dist/schemas/oauth-endpoint-auth-method.js +3 -0
  70. package/dist/schemas/oauth-endpoint-auth-method.js.map +1 -0
  71. package/dist/schemas/oauth-grant-type.d.ts +4 -0
  72. package/dist/schemas/oauth-grant-type.d.ts.map +1 -0
  73. package/dist/schemas/oauth-grant-type.js +4 -0
  74. package/dist/schemas/oauth-grant-type.js.map +1 -0
  75. package/dist/schemas/oauth-issuer-identifier.d.ts +4 -0
  76. package/dist/schemas/oauth-issuer-identifier.d.ts.map +1 -0
  77. package/dist/schemas/oauth-issuer-identifier.js +21 -0
  78. package/dist/schemas/oauth-issuer-identifier.js.map +1 -0
  79. package/dist/schemas/oauth-par-response.d.ts +7 -0
  80. package/dist/schemas/oauth-par-response.d.ts.map +1 -0
  81. package/dist/schemas/oauth-par-response.js +7 -0
  82. package/dist/schemas/oauth-par-response.js.map +1 -0
  83. package/dist/schemas/oauth-prompt.d.ts +13 -0
  84. package/dist/schemas/oauth-prompt.d.ts.map +1 -0
  85. package/dist/schemas/oauth-prompt.js +12 -0
  86. package/dist/schemas/oauth-prompt.js.map +1 -0
  87. package/dist/schemas/oauth-protected-resource-metadata.d.ts +66 -0
  88. package/dist/schemas/oauth-protected-resource-metadata.d.ts.map +1 -0
  89. package/dist/schemas/oauth-protected-resource-metadata.js +71 -0
  90. package/dist/schemas/oauth-protected-resource-metadata.js.map +1 -0
  91. package/dist/schemas/oauth-redirect-uri.d.ts +20 -0
  92. package/dist/schemas/oauth-redirect-uri.d.ts.map +1 -0
  93. package/dist/schemas/oauth-redirect-uri.js +32 -0
  94. package/dist/schemas/oauth-redirect-uri.js.map +1 -0
  95. package/dist/schemas/oauth-response-mode.d.ts +4 -0
  96. package/dist/schemas/oauth-response-mode.d.ts.map +1 -0
  97. package/dist/schemas/oauth-response-mode.js +3 -0
  98. package/dist/schemas/oauth-response-mode.js.map +1 -0
  99. package/dist/schemas/oauth-response-type.d.ts +4 -0
  100. package/dist/schemas/oauth-response-type.d.ts.map +1 -0
  101. package/dist/schemas/oauth-response-type.js +8 -0
  102. package/dist/schemas/oauth-response-type.js.map +1 -0
  103. package/dist/schemas/oauth-scope.d.ts +12 -0
  104. package/dist/schemas/oauth-scope.d.ts.map +1 -0
  105. package/dist/schemas/oauth-scope.js +14 -0
  106. package/dist/schemas/oauth-scope.js.map +1 -0
  107. package/dist/schemas/oauth-token-response.d.ts +22 -0
  108. package/dist/schemas/oauth-token-response.d.ts.map +1 -0
  109. package/dist/schemas/oauth-token-response.js +19 -0
  110. package/dist/schemas/oauth-token-response.js.map +1 -0
  111. package/dist/schemas/oauth-token-type.d.ts +5 -0
  112. package/dist/schemas/oauth-token-type.d.ts.map +1 -0
  113. package/dist/schemas/oauth-token-type.js +13 -0
  114. package/dist/schemas/oauth-token-type.js.map +1 -0
  115. package/dist/schemas/uri.d.ts +18 -0
  116. package/dist/schemas/uri.d.ts.map +1 -0
  117. package/dist/schemas/uri.js +81 -0
  118. package/dist/schemas/uri.js.map +1 -0
  119. package/dist/schemas/utils.d.ts +32 -0
  120. package/dist/schemas/utils.d.ts.map +1 -0
  121. package/dist/schemas/utils.js +94 -0
  122. package/dist/schemas/utils.js.map +1 -0
  123. package/dist/scope.d.ts +84 -0
  124. package/dist/scope.d.ts.map +1 -0
  125. package/dist/scope.js +102 -0
  126. package/dist/scope.js.map +1 -0
  127. package/lib/build-client-metadata.ts +72 -0
  128. package/lib/constants.ts +5 -0
  129. package/lib/index.ts +116 -0
  130. package/lib/schemas/atcute-confidential-client-metadata.ts +139 -0
  131. package/lib/schemas/atproto-authorization-server-metadata.ts +32 -0
  132. package/lib/schemas/atproto-oauth-scope.ts +18 -0
  133. package/lib/schemas/atproto-oauth-token-response.ts +20 -0
  134. package/lib/schemas/atproto-protected-resource-metadata.ts +24 -0
  135. package/lib/schemas/jwk.ts +189 -0
  136. package/lib/schemas/jwks.ts +45 -0
  137. package/lib/schemas/oauth-authorization-details.ts +43 -0
  138. package/lib/schemas/oauth-authorization-server-metadata.ts +101 -0
  139. package/lib/schemas/oauth-client-id-discoverable.ts +53 -0
  140. package/lib/schemas/oauth-client-id.ts +6 -0
  141. package/lib/schemas/oauth-client-metadata.ts +83 -0
  142. package/lib/schemas/oauth-code-challenge-method.ts +5 -0
  143. package/lib/schemas/oauth-endpoint-auth-method.ts +13 -0
  144. package/lib/schemas/oauth-grant-type.ts +13 -0
  145. package/lib/schemas/oauth-issuer-identifier.ts +30 -0
  146. package/lib/schemas/oauth-par-response.ts +10 -0
  147. package/lib/schemas/oauth-prompt.ts +20 -0
  148. package/lib/schemas/oauth-protected-resource-metadata.ts +89 -0
  149. package/lib/schemas/oauth-redirect-uri.ts +42 -0
  150. package/lib/schemas/oauth-response-mode.ts +9 -0
  151. package/lib/schemas/oauth-response-type.ts +17 -0
  152. package/lib/schemas/oauth-scope.ts +18 -0
  153. package/lib/schemas/oauth-token-response.ts +22 -0
  154. package/lib/schemas/oauth-token-type.ts +15 -0
  155. package/lib/schemas/uri.ts +100 -0
  156. package/lib/schemas/utils.ts +113 -0
  157. package/lib/scope.ts +187 -0
  158. package/package.json +38 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-client-id.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-client-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,gBAAsE,CAAC;AAEvG,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as v from '@badrap/valita';
2
+ /** base OAuth client ID (any non-empty string) */
3
+ export const oauthClientIdSchema = v.string().assert((input) => input.length > 0, `must not be empty`);
4
+ //# sourceMappingURL=oauth-client-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-client-id.js","sourceRoot":"","sources":["../../lib/schemas/oauth-client-id.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,kDAAkD;AAClD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,mBAAmB,CAAC,CAAC"}
@@ -0,0 +1,164 @@
1
+ import * as v from '@badrap/valita';
2
+ /**
3
+ * base OAuth client metadata schema.
4
+ *
5
+ * @see {@link https://openid.net/specs/openid-connect-registration-1_0.html}
6
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc7591}
7
+ */
8
+ export declare const oauthClientMetadataSchema: v.ObjectType<{
9
+ redirect_uris: v.Type<string[]>;
10
+ response_types: v.Optional<("code" | "code id_token" | "code id_token token" | "code token" | "id_token" | "id_token token" | "none" | "token")[]>;
11
+ grant_types: v.Optional<("authorization_code" | "client_credentials" | "implicit" | "password" | "refresh_token" | "urn:ietf:params:oauth:grant-type:jwt-bearer" | "urn:ietf:params:oauth:grant-type:saml2-bearer")[]>;
12
+ scope: v.Optional<string>;
13
+ token_endpoint_auth_method: v.Optional<"client_secret_basic" | "client_secret_jwt" | "client_secret_post" | "none" | "private_key_jwt" | "self_signed_tls_client_auth" | "tls_client_auth">;
14
+ token_endpoint_auth_signing_alg: v.Optional<string>;
15
+ userinfo_signed_response_alg: v.Optional<string>;
16
+ userinfo_encrypted_response_alg: v.Optional<string>;
17
+ jwks_uri: v.Optional<string>;
18
+ jwks: v.Optional<{
19
+ keys: ({
20
+ kid?: string | undefined;
21
+ use?: "enc" | "sig" | undefined;
22
+ key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
23
+ x5c?: string[] | undefined;
24
+ x5t?: string | undefined;
25
+ 'x5t#S256'?: string | undefined;
26
+ x5u?: string | undefined;
27
+ ext?: boolean | undefined;
28
+ iat?: number | undefined;
29
+ exp?: number | undefined;
30
+ nbf?: number | undefined;
31
+ revoked?: {
32
+ revoked_at: number;
33
+ reason?: string | undefined;
34
+ } | undefined;
35
+ kty: "RSA";
36
+ alg?: "PS256" | "PS384" | "PS512" | "RS256" | "RS384" | "RS512" | undefined;
37
+ n: string;
38
+ e: string;
39
+ d?: string | undefined;
40
+ p?: string | undefined;
41
+ q?: string | undefined;
42
+ dp?: string | undefined;
43
+ dq?: string | undefined;
44
+ qi?: string | undefined;
45
+ oth?: {
46
+ r?: string | undefined;
47
+ d?: string | undefined;
48
+ t?: string | undefined;
49
+ }[] | undefined;
50
+ } | {
51
+ kid?: string | undefined;
52
+ use?: "enc" | "sig" | undefined;
53
+ key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
54
+ x5c?: string[] | undefined;
55
+ x5t?: string | undefined;
56
+ 'x5t#S256'?: string | undefined;
57
+ x5u?: string | undefined;
58
+ ext?: boolean | undefined;
59
+ iat?: number | undefined;
60
+ exp?: number | undefined;
61
+ nbf?: number | undefined;
62
+ revoked?: {
63
+ revoked_at: number;
64
+ reason?: string | undefined;
65
+ } | undefined;
66
+ kty: "EC";
67
+ alg?: "ES256" | "ES384" | "ES512" | undefined;
68
+ crv: "P-256" | "P-384" | "P-521";
69
+ x: string;
70
+ y: string;
71
+ d?: string | undefined;
72
+ } | {
73
+ kid?: string | undefined;
74
+ use?: "enc" | "sig" | undefined;
75
+ key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
76
+ x5c?: string[] | undefined;
77
+ x5t?: string | undefined;
78
+ 'x5t#S256'?: string | undefined;
79
+ x5u?: string | undefined;
80
+ ext?: boolean | undefined;
81
+ iat?: number | undefined;
82
+ exp?: number | undefined;
83
+ nbf?: number | undefined;
84
+ revoked?: {
85
+ revoked_at: number;
86
+ reason?: string | undefined;
87
+ } | undefined;
88
+ kty: "EC";
89
+ alg?: "ES256K" | undefined;
90
+ crv: "secp256k1";
91
+ x: string;
92
+ y: string;
93
+ d?: string | undefined;
94
+ } | {
95
+ kid?: string | undefined;
96
+ use?: "enc" | "sig" | undefined;
97
+ key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
98
+ x5c?: string[] | undefined;
99
+ x5t?: string | undefined;
100
+ 'x5t#S256'?: string | undefined;
101
+ x5u?: string | undefined;
102
+ ext?: boolean | undefined;
103
+ iat?: number | undefined;
104
+ exp?: number | undefined;
105
+ nbf?: number | undefined;
106
+ revoked?: {
107
+ revoked_at: number;
108
+ reason?: string | undefined;
109
+ } | undefined;
110
+ kty: "OKP";
111
+ alg?: "EdDSA" | undefined;
112
+ crv: "Ed25519" | "Ed448";
113
+ x: string;
114
+ d?: string | undefined;
115
+ } | {
116
+ kid?: string | undefined;
117
+ use?: "enc" | "sig" | undefined;
118
+ key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
119
+ x5c?: string[] | undefined;
120
+ x5t?: string | undefined;
121
+ 'x5t#S256'?: string | undefined;
122
+ x5u?: string | undefined;
123
+ ext?: boolean | undefined;
124
+ iat?: number | undefined;
125
+ exp?: number | undefined;
126
+ nbf?: number | undefined;
127
+ revoked?: {
128
+ revoked_at: number;
129
+ reason?: string | undefined;
130
+ } | undefined;
131
+ kty: "oct";
132
+ alg?: "HS256" | "HS384" | "HS512" | undefined;
133
+ k: string;
134
+ })[];
135
+ }>;
136
+ application_type: v.Optional<"native" | "web">;
137
+ subject_type: v.Optional<"pairwise" | "public">;
138
+ request_object_signing_alg: v.Optional<string>;
139
+ id_token_signed_response_alg: v.Optional<string>;
140
+ authorization_signed_response_alg: v.Optional<string>;
141
+ authorization_encrypted_response_enc: v.Optional<"A128CBC-HS256">;
142
+ authorization_encrypted_response_alg: v.Optional<string>;
143
+ client_id: v.Optional<string>;
144
+ client_name: v.Optional<string>;
145
+ client_uri: v.Optional<string>;
146
+ policy_uri: v.Optional<string>;
147
+ tos_uri: v.Optional<string>;
148
+ logo_uri: v.Optional<string>;
149
+ /**
150
+ * default Maximum Authentication Age. specifies that the End-User MUST be
151
+ * actively authenticated if the End-User was authenticated longer ago than
152
+ * the specified number of seconds. the max_age request parameter overrides
153
+ * this default value. if omitted, no default Maximum Authentication Age is
154
+ * specified.
155
+ */
156
+ default_max_age: v.Optional<number>;
157
+ require_auth_time: v.Optional<boolean>;
158
+ contacts: v.Optional<string[]>;
159
+ tls_client_certificate_bound_access_tokens: v.Optional<boolean>;
160
+ dpop_bound_access_tokens: v.Optional<boolean>;
161
+ authorization_details_types: v.Optional<string[]>;
162
+ }, undefined>;
163
+ export type OAuthClientMetadata = v.Infer<typeof oauthClientMetadataSchema>;
164
+ //# sourceMappingURL=oauth-client-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-client-metadata.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-client-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAkBpC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAuCrC;;;;;;OAMG;;;;;;;aAWF,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1,74 @@
1
+ import * as v from '@badrap/valita';
2
+ import { jwksPubSchema } from './jwks.js';
3
+ import { oauthClientIdSchema } from './oauth-client-id.js';
4
+ import { oauthEndpointAuthMethodSchema } from './oauth-endpoint-auth-method.js';
5
+ import { oauthGrantTypeSchema } from './oauth-grant-type.js';
6
+ import { oauthRedirectUriSchema } from './oauth-redirect-uri.js';
7
+ import { oauthResponseTypeSchema } from './oauth-response-type.js';
8
+ import { oauthScopeSchema } from './oauth-scope.js';
9
+ import { webUriSchema } from './uri.js';
10
+ const oauthApplicationTypeSchema = v.union(v.literal('web'), v.literal('native'));
11
+ const oauthSubjectTypeSchema = v.union(v.literal('public'), v.literal('pairwise'));
12
+ // simple email validation
13
+ const EMAIL_RE = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
14
+ /**
15
+ * base OAuth client metadata schema.
16
+ *
17
+ * @see {@link https://openid.net/specs/openid-connect-registration-1_0.html}
18
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc7591}
19
+ */
20
+ export const oauthClientMetadataSchema = v.object({
21
+ // https://www.rfc-editor.org/rfc/rfc7591.html#section-2
22
+ redirect_uris: v
23
+ .array(oauthRedirectUriSchema)
24
+ .assert((arr) => arr.length > 0, `must have at least one redirect URI`),
25
+ response_types: v.array(oauthResponseTypeSchema).optional(),
26
+ // > If omitted, the default is that the client will use only the "code"
27
+ // > response type.
28
+ // .optional((): OAuthResponseType[] => ['code'])
29
+ grant_types: v.array(oauthGrantTypeSchema).optional(),
30
+ // > If omitted, the default behavior is that the client will use only the
31
+ // > "authorization_code" Grant Type.
32
+ // .optional((): OAuthGrantType[] => ['authorization_code']),
33
+ scope: oauthScopeSchema.optional(),
34
+ // https://www.rfc-editor.org/rfc/rfc7591.html#section-2
35
+ token_endpoint_auth_method: oauthEndpointAuthMethodSchema.optional(),
36
+ // > If unspecified or omitted, the default is "client_secret_basic" [...].
37
+ // .optional((): OAuthEndpointAuthMethod => 'client_secret_basic'),
38
+ token_endpoint_auth_signing_alg: v.string().optional(),
39
+ userinfo_signed_response_alg: v.string().optional(),
40
+ userinfo_encrypted_response_alg: v.string().optional(),
41
+ jwks_uri: webUriSchema.optional(),
42
+ jwks: jwksPubSchema.optional(),
43
+ application_type: oauthApplicationTypeSchema.optional(),
44
+ // .optional((): OAuthApplicationType => 'web'),
45
+ subject_type: oauthSubjectTypeSchema.optional(),
46
+ // .optional((): OAuthSubjectType => 'public'),
47
+ request_object_signing_alg: v.string().optional(),
48
+ id_token_signed_response_alg: v.string().optional(),
49
+ authorization_signed_response_alg: v.string().optional(),
50
+ authorization_encrypted_response_enc: v.literal('A128CBC-HS256').optional(),
51
+ authorization_encrypted_response_alg: v.string().optional(),
52
+ client_id: oauthClientIdSchema.optional(),
53
+ client_name: v.string().optional(),
54
+ client_uri: webUriSchema.optional(),
55
+ policy_uri: webUriSchema.optional(),
56
+ tos_uri: webUriSchema.optional(),
57
+ logo_uri: webUriSchema.optional(),
58
+ /**
59
+ * default Maximum Authentication Age. specifies that the End-User MUST be
60
+ * actively authenticated if the End-User was authenticated longer ago than
61
+ * the specified number of seconds. the max_age request parameter overrides
62
+ * this default value. if omitted, no default Maximum Authentication Age is
63
+ * specified.
64
+ */
65
+ default_max_age: v.number().optional(),
66
+ require_auth_time: v.boolean().optional(),
67
+ contacts: v.array(v.string().assert((s) => EMAIL_RE.test(s), `must be a valid email`)).optional(),
68
+ tls_client_certificate_bound_access_tokens: v.boolean().optional(),
69
+ // https://datatracker.ietf.org/doc/html/rfc9449#section-5.2
70
+ dpop_bound_access_tokens: v.boolean().optional(),
71
+ // https://datatracker.ietf.org/doc/html/rfc9396#section-14.5
72
+ authorization_details_types: v.array(v.string()).optional(),
73
+ });
74
+ //# sourceMappingURL=oauth-client-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-client-metadata.js","sourceRoot":"","sources":["../../lib/schemas/oauth-client-metadata.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,4 @@
1
+ import * as v from '@badrap/valita';
2
+ export declare const oauthCodeChallengeMethodSchema: v.UnionType<[v.Type<"S256">, v.Type<"plain">]>;
3
+ export type OAuthCodeChallengeMethod = v.Infer<typeof oauthCodeChallengeMethodSchema>;
4
+ //# sourceMappingURL=oauth-code-challenge-method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-code-challenge-method.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-code-challenge-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,eAAO,MAAM,8BAA8B,gDAAiD,CAAC;AAE7F,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as v from '@badrap/valita';
2
+ export const oauthCodeChallengeMethodSchema = v.union(v.literal('S256'), v.literal('plain'));
3
+ //# sourceMappingURL=oauth-code-challenge-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-code-challenge-method.js","sourceRoot":"","sources":["../../lib/schemas/oauth-code-challenge-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as v from '@badrap/valita';
2
+ export declare const oauthEndpointAuthMethodSchema: v.UnionType<[v.Type<"client_secret_basic">, v.Type<"client_secret_jwt">, v.Type<"client_secret_post">, v.Type<"none">, v.Type<"private_key_jwt">, v.Type<"self_signed_tls_client_auth">, v.Type<"tls_client_auth">]>;
3
+ export type OAuthEndpointAuthMethod = v.Infer<typeof oauthEndpointAuthMethodSchema>;
4
+ //# sourceMappingURL=oauth-endpoint-auth-method.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-endpoint-auth-method.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-endpoint-auth-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,eAAO,MAAM,6BAA6B,sNAQzC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import * as v from '@badrap/valita';
2
+ export const oauthEndpointAuthMethodSchema = v.union(v.literal('client_secret_basic'), v.literal('client_secret_jwt'), v.literal('client_secret_post'), v.literal('none'), v.literal('private_key_jwt'), v.literal('self_signed_tls_client_auth'), v.literal('tls_client_auth'));
3
+ //# sourceMappingURL=oauth-endpoint-auth-method.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-endpoint-auth-method.js","sourceRoot":"","sources":["../../lib/schemas/oauth-endpoint-auth-method.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CACnD,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAChC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAC9B,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAC/B,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAC5B,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC,EACxC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAC5B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as v from '@badrap/valita';
2
+ export declare const oauthGrantTypeSchema: v.UnionType<[v.Type<"authorization_code">, v.Type<"implicit">, v.Type<"refresh_token">, v.Type<"password">, v.Type<"client_credentials">, v.Type<"urn:ietf:params:oauth:grant-type:jwt-bearer">, v.Type<"urn:ietf:params:oauth:grant-type:saml2-bearer">]>;
3
+ export type OAuthGrantType = v.Infer<typeof oauthGrantTypeSchema>;
4
+ //# sourceMappingURL=oauth-grant-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-grant-type.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-grant-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,eAAO,MAAM,oBAAoB,4PAQhC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as v from '@badrap/valita';
2
+ export const oauthGrantTypeSchema = v.union(v.literal('authorization_code'), v.literal('implicit'), v.literal('refresh_token'), v.literal('password'), // not part of OAuth 2.1
3
+ v.literal('client_credentials'), v.literal('urn:ietf:params:oauth:grant-type:jwt-bearer'), v.literal('urn:ietf:params:oauth:grant-type:saml2-bearer'));
4
+ //# sourceMappingURL=oauth-grant-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-grant-type.js","sourceRoot":"","sources":["../../lib/schemas/oauth-grant-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAC1C,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAC/B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,EAC1B,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,wBAAwB;AAC/C,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAC/B,CAAC,CAAC,OAAO,CAAC,6CAA6C,CAAC,EACxD,CAAC,CAAC,OAAO,CAAC,+CAA+C,CAAC,CAC1D,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as v from '@badrap/valita';
2
+ export declare const oauthIssuerIdentifierSchema: v.Type<string>;
3
+ export type OAuthIssuerIdentifier = v.Infer<typeof oauthIssuerIdentifierSchema>;
4
+ //# sourceMappingURL=oauth-issuer-identifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-issuer-identifier.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-issuer-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAIpC,eAAO,MAAM,2BAA2B,gBAuBtC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import * as v from '@badrap/valita';
2
+ import { webUriSchema } from './uri.js';
3
+ export const oauthIssuerIdentifierSchema = webUriSchema.chain((input) => {
4
+ // validate the issuer (MIX-UP attacks)
5
+ if (input.endsWith('/')) {
6
+ return v.err(`issuer URL must not end with a slash`);
7
+ }
8
+ const url = new URL(input);
9
+ if (url.username || url.password) {
10
+ return v.err(`issuer URL must not contain a username or password`);
11
+ }
12
+ if (url.hash || url.search) {
13
+ return v.err(`issuer URL must not contain a query or fragment`);
14
+ }
15
+ const canonicalValue = url.pathname === '/' ? url.origin : url.href;
16
+ if (input !== canonicalValue) {
17
+ return v.err(`issuer URL must be in the canonical form`);
18
+ }
19
+ return v.ok(input);
20
+ });
21
+ //# sourceMappingURL=oauth-issuer-identifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-issuer-identifier.js","sourceRoot":"","sources":["../../lib/schemas/oauth-issuer-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC;IACxE,uCAAuC;IAEvC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAE3B,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QAClC,OAAO,CAAC,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;IACpE,CAAC;IAED,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC5B,OAAO,CAAC,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACpE,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QAC9B,OAAO,CAAC,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;AAAA,CACnB,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as v from '@badrap/valita';
2
+ export declare const oauthParResponseSchema: v.ObjectType<{
3
+ request_uri: v.Type<string>;
4
+ expires_in: v.Type<number>;
5
+ }, undefined>;
6
+ export type OAuthParResponse = v.Infer<typeof oauthParResponseSchema>;
7
+ //# sourceMappingURL=oauth-par-response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-par-response.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-par-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAIpC,eAAO,MAAM,sBAAsB;;;aAGjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as v from '@badrap/valita';
2
+ const isPositiveInteger = (n) => Number.isInteger(n) && n > 0;
3
+ export const oauthParResponseSchema = v.object({
4
+ request_uri: v.string(),
5
+ expires_in: v.number().assert(isPositiveInteger, `must be a positive integer`),
6
+ });
7
+ //# sourceMappingURL=oauth-par-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-par-response.js","sourceRoot":"","sources":["../../lib/schemas/oauth-par-response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,MAAM,iBAAiB,GAAG,CAAC,CAAS,EAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,iBAAiB,EAAE,4BAA4B,CAAC;CAC9E,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import * as v from '@badrap/valita';
2
+ /**
3
+ * OAuth prompt mode values.
4
+ *
5
+ * - `none`: only succeed if user already authorized this client on this device
6
+ * - `login`: force re-authentication
7
+ * - `consent`: force re-consent
8
+ * - `select_account`: force account selection
9
+ * - `create`: force user registration screen
10
+ */
11
+ export declare const oauthPromptSchema: v.UnionType<[v.Type<"none">, v.Type<"login">, v.Type<"consent">, v.Type<"select_account">, v.Type<"create">]>;
12
+ export type OAuthPrompt = v.Infer<typeof oauthPromptSchema>;
13
+ //# sourceMappingURL=oauth-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-prompt.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,+GAM7B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as v from '@badrap/valita';
2
+ /**
3
+ * OAuth prompt mode values.
4
+ *
5
+ * - `none`: only succeed if user already authorized this client on this device
6
+ * - `login`: force re-authentication
7
+ * - `consent`: force re-consent
8
+ * - `select_account`: force account selection
9
+ * - `create`: force user registration screen
10
+ */
11
+ export const oauthPromptSchema = v.union(v.literal('none'), v.literal('login'), v.literal('consent'), v.literal('select_account'), v.literal('create'));
12
+ //# sourceMappingURL=oauth-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-prompt.js","sourceRoot":"","sources":["../../lib/schemas/oauth-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CACvC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAClB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAC3B,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CACnB,CAAC"}
@@ -0,0 +1,66 @@
1
+ import * as v from '@badrap/valita';
2
+ export declare const oauthBearerMethodSchema: v.UnionType<[v.Type<"header">, v.Type<"body">, v.Type<"query">]>;
3
+ export type OAuthBearerMethod = v.Infer<typeof oauthBearerMethodSchema>;
4
+ /**
5
+ * @see {@link https://www.rfc-editor.org/rfc/rfc9728.html#section-3.2}
6
+ */
7
+ export declare const oauthProtectedResourceMetadataSchema: v.ObjectType<{
8
+ /**
9
+ * REQUIRED. the protected resource's resource identifier, which is a URL that
10
+ * uses the https scheme and has no query or fragment components.
11
+ */
12
+ resource: v.Type<string>;
13
+ /**
14
+ * OPTIONAL. JSON array containing a list of OAuth authorization server issuer
15
+ * identifiers, as defined in RFC8414, for authorization servers that can be
16
+ * used with this protected resource.
17
+ */
18
+ authorization_servers: v.Optional<string[]>;
19
+ /**
20
+ * OPTIONAL. URL of the protected resource's JWK Set document.
21
+ */
22
+ jwks_uri: v.Optional<string>;
23
+ /**
24
+ * RECOMMENDED. JSON array containing a list of the OAuth 2.0 scope values that
25
+ * are used in authorization requests to request access to this protected resource.
26
+ */
27
+ scopes_supported: v.Optional<string[]>;
28
+ /**
29
+ * OPTIONAL. JSON array containing a list of the supported methods of sending
30
+ * an OAuth 2.0 Bearer Token to the protected resource.
31
+ */
32
+ bearer_methods_supported: v.Optional<("body" | "header" | "query")[]>;
33
+ /**
34
+ * OPTIONAL. JSON array containing a list of the JWS signing algorithms
35
+ * supported by the protected resource for signing resource responses.
36
+ */
37
+ resource_signing_alg_values_supported: v.Optional<string[]>;
38
+ /**
39
+ * OPTIONAL. URL of a page containing human-readable information that
40
+ * developers might want or need to know when using the protected resource.
41
+ */
42
+ resource_documentation: v.Optional<string>;
43
+ /**
44
+ * OPTIONAL. URL that the protected resource provides to read about the
45
+ * protected resource's requirements on how the client can use the data.
46
+ */
47
+ resource_policy_uri: v.Optional<string>;
48
+ /**
49
+ * OPTIONAL. URL that the protected resource provides to read about the
50
+ * protected resource's terms of service.
51
+ */
52
+ resource_tos_uri: v.Optional<string>;
53
+ }, undefined>;
54
+ export declare const oauthProtectedResourceMetadataValidator: v.Type<{
55
+ resource: string;
56
+ authorization_servers?: string[] | undefined;
57
+ jwks_uri?: string | undefined;
58
+ scopes_supported?: string[] | undefined;
59
+ bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
60
+ resource_signing_alg_values_supported?: string[] | undefined;
61
+ resource_documentation?: string | undefined;
62
+ resource_policy_uri?: string | undefined;
63
+ resource_tos_uri?: string | undefined;
64
+ }>;
65
+ export type OAuthProtectedResourceMetadata = v.Infer<typeof oauthProtectedResourceMetadataSchema>;
66
+ //# sourceMappingURL=oauth-protected-resource-metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-protected-resource-metadata.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAKpC,eAAO,MAAM,uBAAuB,kEAAsE,CAAC;AAE3G,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,oCAAoC;IAChD;;;OAGG;;IAGH;;;;OAIG;;IAGH;;OAEG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;IAGH;;;OAGG;;aAEF,CAAC;AAEH,eAAO,MAAM,uCAAuC;;;;;;;;;;EAkBlD,CAAC;AAEH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC"}
@@ -0,0 +1,71 @@
1
+ import * as v from '@badrap/valita';
2
+ import { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js';
3
+ import { webUriSchema } from './uri.js';
4
+ export const oauthBearerMethodSchema = v.union(v.literal('header'), v.literal('body'), v.literal('query'));
5
+ /**
6
+ * @see {@link https://www.rfc-editor.org/rfc/rfc9728.html#section-3.2}
7
+ */
8
+ export const oauthProtectedResourceMetadataSchema = v.object({
9
+ /**
10
+ * REQUIRED. the protected resource's resource identifier, which is a URL that
11
+ * uses the https scheme and has no query or fragment components.
12
+ */
13
+ resource: webUriSchema,
14
+ /**
15
+ * OPTIONAL. JSON array containing a list of OAuth authorization server issuer
16
+ * identifiers, as defined in RFC8414, for authorization servers that can be
17
+ * used with this protected resource.
18
+ */
19
+ authorization_servers: v.array(oauthIssuerIdentifierSchema).optional(),
20
+ /**
21
+ * OPTIONAL. URL of the protected resource's JWK Set document.
22
+ */
23
+ jwks_uri: webUriSchema.optional(),
24
+ /**
25
+ * RECOMMENDED. JSON array containing a list of the OAuth 2.0 scope values that
26
+ * are used in authorization requests to request access to this protected resource.
27
+ */
28
+ scopes_supported: v.array(v.string()).optional(),
29
+ /**
30
+ * OPTIONAL. JSON array containing a list of the supported methods of sending
31
+ * an OAuth 2.0 Bearer Token to the protected resource.
32
+ */
33
+ bearer_methods_supported: v.array(oauthBearerMethodSchema).optional(),
34
+ /**
35
+ * OPTIONAL. JSON array containing a list of the JWS signing algorithms
36
+ * supported by the protected resource for signing resource responses.
37
+ */
38
+ resource_signing_alg_values_supported: v.array(v.string()).optional(),
39
+ /**
40
+ * OPTIONAL. URL of a page containing human-readable information that
41
+ * developers might want or need to know when using the protected resource.
42
+ */
43
+ resource_documentation: webUriSchema.optional(),
44
+ /**
45
+ * OPTIONAL. URL that the protected resource provides to read about the
46
+ * protected resource's requirements on how the client can use the data.
47
+ */
48
+ resource_policy_uri: webUriSchema.optional(),
49
+ /**
50
+ * OPTIONAL. URL that the protected resource provides to read about the
51
+ * protected resource's terms of service.
52
+ */
53
+ resource_tos_uri: webUriSchema.optional(),
54
+ });
55
+ export const oauthProtectedResourceMetadataValidator = oauthProtectedResourceMetadataSchema.chain((data) => {
56
+ const url = new URL(data.resource);
57
+ if (url.search) {
58
+ return v.err({
59
+ message: `resource URL must not contain query parameters`,
60
+ path: ['resource'],
61
+ });
62
+ }
63
+ if (url.hash) {
64
+ return v.err({
65
+ message: `resource URL must not contain a fragment`,
66
+ path: ['resource'],
67
+ });
68
+ }
69
+ return v.ok(data);
70
+ });
71
+ //# sourceMappingURL=oauth-protected-resource-metadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-protected-resource-metadata.js","sourceRoot":"","sources":["../../lib/schemas/oauth-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;AAI3G;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5D;;;OAGG;IACH,QAAQ,EAAE,YAAY;IAEtB;;;;OAIG;IACH,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE;IAEtE;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE;IAEjC;;;OAGG;IACH,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAEhD;;;OAGG;IACH,wBAAwB,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE;IAErE;;;OAGG;IACH,qCAAqC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAErE;;;OAGG;IACH,sBAAsB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAE/C;;;OAGG;IACH,mBAAmB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAE5C;;;OAGG;IACH,gBAAgB,EAAE,YAAY,CAAC,QAAQ,EAAE;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uCAAuC,GAAG,oCAAoC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC3G,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEnC,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,CAAC,CAAC,GAAG,CAAC;YACZ,OAAO,EAAE,gDAAgD;YACzD,IAAI,EAAE,CAAC,UAAU,CAAC;SAClB,CAAC,CAAC;IACJ,CAAC;IAED,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC;QACd,OAAO,CAAC,CAAC,GAAG,CAAC;YACZ,OAAO,EAAE,0CAA0C;YACnD,IAAI,EAAE,CAAC,UAAU,CAAC;SAClB,CAAC,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAAA,CAClB,CAAC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import * as v from '@badrap/valita';
2
+ /**
3
+ * this is a loopback URI with the additional restriction that the hostname
4
+ * `localhost` is not allowed.
5
+ *
6
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc8252#section-8.3 Loopback Redirect Considerations} RFC8252
7
+ *
8
+ * > While redirect URIs using localhost (i.e.,
9
+ * > "http://localhost:{port}/{path}") function similarly to loopback IP
10
+ * > redirects described in Section 7.3, the use of localhost is NOT
11
+ * > RECOMMENDED. Specifying a redirect URI with the loopback IP literal rather
12
+ * > than localhost avoids inadvertently listening on network interfaces other
13
+ * > than the loopback interface. It is also less susceptible to client-side
14
+ * > firewalls and misconfigured host name resolution on the user's device.
15
+ */
16
+ export declare const loopbackRedirectUriSchema: v.Type<string>;
17
+ export type LoopbackRedirectUri = v.Infer<typeof loopbackRedirectUriSchema>;
18
+ export declare const oauthRedirectUriSchema: v.Type<string>;
19
+ export type OAuthRedirectUri = v.Infer<typeof oauthRedirectUriSchema>;
20
+ //# sourceMappingURL=oauth-redirect-uri.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth-redirect-uri.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-redirect-uri.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAIpC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,gBAOpC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,eAAO,MAAM,sBAAsB,gBAUjC,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import * as v from '@badrap/valita';
2
+ import { httpsUriSchema, loopbackUriSchema, privateUseUriSchema } from './uri.js';
3
+ /**
4
+ * this is a loopback URI with the additional restriction that the hostname
5
+ * `localhost` is not allowed.
6
+ *
7
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc8252#section-8.3 Loopback Redirect Considerations} RFC8252
8
+ *
9
+ * > While redirect URIs using localhost (i.e.,
10
+ * > "http://localhost:{port}/{path}") function similarly to loopback IP
11
+ * > redirects described in Section 7.3, the use of localhost is NOT
12
+ * > RECOMMENDED. Specifying a redirect URI with the loopback IP literal rather
13
+ * > than localhost avoids inadvertently listening on network interfaces other
14
+ * > than the loopback interface. It is also less susceptible to client-side
15
+ * > firewalls and misconfigured host name resolution on the user's device.
16
+ */
17
+ export const loopbackRedirectUriSchema = loopbackUriSchema.chain((input) => {
18
+ if (input.startsWith('http://localhost')) {
19
+ return v.err(`use of "localhost" hostname is not allowed (RFC 8252), use a loopback IP such as "127.0.0.1" instead`);
20
+ }
21
+ return v.ok(input);
22
+ });
23
+ export const oauthRedirectUriSchema = v.string().chain((input, options) => {
24
+ if (input.startsWith('http://')) {
25
+ return loopbackRedirectUriSchema.try(input, options);
26
+ }
27
+ if (input.startsWith('https://')) {
28
+ return httpsUriSchema.try(input, options);
29
+ }
30
+ return privateUseUriSchema.try(input, options);
31
+ });
32
+ //# sourceMappingURL=oauth-redirect-uri.js.map