@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.
- package/CHANGELOG.md +18 -0
- package/dist/atproto-loopback-client-id.js +17 -21
- package/dist/atproto-loopback-client-id.js.map +1 -1
- package/dist/atproto-loopback-client-metadata.js +6 -10
- package/dist/atproto-loopback-client-metadata.js.map +1 -1
- package/dist/atproto-loopback-client-redirect-uris.js +1 -4
- package/dist/atproto-loopback-client-redirect-uris.js.map +1 -1
- package/dist/atproto-oauth-scope.js +11 -17
- package/dist/atproto-oauth-scope.js.map +1 -1
- package/dist/atproto-oauth-token-response.d.ts +3 -3
- package/dist/atproto-oauth-token-response.js +9 -12
- package/dist/atproto-oauth-token-response.js.map +1 -1
- package/dist/constants.js +1 -4
- package/dist/constants.js.map +1 -1
- package/dist/index.js +49 -65
- package/dist/index.js.map +1 -1
- package/dist/oauth-access-token.js +2 -5
- package/dist/oauth-access-token.js.map +1 -1
- package/dist/oauth-authorization-code-grant-token-request.js +7 -10
- package/dist/oauth-authorization-code-grant-token-request.js.map +1 -1
- package/dist/oauth-authorization-details.js +10 -13
- package/dist/oauth-authorization-details.js.map +1 -1
- package/dist/oauth-authorization-request-jar.js +4 -7
- package/dist/oauth-authorization-request-jar.js.map +1 -1
- package/dist/oauth-authorization-request-par.js +6 -9
- package/dist/oauth-authorization-request-par.js.map +1 -1
- package/dist/oauth-authorization-request-parameters.js +35 -38
- package/dist/oauth-authorization-request-parameters.js.map +1 -1
- package/dist/oauth-authorization-request-query.js +11 -14
- package/dist/oauth-authorization-request-query.js.map +1 -1
- package/dist/oauth-authorization-request-uri.js +4 -7
- package/dist/oauth-authorization-request-uri.js.map +1 -1
- package/dist/oauth-authorization-response-error.js +2 -5
- package/dist/oauth-authorization-response-error.js.map +1 -1
- package/dist/oauth-authorization-server-metadata.js +52 -55
- package/dist/oauth-authorization-server-metadata.js.map +1 -1
- package/dist/oauth-client-credentials-grant-token-request.js +3 -6
- package/dist/oauth-client-credentials-grant-token-request.js.map +1 -1
- package/dist/oauth-client-credentials.js +17 -20
- package/dist/oauth-client-credentials.js.map +1 -1
- package/dist/oauth-client-id-discoverable.js +26 -33
- package/dist/oauth-client-id-discoverable.js.map +1 -1
- package/dist/oauth-client-id-loopback.js +20 -29
- package/dist/oauth-client-id-loopback.js.map +1 -1
- package/dist/oauth-client-id.js +2 -5
- package/dist/oauth-client-id.js.map +1 -1
- package/dist/oauth-client-metadata.d.ts.map +1 -1
- package/dist/oauth-client-metadata.js +41 -44
- package/dist/oauth-client-metadata.js.map +1 -1
- package/dist/oauth-code-challenge-method.js +2 -5
- package/dist/oauth-code-challenge-method.js.map +1 -1
- package/dist/oauth-endpoint-auth-method.js +2 -5
- package/dist/oauth-endpoint-auth-method.js.map +1 -1
- package/dist/oauth-endpoint-name.js +1 -4
- package/dist/oauth-endpoint-name.js.map +1 -1
- package/dist/oauth-grant-type.js +2 -5
- package/dist/oauth-grant-type.js.map +1 -1
- package/dist/oauth-introspection-response.js +1 -2
- package/dist/oauth-issuer-identifier.js +7 -10
- package/dist/oauth-issuer-identifier.js.map +1 -1
- package/dist/oauth-par-response.js +4 -7
- package/dist/oauth-par-response.js.map +1 -1
- package/dist/oauth-password-grant-token-request.js +5 -8
- package/dist/oauth-password-grant-token-request.js.map +1 -1
- package/dist/oauth-prompt-mode.js +2 -5
- package/dist/oauth-prompt-mode.js.map +1 -1
- package/dist/oauth-protected-resource-metadata.js +14 -17
- package/dist/oauth-protected-resource-metadata.js.map +1 -1
- package/dist/oauth-redirect-uri.js +10 -13
- package/dist/oauth-redirect-uri.js.map +1 -1
- package/dist/oauth-refresh-token-grant-token-request.js +5 -8
- package/dist/oauth-refresh-token-grant-token-request.js.map +1 -1
- package/dist/oauth-refresh-token.js +2 -5
- package/dist/oauth-refresh-token.js.map +1 -1
- package/dist/oauth-request-uri.js +2 -5
- package/dist/oauth-request-uri.js.map +1 -1
- package/dist/oauth-response-mode.js +2 -5
- package/dist/oauth-response-mode.js.map +1 -1
- package/dist/oauth-response-type.js +2 -5
- package/dist/oauth-response-type.js.map +1 -1
- package/dist/oauth-scope.js +4 -8
- package/dist/oauth-scope.js.map +1 -1
- package/dist/oauth-token-identification.js +6 -9
- package/dist/oauth-token-identification.js.map +1 -1
- package/dist/oauth-token-request.js +10 -13
- package/dist/oauth-token-request.js.map +1 -1
- package/dist/oauth-token-response.js +12 -15
- package/dist/oauth-token-response.js.map +1 -1
- package/dist/oauth-token-type.js +4 -7
- package/dist/oauth-token-type.js.map +1 -1
- package/dist/oidc-authorization-error-response.js +2 -5
- package/dist/oidc-authorization-error-response.js.map +1 -1
- package/dist/oidc-claims-parameter.js +2 -5
- package/dist/oidc-claims-parameter.js.map +1 -1
- package/dist/oidc-claims-properties.js +5 -8
- package/dist/oidc-claims-properties.js.map +1 -1
- package/dist/oidc-entity-type.js +2 -5
- package/dist/oidc-entity-type.js.map +1 -1
- package/dist/oidc-userinfo.js +10 -13
- package/dist/oidc-userinfo.js.map +1 -1
- package/dist/uri.js +25 -28
- package/dist/uri.js.map +1 -1
- package/dist/util.js +12 -26
- package/dist/util.js.map +1 -1
- package/package.json +8 -7
- package/src/atproto-oauth-token-response.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const uri_js_1 = require("./uri.js");
|
|
6
|
-
exports.oauthIssuerIdentifierSchema = uri_js_1.webUriSchema.superRefine((value, ctx) => {
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { webUriSchema } from './uri.js';
|
|
3
|
+
export const oauthIssuerIdentifierSchema = webUriSchema.superRefine((value, ctx) => {
|
|
7
4
|
// Validate the issuer (MIX-UP attacks)
|
|
8
5
|
if (value.endsWith('/')) {
|
|
9
6
|
ctx.addIssue({
|
|
10
|
-
code:
|
|
7
|
+
code: z.ZodIssueCode.custom,
|
|
11
8
|
message: 'Issuer URL must not end with a slash',
|
|
12
9
|
});
|
|
13
10
|
return false;
|
|
@@ -15,14 +12,14 @@ exports.oauthIssuerIdentifierSchema = uri_js_1.webUriSchema.superRefine((value,
|
|
|
15
12
|
const url = new URL(value);
|
|
16
13
|
if (url.username || url.password) {
|
|
17
14
|
ctx.addIssue({
|
|
18
|
-
code:
|
|
15
|
+
code: z.ZodIssueCode.custom,
|
|
19
16
|
message: 'Issuer URL must not contain a username or password',
|
|
20
17
|
});
|
|
21
18
|
return false;
|
|
22
19
|
}
|
|
23
20
|
if (url.hash || url.search) {
|
|
24
21
|
ctx.addIssue({
|
|
25
|
-
code:
|
|
22
|
+
code: z.ZodIssueCode.custom,
|
|
26
23
|
message: 'Issuer URL must not contain a query or fragment',
|
|
27
24
|
});
|
|
28
25
|
return false;
|
|
@@ -30,7 +27,7 @@ exports.oauthIssuerIdentifierSchema = uri_js_1.webUriSchema.superRefine((value,
|
|
|
30
27
|
const canonicalValue = url.pathname === '/' ? url.origin : url.href;
|
|
31
28
|
if (value !== canonicalValue) {
|
|
32
29
|
ctx.addIssue({
|
|
33
|
-
code:
|
|
30
|
+
code: z.ZodIssueCode.custom,
|
|
34
31
|
message: 'Issuer URL must be in the canonical form',
|
|
35
32
|
});
|
|
36
33
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-issuer-identifier.js","sourceRoot":"","sources":["../src/oauth-issuer-identifier.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-issuer-identifier.js","sourceRoot":"","sources":["../src/oauth-issuer-identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,MAAM,CAAC,MAAM,2BAA2B,GAAG,YAAY,CAAC,WAAW,CACjE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,uCAAuC;IAEvC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,sCAAsC;SAChD,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAE1B,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAC;QACjC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,oDAAoD;SAC9D,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QAC3B,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,iDAAiD;SAC3D,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;IAED,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAA;IACnE,IAAI,KAAK,KAAK,cAAc,EAAE,CAAC;QAC7B,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,0CAA0C;SACpD,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CACF,CAAA","sourcesContent":["import { z } from 'zod'\nimport { webUriSchema } from './uri.js'\n\nexport const oauthIssuerIdentifierSchema = webUriSchema.superRefine(\n (value, ctx) => {\n // Validate the issuer (MIX-UP attacks)\n\n if (value.endsWith('/')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Issuer URL must not end with a slash',\n })\n return false\n }\n\n const url = new URL(value)\n\n if (url.username || url.password) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Issuer URL must not contain a username or password',\n })\n return false\n }\n\n if (url.hash || url.search) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Issuer URL must not contain a query or fragment',\n })\n return false\n }\n\n const canonicalValue = url.pathname === '/' ? url.origin : url.href\n if (value !== canonicalValue) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Issuer URL must be in the canonical form',\n })\n return false\n }\n\n return true\n },\n)\n\nexport type OAuthIssuerIdentifier = z.infer<typeof oauthIssuerIdentifierSchema>\n"]}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.oauthParResponseSchema = zod_1.z.object({
|
|
6
|
-
request_uri: zod_1.z.string(),
|
|
7
|
-
expires_in: zod_1.z.number().int().positive(),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthParResponseSchema = z.object({
|
|
3
|
+
request_uri: z.string(),
|
|
4
|
+
expires_in: z.number().int().positive(),
|
|
8
5
|
});
|
|
9
6
|
//# sourceMappingURL=oauth-par-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-par-response.js","sourceRoot":"","sources":["../src/oauth-par-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-par-response.js","sourceRoot":"","sources":["../src/oauth-par-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACxC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthParResponseSchema = z.object({\n request_uri: z.string(),\n expires_in: z.number().int().positive(),\n})\n\nexport type OAuthParResponse = z.infer<typeof oauthParResponseSchema>\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
grant_type: zod_1.z.literal('password'),
|
|
7
|
-
username: zod_1.z.string(),
|
|
8
|
-
password: zod_1.z.string(),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthPasswordGrantTokenRequestSchema = z.object({
|
|
3
|
+
grant_type: z.literal('password'),
|
|
4
|
+
username: z.string(),
|
|
5
|
+
password: z.string(),
|
|
9
6
|
});
|
|
10
7
|
//# sourceMappingURL=oauth-password-grant-token-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-password-grant-token-request.js","sourceRoot":"","sources":["../src/oauth-password-grant-token-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-password-grant-token-request.js","sourceRoot":"","sources":["../src/oauth-password-grant-token-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IACjC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;CACrB,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthPasswordGrantTokenRequestSchema = z.object({\n grant_type: z.literal('password'),\n username: z.string(),\n password: z.string(),\n})\n\nexport type OAuthPasswordGrantTokenRequest = z.infer<\n typeof oauthPasswordGrantTokenRequestSchema\n>\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oauthPromptModeSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
1
|
+
import { z } from 'zod';
|
|
5
2
|
/**
|
|
6
3
|
* - "none" will only be allowed if the user already allowed the client on the same device
|
|
7
4
|
* - "login" will force the user to login again, unless he very recently logged in
|
|
@@ -9,7 +6,7 @@ const zod_1 = require("zod");
|
|
|
9
6
|
* - "select_account" will force the user to select an account
|
|
10
7
|
* - "create" will force the user registration screen
|
|
11
8
|
*/
|
|
12
|
-
|
|
9
|
+
export const oauthPromptModeSchema = z.enum([
|
|
13
10
|
'none',
|
|
14
11
|
'login',
|
|
15
12
|
'consent',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-prompt-mode.js","sourceRoot":"","sources":["../src/oauth-prompt-mode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-prompt-mode.js","sourceRoot":"","sources":["../src/oauth-prompt-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC1C,MAAM;IACN,OAAO;IACP,SAAS;IACT,gBAAgB;IAChB,QAAQ;CACT,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\n/**\n * - \"none\" will only be allowed if the user already allowed the client on the same device\n * - \"login\" will force the user to login again, unless he very recently logged in\n * - \"consent\" will force the user to consent again\n * - \"select_account\" will force the user to select an account\n * - \"create\" will force the user registration screen\n */\nexport const oauthPromptModeSchema = z.enum([\n 'none',\n 'login',\n 'consent',\n 'select_account',\n 'create',\n])\n\nexport type OAuthPromptMode = z.infer<typeof oauthPromptModeSchema>\n"]}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const oauth_issuer_identifier_js_1 = require("./oauth-issuer-identifier.js");
|
|
6
|
-
const uri_js_1 = require("./uri.js");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js';
|
|
3
|
+
import { webUriSchema } from './uri.js';
|
|
7
4
|
/**
|
|
8
5
|
* @see {@link https://www.rfc-editor.org/rfc/rfc9728.html#section-3.2}
|
|
9
6
|
*/
|
|
10
|
-
|
|
7
|
+
export const oauthProtectedResourceMetadataSchema = z.object({
|
|
11
8
|
/**
|
|
12
9
|
* REQUIRED. The protected resource's resource identifier, which is a URL that
|
|
13
10
|
* uses the https scheme and has no query or fragment components. Using these
|
|
@@ -16,7 +13,7 @@ exports.oauthProtectedResourceMetadataSchema = zod_1.z.object({
|
|
|
16
13
|
* @note This schema allows non https URLs for testing & development purposes.
|
|
17
14
|
* Make sure to validate the URL before using it in a production environment.
|
|
18
15
|
*/
|
|
19
|
-
resource:
|
|
16
|
+
resource: webUriSchema
|
|
20
17
|
.refine((url) => !url.includes('?'), {
|
|
21
18
|
message: 'Resource URL must not contain query parameters',
|
|
22
19
|
})
|
|
@@ -31,7 +28,7 @@ exports.oauthProtectedResourceMetadataSchema = zod_1.z.object({
|
|
|
31
28
|
* used. In some use cases, the set of authorization servers will not be
|
|
32
29
|
* enumerable, in which case this metadata parameter would not be used.
|
|
33
30
|
*/
|
|
34
|
-
authorization_servers:
|
|
31
|
+
authorization_servers: z.array(oauthIssuerIdentifierSchema).optional(),
|
|
35
32
|
/**
|
|
36
33
|
* OPTIONAL. URL of the protected resource's JWK Set [JWK] document. This
|
|
37
34
|
* contains public keys belonging to the protected resource, such as signing
|
|
@@ -40,22 +37,22 @@ exports.oauthProtectedResourceMetadataSchema = zod_1.z.object({
|
|
|
40
37
|
* available, a use (public key use) parameter value is REQUIRED for all keys
|
|
41
38
|
* in the referenced JWK Set to indicate each key's intended usage.
|
|
42
39
|
*/
|
|
43
|
-
jwks_uri:
|
|
40
|
+
jwks_uri: webUriSchema.optional(),
|
|
44
41
|
/**
|
|
45
42
|
* RECOMMENDED. JSON array containing a list of the OAuth 2.0 [RFC6749] scope
|
|
46
43
|
* values that are used in authorization requests to request access to this
|
|
47
44
|
* protected resource. Protected resources MAY choose not to advertise some
|
|
48
45
|
* scope values supported even when this parameter is used.
|
|
49
46
|
*/
|
|
50
|
-
scopes_supported:
|
|
47
|
+
scopes_supported: z.array(z.string()).optional(),
|
|
51
48
|
/**
|
|
52
49
|
* OPTIONAL. JSON array containing a list of the supported methods of sending
|
|
53
50
|
* an OAuth 2.0 Bearer Token [RFC6750] to the protected resource. Defined
|
|
54
51
|
* values are ["header", "body", "query"], corresponding to Sections 2.1, 2.2,
|
|
55
52
|
* and 2.3 of RFC 6750.
|
|
56
53
|
*/
|
|
57
|
-
bearer_methods_supported:
|
|
58
|
-
.array(
|
|
54
|
+
bearer_methods_supported: z
|
|
55
|
+
.array(z.enum(['header', 'body', 'query']))
|
|
59
56
|
.optional(),
|
|
60
57
|
/**
|
|
61
58
|
* OPTIONAL. JSON array containing a list of the JWS [JWS] signing algorithms
|
|
@@ -64,22 +61,22 @@ exports.oauthProtectedResourceMetadataSchema = zod_1.z.object({
|
|
|
64
61
|
* algorithms are implied if this entry is omitted. The value none MUST NOT be
|
|
65
62
|
* used.
|
|
66
63
|
*/
|
|
67
|
-
resource_signing_alg_values_supported:
|
|
64
|
+
resource_signing_alg_values_supported: z.array(z.string()).optional(),
|
|
68
65
|
/**
|
|
69
66
|
* OPTIONAL. URL of a page containing human-readable information that
|
|
70
67
|
* developers might want or need to know when using the protected resource
|
|
71
68
|
*/
|
|
72
|
-
resource_documentation:
|
|
69
|
+
resource_documentation: webUriSchema.optional(),
|
|
73
70
|
/**
|
|
74
71
|
* OPTIONAL. URL that the protected resource provides to read about the
|
|
75
72
|
* protected resource's requirements on how the client can use the data
|
|
76
73
|
* provided by the protected resource
|
|
77
74
|
*/
|
|
78
|
-
resource_policy_uri:
|
|
75
|
+
resource_policy_uri: webUriSchema.optional(),
|
|
79
76
|
/**
|
|
80
77
|
* OPTIONAL. URL that the protected resource provides to read about the
|
|
81
78
|
* protected resource's terms of service
|
|
82
79
|
*/
|
|
83
|
-
resource_tos_uri:
|
|
80
|
+
resource_tos_uri: webUriSchema.optional(),
|
|
84
81
|
});
|
|
85
82
|
//# sourceMappingURL=oauth-protected-resource-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-protected-resource-metadata.js","sourceRoot":"","sources":["../src/oauth-protected-resource-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-protected-resource-metadata.js","sourceRoot":"","sources":["../src/oauth-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAA;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3D;;;;;;;OAOG;IACH,QAAQ,EAAE,YAAY;SACnB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACnC,OAAO,EAAE,gDAAgD;KAC1D,CAAC;SACD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QACnC,OAAO,EAAE,0CAA0C;KACpD,CAAC;IAEJ;;;;;;;OAOG;IACH,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,QAAQ,EAAE;IAEtE;;;;;;;OAOG;IACH,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE;IAEjC;;;;;OAKG;IACH,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAEhD;;;;;OAKG;IACH,wBAAwB,EAAE,CAAC;SACxB,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;SAC1C,QAAQ,EAAE;IAEb;;;;;;OAMG;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;;;;OAIG;IACH,mBAAmB,EAAE,YAAY,CAAC,QAAQ,EAAE;IAE5C;;;OAGG;IACH,gBAAgB,EAAE,YAAY,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthIssuerIdentifierSchema } from './oauth-issuer-identifier.js'\nimport { webUriSchema } from './uri.js'\n\n/**\n * @see {@link https://www.rfc-editor.org/rfc/rfc9728.html#section-3.2}\n */\nexport const oauthProtectedResourceMetadataSchema = z.object({\n /**\n * REQUIRED. The protected resource's resource identifier, which is a URL that\n * uses the https scheme and has no query or fragment components. Using these\n * well-known resources is described in Section 3.\n *\n * @note This schema allows non https URLs for testing & development purposes.\n * Make sure to validate the URL before using it in a production environment.\n */\n resource: webUriSchema\n .refine((url) => !url.includes('?'), {\n message: 'Resource URL must not contain query parameters',\n })\n .refine((url) => !url.includes('#'), {\n message: 'Resource URL must not contain a fragment',\n }),\n\n /**\n * OPTIONAL. JSON array containing a list of OAuth authorization server issuer\n * identifiers, as defined in [RFC8414], for authorization servers that can be\n * used with this protected resource. Protected resources MAY choose not to\n * advertise some supported authorization servers even when this parameter is\n * used. In some use cases, the set of authorization servers will not be\n * enumerable, in which case this metadata parameter would not be used.\n */\n authorization_servers: z.array(oauthIssuerIdentifierSchema).optional(),\n\n /**\n * OPTIONAL. URL of the protected resource's JWK Set [JWK] document. This\n * contains public keys belonging to the protected resource, such as signing\n * key(s) that the resource server uses to sign resource responses. This URL\n * MUST use the https scheme. When both signing and encryption keys are made\n * available, a use (public key use) parameter value is REQUIRED for all keys\n * in the referenced JWK Set to indicate each key's intended usage.\n */\n jwks_uri: webUriSchema.optional(),\n\n /**\n * RECOMMENDED. JSON array containing a list of the OAuth 2.0 [RFC6749] scope\n * values that are used in authorization requests to request access to this\n * protected resource. Protected resources MAY choose not to advertise some\n * scope values supported even when this parameter is used.\n */\n scopes_supported: z.array(z.string()).optional(),\n\n /**\n * OPTIONAL. JSON array containing a list of the supported methods of sending\n * an OAuth 2.0 Bearer Token [RFC6750] to the protected resource. Defined\n * values are [\"header\", \"body\", \"query\"], corresponding to Sections 2.1, 2.2,\n * and 2.3 of RFC 6750.\n */\n bearer_methods_supported: z\n .array(z.enum(['header', 'body', 'query']))\n .optional(),\n\n /**\n * OPTIONAL. JSON array containing a list of the JWS [JWS] signing algorithms\n * (alg values) [JWA] supported by the protected resource for signing resource\n * responses, for instance, as described in [FAPI.MessageSigning]. No default\n * algorithms are implied if this entry is omitted. The value none MUST NOT be\n * used.\n */\n resource_signing_alg_values_supported: z.array(z.string()).optional(),\n\n /**\n * OPTIONAL. URL of a page containing human-readable information that\n * developers might want or need to know when using the protected resource\n */\n resource_documentation: webUriSchema.optional(),\n\n /**\n * OPTIONAL. URL that the protected resource provides to read about the\n * protected resource's requirements on how the client can use the data\n * provided by the protected resource\n */\n resource_policy_uri: webUriSchema.optional(),\n\n /**\n * OPTIONAL. URL that the protected resource provides to read about the\n * protected resource's terms of service\n */\n resource_tos_uri: webUriSchema.optional(),\n})\n\nexport type OAuthProtectedResourceMetadata = z.infer<\n typeof oauthProtectedResourceMetadataSchema\n>\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthRedirectUriSchema = exports.oauthLoopbackClientRedirectUriSchema = exports.loopbackRedirectURISchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const uri_js_1 = require("./uri.js");
|
|
1
|
+
import { ZodIssueCode, z } from 'zod';
|
|
2
|
+
import { httpsUriSchema, loopbackUriSchema, privateUseUriSchema, } from './uri.js';
|
|
6
3
|
/**
|
|
7
4
|
* This is a {@link loopbackUriSchema} with the additional restriction that
|
|
8
5
|
* the hostname `localhost` is not allowed.
|
|
@@ -17,41 +14,41 @@ const uri_js_1 = require("./uri.js");
|
|
|
17
14
|
* > than the loopback interface. It is also less susceptible to client-side
|
|
18
15
|
* > firewalls and misconfigured host name resolution on the user's device.
|
|
19
16
|
*/
|
|
20
|
-
|
|
17
|
+
export const loopbackRedirectURISchema = loopbackUriSchema.superRefine((value, ctx) => {
|
|
21
18
|
if (value.startsWith('http://localhost')) {
|
|
22
19
|
ctx.addIssue({
|
|
23
|
-
code:
|
|
20
|
+
code: ZodIssueCode.custom,
|
|
24
21
|
message: 'Use of "localhost" hostname is not allowed (RFC 8252), use a loopback IP such as "127.0.0.1" instead',
|
|
25
22
|
});
|
|
26
23
|
return false;
|
|
27
24
|
}
|
|
28
25
|
return true;
|
|
29
26
|
});
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
export const oauthLoopbackClientRedirectUriSchema = loopbackRedirectURISchema;
|
|
28
|
+
export const oauthRedirectUriSchema = z
|
|
32
29
|
.string()
|
|
33
30
|
.superRefine((value, ctx) => {
|
|
34
31
|
if (value.startsWith('https:')) {
|
|
35
|
-
const result =
|
|
32
|
+
const result = httpsUriSchema.safeParse(value);
|
|
36
33
|
if (!result.success)
|
|
37
34
|
result.error.issues.forEach(ctx.addIssue, ctx);
|
|
38
35
|
return result.success;
|
|
39
36
|
}
|
|
40
37
|
else if (value.startsWith('http:')) {
|
|
41
|
-
const result =
|
|
38
|
+
const result = loopbackRedirectURISchema.safeParse(value);
|
|
42
39
|
if (!result.success)
|
|
43
40
|
result.error.issues.forEach(ctx.addIssue, ctx);
|
|
44
41
|
return result.success;
|
|
45
42
|
}
|
|
46
43
|
else if (/^[^.:]+(?:\.[^.:]+)+:/.test(value)) {
|
|
47
|
-
const result =
|
|
44
|
+
const result = privateUseUriSchema.safeParse(value);
|
|
48
45
|
if (!result.success)
|
|
49
46
|
result.error.issues.forEach(ctx.addIssue, ctx);
|
|
50
47
|
return result.success;
|
|
51
48
|
}
|
|
52
49
|
else {
|
|
53
50
|
ctx.addIssue({
|
|
54
|
-
code:
|
|
51
|
+
code: ZodIssueCode.custom,
|
|
55
52
|
message: 'URL must use the "https:" or "http:" protocol, or a private-use URI scheme (RFC 8252)',
|
|
56
53
|
});
|
|
57
54
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-redirect-uri.js","sourceRoot":"","sources":["../src/oauth-redirect-uri.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-redirect-uri.js","sourceRoot":"","sources":["../src/oauth-redirect-uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC7C,OAAO,EAIL,cAAc,EACd,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AAEjB;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,WAAW,CACpE,CAAC,KAAK,EAAE,GAAG,EAA8D,EAAE;IACzE,IAAI,KAAK,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,YAAY,CAAC,MAAM;YACzB,OAAO,EACL,sGAAsG;SACzG,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC,CACF,CAAA;AAGD,MAAM,CAAC,MAAM,oCAAoC,GAAG,yBAAyB,CAAA;AAK7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC;KACpC,MAAM,EAAE;KACR,WAAW,CACV,CAAC,KAAK,EAAE,GAAG,EAA2D,EAAE;IACtE,IAAI,KAAK,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAC9C,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;QACnE,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;SAAM,IAAI,KAAK,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,yBAAyB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACzD,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;QACnE,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;SAAM,IAAI,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC/C,MAAM,MAAM,GAAG,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QACnD,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;QACnE,OAAO,MAAM,CAAC,OAAO,CAAA;IACvB,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,YAAY,CAAC,MAAM;YACzB,OAAO,EACL,uFAAuF;SAC1F,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC,CACF,CAAA","sourcesContent":["import { TypeOf, ZodIssueCode, z } from 'zod'\nimport {\n HttpsUri,\n LoopbackUri,\n PrivateUseUri,\n httpsUriSchema,\n loopbackUriSchema,\n privateUseUriSchema,\n} from './uri.js'\n\n/**\n * This is a {@link loopbackUriSchema} with the additional restriction that\n * the hostname `localhost` is not allowed.\n *\n * @see {@link https://datatracker.ietf.org/doc/html/rfc8252#section-8.3 Loopback Redirect Considerations} RFC8252\n *\n * > While redirect URIs using localhost (i.e.,\n * > \"http://localhost:{port}/{path}\") function similarly to loopback IP\n * > redirects described in Section 7.3, the use of localhost is NOT\n * > RECOMMENDED. Specifying a redirect URI with the loopback IP literal rather\n * > than localhost avoids inadvertently listening on network interfaces other\n * > than the loopback interface. It is also less susceptible to client-side\n * > firewalls and misconfigured host name resolution on the user's device.\n */\nexport const loopbackRedirectURISchema = loopbackUriSchema.superRefine(\n (value, ctx): value is Exclude<LoopbackUri, `http://localhost${string}`> => {\n if (value.startsWith('http://localhost')) {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message:\n 'Use of \"localhost\" hostname is not allowed (RFC 8252), use a loopback IP such as \"127.0.0.1\" instead',\n })\n return false\n }\n\n return true\n },\n)\nexport type LoopbackRedirectURI = TypeOf<typeof loopbackRedirectURISchema>\n\nexport const oauthLoopbackClientRedirectUriSchema = loopbackRedirectURISchema\nexport type OAuthLoopbackRedirectURI = TypeOf<\n typeof oauthLoopbackClientRedirectUriSchema\n>\n\nexport const oauthRedirectUriSchema = z\n .string()\n .superRefine(\n (value, ctx): value is HttpsUri | LoopbackRedirectURI | PrivateUseUri => {\n if (value.startsWith('https:')) {\n const result = httpsUriSchema.safeParse(value)\n if (!result.success) result.error.issues.forEach(ctx.addIssue, ctx)\n return result.success\n } else if (value.startsWith('http:')) {\n const result = loopbackRedirectURISchema.safeParse(value)\n if (!result.success) result.error.issues.forEach(ctx.addIssue, ctx)\n return result.success\n } else if (/^[^.:]+(?:\\.[^.:]+)+:/.test(value)) {\n const result = privateUseUriSchema.safeParse(value)\n if (!result.success) result.error.issues.forEach(ctx.addIssue, ctx)\n return result.success\n } else {\n ctx.addIssue({\n code: ZodIssueCode.custom,\n message:\n 'URL must use the \"https:\" or \"http:\" protocol, or a private-use URI scheme (RFC 8252)',\n })\n return false\n }\n },\n )\n\nexport type OAuthRedirectUri = TypeOf<typeof oauthRedirectUriSchema>\n"]}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.oauthRefreshTokenGrantTokenRequestSchema = zod_1.z.object({
|
|
7
|
-
grant_type: zod_1.z.literal('refresh_token'),
|
|
8
|
-
refresh_token: oauth_refresh_token_js_1.oauthRefreshTokenSchema,
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { oauthRefreshTokenSchema } from './oauth-refresh-token.js';
|
|
3
|
+
export const oauthRefreshTokenGrantTokenRequestSchema = z.object({
|
|
4
|
+
grant_type: z.literal('refresh_token'),
|
|
5
|
+
refresh_token: oauthRefreshTokenSchema,
|
|
9
6
|
});
|
|
10
7
|
//# sourceMappingURL=oauth-refresh-token-grant-token-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-refresh-token-grant-token-request.js","sourceRoot":"","sources":["../src/oauth-refresh-token-grant-token-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-refresh-token-grant-token-request.js","sourceRoot":"","sources":["../src/oauth-refresh-token-grant-token-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAElE,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/D,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC;IACtC,aAAa,EAAE,uBAAuB;CACvC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthRefreshTokenSchema } from './oauth-refresh-token.js'\n\nexport const oauthRefreshTokenGrantTokenRequestSchema = z.object({\n grant_type: z.literal('refresh_token'),\n refresh_token: oauthRefreshTokenSchema,\n})\n\nexport type OAuthRefreshTokenGrantTokenRequest = z.infer<\n typeof oauthRefreshTokenGrantTokenRequestSchema\n>\n"]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthRefreshTokenSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthRefreshTokenSchema = zod_1.z.string().min(1);
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthRefreshTokenSchema = z.string().min(1);
|
|
6
3
|
//# sourceMappingURL=oauth-refresh-token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-refresh-token.js","sourceRoot":"","sources":["../src/oauth-refresh-token.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-refresh-token.js","sourceRoot":"","sources":["../src/oauth-refresh-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthRefreshTokenSchema = z.string().min(1)\nexport type OAuthRefreshToken = z.infer<typeof oauthRefreshTokenSchema>\n"]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthRequestUriSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthRequestUriSchema = zod_1.z.string().min(1);
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthRequestUriSchema = z.string().min(1);
|
|
6
3
|
//# sourceMappingURL=oauth-request-uri.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-request-uri.js","sourceRoot":"","sources":["../src/oauth-request-uri.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-request-uri.js","sourceRoot":"","sources":["../src/oauth-request-uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthRequestUriSchema = z.string().min(1)\n\nexport type OAuthRequestUri = z.infer<typeof oauthRequestUriSchema>\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthResponseModeSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthResponseModeSchema = zod_1.z.enum([
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthResponseModeSchema = z.enum([
|
|
6
3
|
'query',
|
|
7
4
|
'fragment',
|
|
8
5
|
'form_post',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-response-mode.js","sourceRoot":"","sources":["../src/oauth-response-mode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-response-mode.js","sourceRoot":"","sources":["../src/oauth-response-mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,OAAO;IACP,UAAU;IACV,WAAW;CACZ,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthResponseModeSchema = z.enum([\n 'query',\n 'fragment',\n 'form_post',\n])\n\nexport type OAuthResponseMode = z.infer<typeof oauthResponseModeSchema>\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthResponseTypeSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthResponseTypeSchema = zod_1.z.enum([
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthResponseTypeSchema = z.enum([
|
|
6
3
|
// OAuth2 (https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-10#section-4.1.1)
|
|
7
4
|
'code', // Authorization Code Grant
|
|
8
5
|
'token', // Implicit Grant
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-response-type.js","sourceRoot":"","sources":["../src/oauth-response-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-response-type.js","sourceRoot":"","sources":["../src/oauth-response-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,wFAAwF;IACxF,MAAM,EAAE,2BAA2B;IACnC,OAAO,EAAE,iBAAiB;IAE1B,4EAA4E;IAC5E,MAAM;IACN,qBAAqB;IACrB,eAAe;IACf,YAAY;IACZ,gBAAgB;IAChB,UAAU;CACX,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthResponseTypeSchema = z.enum([\n // OAuth2 (https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-10#section-4.1.1)\n 'code', // Authorization Code Grant\n 'token', // Implicit Grant\n\n // OIDC (https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html)\n 'none',\n 'code id_token token',\n 'code id_token',\n 'code token',\n 'id_token token',\n 'id_token',\n])\n\nexport type OAuthResponseType = z.infer<typeof oauthResponseTypeSchema>\n"]}
|
package/dist/oauth-scope.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.oauthScopeSchema = exports.isOAuthScope = exports.OAUTH_SCOPE_REGEXP = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
1
|
+
import { z } from 'zod';
|
|
5
2
|
// scope = scope-token *( SP scope-token )
|
|
6
3
|
// scope-token = 1*( %x21 / %x23-5B / %x5D-7E )
|
|
7
|
-
|
|
8
|
-
const isOAuthScope = (input) =>
|
|
9
|
-
exports.isOAuthScope = isOAuthScope;
|
|
4
|
+
export const OAUTH_SCOPE_REGEXP = /^[\x21\x23-\x5B\x5D-\x7E]+(?: [\x21\x23-\x5B\x5D-\x7E]+)*$/;
|
|
5
|
+
export const isOAuthScope = (input) => OAUTH_SCOPE_REGEXP.test(input);
|
|
10
6
|
/**
|
|
11
7
|
* A (single) space separated list of non empty printable ASCII char string
|
|
12
8
|
* (except backslash and double quote).
|
|
13
9
|
*
|
|
14
10
|
* @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11#section-1.4.1}
|
|
15
11
|
*/
|
|
16
|
-
|
|
12
|
+
export const oauthScopeSchema = z.string().refine(isOAuthScope, {
|
|
17
13
|
message: 'Invalid OAuth scope',
|
|
18
14
|
});
|
|
19
15
|
//# sourceMappingURL=oauth-scope.js.map
|
package/dist/oauth-scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-scope.js","sourceRoot":"","sources":["../src/oauth-scope.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-scope.js","sourceRoot":"","sources":["../src/oauth-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,gDAAgD;AAChD,+CAA+C;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAC7B,4DAA4D,CAAA;AAE9D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAW,EAAE,CACrD,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE;IAC9D,OAAO,EAAE,qBAAqB;CAC/B,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\n// scope = scope-token *( SP scope-token )\n// scope-token = 1*( %x21 / %x23-5B / %x5D-7E )\nexport const OAUTH_SCOPE_REGEXP =\n /^[\\x21\\x23-\\x5B\\x5D-\\x7E]+(?: [\\x21\\x23-\\x5B\\x5D-\\x7E]+)*$/\n\nexport const isOAuthScope = (input: string): boolean =>\n OAUTH_SCOPE_REGEXP.test(input)\n\n/**\n * A (single) space separated list of non empty printable ASCII char string\n * (except backslash and double quote).\n *\n * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11#section-1.4.1}\n */\nexport const oauthScopeSchema = z.string().refine(isOAuthScope, {\n message: 'Invalid OAuth scope',\n})\n\nexport type OAuthScope = z.infer<typeof oauthScopeSchema>\n"]}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.oauthTokenIdentificationSchema = zod_1.z.object({
|
|
8
|
-
token: zod_1.z.union([oauth_access_token_js_1.oauthAccessTokenSchema, oauth_refresh_token_js_1.oauthRefreshTokenSchema]),
|
|
9
|
-
token_type_hint: zod_1.z.enum(['access_token', 'refresh_token']).optional(),
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { oauthAccessTokenSchema } from './oauth-access-token.js';
|
|
3
|
+
import { oauthRefreshTokenSchema } from './oauth-refresh-token.js';
|
|
4
|
+
export const oauthTokenIdentificationSchema = z.object({
|
|
5
|
+
token: z.union([oauthAccessTokenSchema, oauthRefreshTokenSchema]),
|
|
6
|
+
token_type_hint: z.enum(['access_token', 'refresh_token']).optional(),
|
|
10
7
|
});
|
|
11
8
|
//# sourceMappingURL=oauth-token-identification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-token-identification.js","sourceRoot":"","sources":["../src/oauth-token-identification.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-token-identification.js","sourceRoot":"","sources":["../src/oauth-token-identification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAElE,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,sBAAsB,EAAE,uBAAuB,CAAC,CAAC;IACjE,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC,CAAC,QAAQ,EAAE;CACtE,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthAccessTokenSchema } from './oauth-access-token.js'\nimport { oauthRefreshTokenSchema } from './oauth-refresh-token.js'\n\nexport const oauthTokenIdentificationSchema = z.object({\n token: z.union([oauthAccessTokenSchema, oauthRefreshTokenSchema]),\n token_type_hint: z.enum(['access_token', 'refresh_token']).optional(),\n})\n\nexport type OAuthTokenIdentification = z.infer<\n typeof oauthTokenIdentificationSchema\n>\n"]}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
oauth_refresh_token_grant_token_request_js_1.oauthRefreshTokenGrantTokenRequestSchema,
|
|
12
|
-
oauth_password_grant_token_request_js_1.oauthPasswordGrantTokenRequestSchema,
|
|
13
|
-
oauth_client_credentials_grant_token_request_js_1.oauthClientCredentialsGrantTokenRequestSchema,
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { oauthAuthorizationCodeGrantTokenRequestSchema } from './oauth-authorization-code-grant-token-request.js';
|
|
3
|
+
import { oauthClientCredentialsGrantTokenRequestSchema } from './oauth-client-credentials-grant-token-request.js';
|
|
4
|
+
import { oauthPasswordGrantTokenRequestSchema } from './oauth-password-grant-token-request.js';
|
|
5
|
+
import { oauthRefreshTokenGrantTokenRequestSchema } from './oauth-refresh-token-grant-token-request.js';
|
|
6
|
+
export const oauthTokenRequestSchema = z.discriminatedUnion('grant_type', [
|
|
7
|
+
oauthAuthorizationCodeGrantTokenRequestSchema,
|
|
8
|
+
oauthRefreshTokenGrantTokenRequestSchema,
|
|
9
|
+
oauthPasswordGrantTokenRequestSchema,
|
|
10
|
+
oauthClientCredentialsGrantTokenRequestSchema,
|
|
14
11
|
]);
|
|
15
12
|
//# sourceMappingURL=oauth-token-request.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-token-request.js","sourceRoot":"","sources":["../src/oauth-token-request.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-token-request.js","sourceRoot":"","sources":["../src/oauth-token-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,6CAA6C,EAAE,MAAM,mDAAmD,CAAA;AACjH,OAAO,EAAE,6CAA6C,EAAE,MAAM,mDAAmD,CAAA;AACjH,OAAO,EAAE,oCAAoC,EAAE,MAAM,yCAAyC,CAAA;AAC9F,OAAO,EAAE,wCAAwC,EAAE,MAAM,8CAA8C,CAAA;AAEvG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,kBAAkB,CAAC,YAAY,EAAE;IACxE,6CAA6C;IAC7C,wCAAwC;IACxC,oCAAoC;IACpC,6CAA6C;CAC9C,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { oauthAuthorizationCodeGrantTokenRequestSchema } from './oauth-authorization-code-grant-token-request.js'\nimport { oauthClientCredentialsGrantTokenRequestSchema } from './oauth-client-credentials-grant-token-request.js'\nimport { oauthPasswordGrantTokenRequestSchema } from './oauth-password-grant-token-request.js'\nimport { oauthRefreshTokenGrantTokenRequestSchema } from './oauth-refresh-token-grant-token-request.js'\n\nexport const oauthTokenRequestSchema = z.discriminatedUnion('grant_type', [\n oauthAuthorizationCodeGrantTokenRequestSchema,\n oauthRefreshTokenGrantTokenRequestSchema,\n oauthPasswordGrantTokenRequestSchema,\n oauthClientCredentialsGrantTokenRequestSchema,\n])\n\nexport type OAuthTokenRequest = z.infer<typeof oauthTokenRequestSchema>\n"]}
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const jwk_1 = require("@atproto/jwk");
|
|
6
|
-
const oauth_authorization_details_js_1 = require("./oauth-authorization-details.js");
|
|
7
|
-
const oauth_token_type_js_1 = require("./oauth-token-type.js");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { signedJwtSchema } from '@atproto/jwk';
|
|
3
|
+
import { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js';
|
|
4
|
+
import { oauthTokenTypeSchema } from './oauth-token-type.js';
|
|
8
5
|
/**
|
|
9
6
|
* @see {@link https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1 | RFC 6749 (OAuth2), Section 5.1}
|
|
10
7
|
*/
|
|
11
|
-
|
|
8
|
+
export const oauthTokenResponseSchema = z
|
|
12
9
|
.object({
|
|
13
10
|
// https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1
|
|
14
|
-
access_token:
|
|
15
|
-
token_type:
|
|
16
|
-
scope:
|
|
17
|
-
refresh_token:
|
|
18
|
-
expires_in:
|
|
11
|
+
access_token: z.string(),
|
|
12
|
+
token_type: oauthTokenTypeSchema,
|
|
13
|
+
scope: z.string().optional(),
|
|
14
|
+
refresh_token: z.string().optional(),
|
|
15
|
+
expires_in: z.number().optional(),
|
|
19
16
|
// https://openid.net/specs/openid-connect-core-1_0.html#TokenResponse
|
|
20
|
-
id_token:
|
|
17
|
+
id_token: signedJwtSchema.optional(),
|
|
21
18
|
// https://datatracker.ietf.org/doc/html/rfc9396#name-enriched-authorization-deta
|
|
22
|
-
authorization_details:
|
|
19
|
+
authorization_details: oauthAuthorizationDetailsSchema.optional(),
|
|
23
20
|
})
|
|
24
21
|
// https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1
|
|
25
22
|
// > The client MUST ignore unrecognized value names in the response.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-token-response.js","sourceRoot":"","sources":["../src/oauth-token-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-token-response.js","sourceRoot":"","sources":["../src/oauth-token-response.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,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC;KACtC,MAAM,CAAC;IACN,0DAA0D;IAC1D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,oBAAoB;IAChC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,sEAAsE;IACtE,QAAQ,EAAE,eAAe,CAAC,QAAQ,EAAE;IACpC,iFAAiF;IACjF,qBAAqB,EAAE,+BAA+B,CAAC,QAAQ,EAAE;CAClE,CAAC;IACF,0DAA0D;IAC1D,qEAAqE;KACpE,WAAW,EAAE,CAAA","sourcesContent":["import { z } from 'zod'\nimport { signedJwtSchema } from '@atproto/jwk'\nimport { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js'\nimport { oauthTokenTypeSchema } from './oauth-token-type.js'\n\n/**\n * @see {@link https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1 | RFC 6749 (OAuth2), Section 5.1}\n */\nexport const oauthTokenResponseSchema = z\n .object({\n // https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1\n access_token: z.string(),\n token_type: oauthTokenTypeSchema,\n scope: z.string().optional(),\n refresh_token: z.string().optional(),\n expires_in: z.number().optional(),\n // https://openid.net/specs/openid-connect-core-1_0.html#TokenResponse\n id_token: signedJwtSchema.optional(),\n // https://datatracker.ietf.org/doc/html/rfc9396#name-enriched-authorization-deta\n authorization_details: oauthAuthorizationDetailsSchema.optional(),\n })\n // https://www.rfc-editor.org/rfc/rfc6749.html#section-5.1\n // > The client MUST ignore unrecognized value names in the response.\n .passthrough()\n\n/**\n * @see {@link oauthTokenResponseSchema}\n */\nexport type OAuthTokenResponse = z.infer<typeof oauthTokenResponseSchema>\n"]}
|