@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,52 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.isConventionalOAuthClientId = isConventionalOAuthClientId;
|
|
6
|
-
exports.assertOAuthDiscoverableClientId = assertOAuthDiscoverableClientId;
|
|
7
|
-
exports.parseOAuthDiscoverableClientId = parseOAuthDiscoverableClientId;
|
|
8
|
-
const zod_1 = require("zod");
|
|
9
|
-
const oauth_client_id_js_1 = require("./oauth-client-id.js");
|
|
10
|
-
const uri_js_1 = require("./uri.js");
|
|
11
|
-
const util_js_1 = require("./util.js");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { oauthClientIdSchema } from './oauth-client-id.js';
|
|
3
|
+
import { httpsUriSchema } from './uri.js';
|
|
4
|
+
import { extractUrlPath, isHostnameIP } from './util.js';
|
|
12
5
|
/**
|
|
13
6
|
* @see {@link https://www.ietf.org/archive/id/draft-ietf-oauth-client-id-metadata-document-00.html}
|
|
14
7
|
*/
|
|
15
|
-
|
|
16
|
-
.intersection(
|
|
8
|
+
export const oauthClientIdDiscoverableSchema = z
|
|
9
|
+
.intersection(oauthClientIdSchema, httpsUriSchema)
|
|
17
10
|
.superRefine((value, ctx) => {
|
|
18
11
|
const url = new URL(value);
|
|
19
12
|
if (url.username || url.password) {
|
|
20
13
|
ctx.addIssue({
|
|
21
|
-
code:
|
|
14
|
+
code: z.ZodIssueCode.custom,
|
|
22
15
|
message: 'ClientID must not contain credentials',
|
|
23
16
|
});
|
|
24
17
|
return false;
|
|
25
18
|
}
|
|
26
19
|
if (url.hash) {
|
|
27
20
|
ctx.addIssue({
|
|
28
|
-
code:
|
|
21
|
+
code: z.ZodIssueCode.custom,
|
|
29
22
|
message: 'ClientID must not contain a fragment',
|
|
30
23
|
});
|
|
31
24
|
return false;
|
|
32
25
|
}
|
|
33
26
|
if (url.pathname === '/') {
|
|
34
27
|
ctx.addIssue({
|
|
35
|
-
code:
|
|
28
|
+
code: z.ZodIssueCode.custom,
|
|
36
29
|
message: 'ClientID must contain a path component (e.g. "/client-metadata.json")',
|
|
37
30
|
});
|
|
38
31
|
return false;
|
|
39
32
|
}
|
|
40
33
|
if (url.pathname.endsWith('/')) {
|
|
41
34
|
ctx.addIssue({
|
|
42
|
-
code:
|
|
35
|
+
code: z.ZodIssueCode.custom,
|
|
43
36
|
message: 'ClientID path must not end with a trailing slash',
|
|
44
37
|
});
|
|
45
38
|
return false;
|
|
46
39
|
}
|
|
47
|
-
if (
|
|
40
|
+
if (isHostnameIP(url.hostname)) {
|
|
48
41
|
ctx.addIssue({
|
|
49
|
-
code:
|
|
42
|
+
code: z.ZodIssueCode.custom,
|
|
50
43
|
message: 'ClientID hostname must not be an IP address',
|
|
51
44
|
});
|
|
52
45
|
return false;
|
|
@@ -54,50 +47,50 @@ exports.oauthClientIdDiscoverableSchema = zod_1.z
|
|
|
54
47
|
// URL constructor normalizes the URL, so we extract the path manually to
|
|
55
48
|
// avoid normalization, then compare it to the normalized path to ensure
|
|
56
49
|
// that the URL does not contain path traversal or other unexpected characters
|
|
57
|
-
if (
|
|
50
|
+
if (extractUrlPath(value) !== url.pathname) {
|
|
58
51
|
ctx.addIssue({
|
|
59
|
-
code:
|
|
52
|
+
code: z.ZodIssueCode.custom,
|
|
60
53
|
message: `ClientID must be in canonical form ("${url.href}", got "${value}")`,
|
|
61
54
|
});
|
|
62
55
|
return false;
|
|
63
56
|
}
|
|
64
57
|
return true;
|
|
65
58
|
});
|
|
66
|
-
function isOAuthClientIdDiscoverable(clientId) {
|
|
67
|
-
return
|
|
59
|
+
export function isOAuthClientIdDiscoverable(clientId) {
|
|
60
|
+
return oauthClientIdDiscoverableSchema.safeParse(clientId).success;
|
|
68
61
|
}
|
|
69
|
-
|
|
62
|
+
export const conventionalOAuthClientIdSchema = oauthClientIdDiscoverableSchema.superRefine((value, ctx) => {
|
|
70
63
|
const url = new URL(value);
|
|
71
64
|
if (url.port) {
|
|
72
65
|
ctx.addIssue({
|
|
73
|
-
code:
|
|
66
|
+
code: z.ZodIssueCode.custom,
|
|
74
67
|
message: 'ClientID must not contain a port',
|
|
75
68
|
});
|
|
76
69
|
return false;
|
|
77
70
|
}
|
|
78
71
|
if (url.search) {
|
|
79
72
|
ctx.addIssue({
|
|
80
|
-
code:
|
|
73
|
+
code: z.ZodIssueCode.custom,
|
|
81
74
|
message: 'ClientID must not contain a query string',
|
|
82
75
|
});
|
|
83
76
|
return false;
|
|
84
77
|
}
|
|
85
78
|
if (url.pathname !== '/oauth-client-metadata.json') {
|
|
86
79
|
ctx.addIssue({
|
|
87
|
-
code:
|
|
80
|
+
code: z.ZodIssueCode.custom,
|
|
88
81
|
message: 'ClientID must be "/oauth-client-metadata.json"',
|
|
89
82
|
});
|
|
90
83
|
return false;
|
|
91
84
|
}
|
|
92
85
|
return true;
|
|
93
86
|
});
|
|
94
|
-
function isConventionalOAuthClientId(clientId) {
|
|
95
|
-
return
|
|
87
|
+
export function isConventionalOAuthClientId(clientId) {
|
|
88
|
+
return conventionalOAuthClientIdSchema.safeParse(clientId).success;
|
|
96
89
|
}
|
|
97
|
-
function assertOAuthDiscoverableClientId(value) {
|
|
98
|
-
void
|
|
90
|
+
export function assertOAuthDiscoverableClientId(value) {
|
|
91
|
+
void oauthClientIdDiscoverableSchema.parse(value);
|
|
99
92
|
}
|
|
100
|
-
function parseOAuthDiscoverableClientId(clientId) {
|
|
101
|
-
return new URL(
|
|
93
|
+
export function parseOAuthDiscoverableClientId(clientId) {
|
|
94
|
+
return new URL(oauthClientIdDiscoverableSchema.parse(clientId));
|
|
102
95
|
}
|
|
103
96
|
//# sourceMappingURL=oauth-client-id-discoverable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-client-id-discoverable.js","sourceRoot":"","sources":["../src/oauth-client-id-discoverable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-client-id-discoverable.js","sourceRoot":"","sources":["../src/oauth-client-id-discoverable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,CAAC,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC;KAC7C,YAAY,CAAC,mBAAmB,EAAE,cAAc,CAAC;KACjD,WAAW,CAAC,CAAC,KAAK,EAAE,GAAG,EAA0C,EAAE;IAClE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;IAE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AC,QAAQ,CAAC,CAAC,OAAO,CAAA;AACpE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAC7C,KAAa;IAEb,KAAK,+BAA+B,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;AACnD,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,QAAgB;IAC7D,OAAO,IAAI,GAAG,CAAC,+BAA+B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AACjE,CAAC","sourcesContent":["import { TypeOf, z } from 'zod'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\nimport { httpsUriSchema } from './uri.js'\nimport { extractUrlPath, isHostnameIP } from './util.js'\n\n/**\n * @see {@link https://www.ietf.org/archive/id/draft-ietf-oauth-client-id-metadata-document-00.html}\n */\nexport const oauthClientIdDiscoverableSchema = z\n .intersection(oauthClientIdSchema, httpsUriSchema)\n .superRefine((value, ctx): value is `https://${string}/${string}` => {\n const url = new URL(value)\n\n if (url.username || url.password) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID must not contain credentials',\n })\n return false\n }\n\n if (url.hash) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID must not contain a fragment',\n })\n return false\n }\n\n if (url.pathname === '/') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message:\n 'ClientID must contain a path component (e.g. \"/client-metadata.json\")',\n })\n return false\n }\n\n if (url.pathname.endsWith('/')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID path must not end with a trailing slash',\n })\n return false\n }\n\n if (isHostnameIP(url.hostname)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID hostname must not be an IP address',\n })\n return false\n }\n\n // URL constructor normalizes the URL, so we extract the path manually to\n // avoid normalization, then compare it to the normalized path to ensure\n // that the URL does not contain path traversal or other unexpected characters\n if (extractUrlPath(value) !== url.pathname) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `ClientID must be in canonical form (\"${url.href}\", got \"${value}\")`,\n })\n return false\n }\n\n return true\n })\n\nexport type OAuthClientIdDiscoverable = TypeOf<\n typeof oauthClientIdDiscoverableSchema\n>\n\nexport function isOAuthClientIdDiscoverable(\n clientId: string,\n): clientId is OAuthClientIdDiscoverable {\n return oauthClientIdDiscoverableSchema.safeParse(clientId).success\n}\n\nexport const conventionalOAuthClientIdSchema =\n oauthClientIdDiscoverableSchema.superRefine(\n (value, ctx): value is `https://${string}/oauth-client-metadata.json` => {\n const url = new URL(value)\n\n if (url.port) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID must not contain a port',\n })\n return false\n }\n\n if (url.search) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID must not contain a query string',\n })\n return false\n }\n\n if (url.pathname !== '/oauth-client-metadata.json') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'ClientID must be \"/oauth-client-metadata.json\"',\n })\n return false\n }\n\n return true\n },\n )\n\nexport type ConventionalOAuthClientId = TypeOf<\n typeof conventionalOAuthClientIdSchema\n>\n\nexport function isConventionalOAuthClientId(\n clientId: string,\n): clientId is ConventionalOAuthClientId {\n return conventionalOAuthClientIdSchema.safeParse(clientId).success\n}\n\nexport function assertOAuthDiscoverableClientId(\n value: string,\n): asserts value is OAuthClientIdDiscoverable {\n void oauthClientIdDiscoverableSchema.parse(value)\n}\n\nexport function parseOAuthDiscoverableClientId(clientId: string): URL {\n return new URL(oauthClientIdDiscoverableSchema.parse(clientId))\n}\n"]}
|
|
@@ -1,49 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.asOAuthClientIdLoopback = asOAuthClientIdLoopback;
|
|
7
|
-
exports.parseOAuthLoopbackClientId = parseOAuthLoopbackClientId;
|
|
8
|
-
exports.safeParseOAuthLoopbackClientId = safeParseOAuthLoopbackClientId;
|
|
9
|
-
exports.safeParseOAuthLoopbackClientIdQueryString = safeParseOAuthLoopbackClientIdQueryString;
|
|
10
|
-
const oauth_client_id_js_1 = require("./oauth-client-id.js");
|
|
11
|
-
const oauth_redirect_uri_js_1 = require("./oauth-redirect-uri.js");
|
|
12
|
-
const oauth_scope_js_1 = require("./oauth-scope.js");
|
|
13
|
-
exports.LOOPBACK_CLIENT_ID_ORIGIN = 'http://localhost';
|
|
14
|
-
exports.oauthClientIdLoopbackSchema = oauth_client_id_js_1.oauthClientIdSchema.superRefine((input, ctx) => {
|
|
1
|
+
import { oauthClientIdSchema } from './oauth-client-id.js';
|
|
2
|
+
import { oauthLoopbackClientRedirectUriSchema, } from './oauth-redirect-uri.js';
|
|
3
|
+
import { oauthScopeSchema } from './oauth-scope.js';
|
|
4
|
+
export const LOOPBACK_CLIENT_ID_ORIGIN = 'http://localhost';
|
|
5
|
+
export const oauthClientIdLoopbackSchema = oauthClientIdSchema.superRefine((input, ctx) => {
|
|
15
6
|
const result = safeParseOAuthLoopbackClientId(input);
|
|
16
7
|
if (!result.success) {
|
|
17
8
|
ctx.addIssue({ code: 'custom', message: result.message });
|
|
18
9
|
}
|
|
19
10
|
return result.success;
|
|
20
11
|
});
|
|
21
|
-
function assertOAuthLoopbackClientId(input) {
|
|
12
|
+
export function assertOAuthLoopbackClientId(input) {
|
|
22
13
|
void parseOAuthLoopbackClientId(input);
|
|
23
14
|
}
|
|
24
|
-
function isOAuthClientIdLoopback(input) {
|
|
15
|
+
export function isOAuthClientIdLoopback(input) {
|
|
25
16
|
return safeParseOAuthLoopbackClientId(input).success;
|
|
26
17
|
}
|
|
27
|
-
function asOAuthClientIdLoopback(input) {
|
|
18
|
+
export function asOAuthClientIdLoopback(input) {
|
|
28
19
|
assertOAuthLoopbackClientId(input);
|
|
29
20
|
return input;
|
|
30
21
|
}
|
|
31
|
-
function parseOAuthLoopbackClientId(input) {
|
|
22
|
+
export function parseOAuthLoopbackClientId(input) {
|
|
32
23
|
const result = safeParseOAuthLoopbackClientId(input);
|
|
33
24
|
if (result.success)
|
|
34
25
|
return result.value;
|
|
35
26
|
throw new TypeError(`Invalid loopback client ID: ${result.message}`);
|
|
36
27
|
}
|
|
37
|
-
function safeParseOAuthLoopbackClientId(input) {
|
|
28
|
+
export function safeParseOAuthLoopbackClientId(input) {
|
|
38
29
|
// @NOTE Not using "new URL" to ensure input indeed matches the type
|
|
39
30
|
// OAuthClientIdLoopback
|
|
40
|
-
if (!input.startsWith(
|
|
31
|
+
if (!input.startsWith(LOOPBACK_CLIENT_ID_ORIGIN)) {
|
|
41
32
|
return {
|
|
42
33
|
success: false,
|
|
43
|
-
message: `Value must start with "${
|
|
34
|
+
message: `Value must start with "${LOOPBACK_CLIENT_ID_ORIGIN}"`,
|
|
44
35
|
};
|
|
45
36
|
}
|
|
46
|
-
if (input.includes('#',
|
|
37
|
+
if (input.includes('#', LOOPBACK_CLIENT_ID_ORIGIN.length)) {
|
|
47
38
|
return {
|
|
48
39
|
success: false,
|
|
49
40
|
message: 'Value must not contain a hash component',
|
|
@@ -51,10 +42,10 @@ function safeParseOAuthLoopbackClientId(input) {
|
|
|
51
42
|
}
|
|
52
43
|
// Since we don't allow a path component (except for a single "/") the query
|
|
53
44
|
// string starts after the origin (+ 1 if there is a "/")
|
|
54
|
-
const queryStringIdx = input.length >
|
|
55
|
-
input.charCodeAt(
|
|
56
|
-
?
|
|
57
|
-
:
|
|
45
|
+
const queryStringIdx = input.length > LOOPBACK_CLIENT_ID_ORIGIN.length &&
|
|
46
|
+
input.charCodeAt(LOOPBACK_CLIENT_ID_ORIGIN.length) === 0x2f /* '/' */
|
|
47
|
+
? LOOPBACK_CLIENT_ID_ORIGIN.length + 1
|
|
48
|
+
: LOOPBACK_CLIENT_ID_ORIGIN.length;
|
|
58
49
|
// Since we determined the position of the query string based on the origin
|
|
59
50
|
// length (instead of looking for a "?"), we need to make sure the query
|
|
60
51
|
// string position (if any) indeed starts with a "?".
|
|
@@ -68,7 +59,7 @@ function safeParseOAuthLoopbackClientId(input) {
|
|
|
68
59
|
const queryString = input.slice(queryStringIdx + 1);
|
|
69
60
|
return safeParseOAuthLoopbackClientIdQueryString(queryString);
|
|
70
61
|
}
|
|
71
|
-
function safeParseOAuthLoopbackClientIdQueryString(input) {
|
|
62
|
+
export function safeParseOAuthLoopbackClientIdQueryString(input) {
|
|
72
63
|
// Parse query params
|
|
73
64
|
const params = {};
|
|
74
65
|
const it = typeof input === 'string' ? new URLSearchParams(input) : input;
|
|
@@ -80,7 +71,7 @@ function safeParseOAuthLoopbackClientIdQueryString(input) {
|
|
|
80
71
|
message: 'Duplicate "scope" query parameter',
|
|
81
72
|
};
|
|
82
73
|
}
|
|
83
|
-
const res =
|
|
74
|
+
const res = oauthScopeSchema.safeParse(value);
|
|
84
75
|
if (!res.success) {
|
|
85
76
|
const reason = res.error.issues.map((i) => i.message).join(', ');
|
|
86
77
|
return {
|
|
@@ -91,7 +82,7 @@ function safeParseOAuthLoopbackClientIdQueryString(input) {
|
|
|
91
82
|
params.scope = res.data;
|
|
92
83
|
}
|
|
93
84
|
else if (key === 'redirect_uri') {
|
|
94
|
-
const res =
|
|
85
|
+
const res = oauthLoopbackClientRedirectUriSchema.safeParse(value);
|
|
95
86
|
if (!res.success) {
|
|
96
87
|
const reason = res.error.issues.map((i) => i.message).join(', ');
|
|
97
88
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-client-id-loopback.js","sourceRoot":"","sources":["../src/oauth-client-id-loopback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-client-id-loopback.js","sourceRoot":"","sources":["../src/oauth-client-id-loopback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAEL,oCAAoC,GACrC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAc,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AAE/D,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAA;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;IAED,OAAO;QACL,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,MAAM;KACd,CAAA;AACH,CAAC","sourcesContent":["import { oauthClientIdSchema } from './oauth-client-id.js'\nimport {\n OAuthLoopbackRedirectURI,\n oauthLoopbackClientRedirectUriSchema,\n} from './oauth-redirect-uri.js'\nimport { OAuthScope, oauthScopeSchema } from './oauth-scope.js'\n\nexport const LOOPBACK_CLIENT_ID_ORIGIN = 'http://localhost'\n\n// @NOTE This is not actually based on a standard, but rather a convention\n// established by Bluesky in the Atproto specs and implementation. As such, and\n// in order to respect the convention from this package, these should be\n// prefixed with \"Atproto\" instead of \"OAuth\". For legacy reasons, we keep the\n// current names, but we should rename them in a future major release, unless\n// loopback client ids have since then been standardized.\n\nexport type OAuthClientIdLoopback =\n `http://localhost${'' | `/`}${'' | `?${string}`}`\n\nexport type OAuthLoopbackClientIdParams = {\n scope?: OAuthScope\n redirect_uris?: [OAuthLoopbackRedirectURI, ...OAuthLoopbackRedirectURI[]]\n}\n\nexport const oauthClientIdLoopbackSchema = oauthClientIdSchema.superRefine(\n (input, ctx): input is OAuthClientIdLoopback => {\n const result = safeParseOAuthLoopbackClientId(input)\n if (!result.success) {\n ctx.addIssue({ code: 'custom', message: result.message })\n }\n return result.success\n },\n)\n\nexport function assertOAuthLoopbackClientId(\n input: string,\n): asserts input is OAuthClientIdLoopback {\n void parseOAuthLoopbackClientId(input)\n}\n\nexport function isOAuthClientIdLoopback<T extends string>(\n input: T,\n): input is T & OAuthClientIdLoopback {\n return safeParseOAuthLoopbackClientId(input).success\n}\n\nexport function asOAuthClientIdLoopback<T extends string>(input: T) {\n assertOAuthLoopbackClientId(input)\n return input\n}\n\nexport function parseOAuthLoopbackClientId(\n input: string,\n): OAuthLoopbackClientIdParams {\n const result = safeParseOAuthLoopbackClientId(input)\n if (result.success) return result.value\n\n throw new TypeError(`Invalid loopback client ID: ${result.message}`)\n}\n\n/**\n * Similar to Zod's {@link SafeParseReturnType} but uses a simple \"message\"\n * string instead of an \"error\" Error object.\n */\ntype LightParseReturnType<T> =\n | { success: true; value: T }\n | { success: false; message: string }\n\nexport function safeParseOAuthLoopbackClientId(\n input: string,\n): LightParseReturnType<OAuthLoopbackClientIdParams> {\n // @NOTE Not using \"new URL\" to ensure input indeed matches the type\n // OAuthClientIdLoopback\n\n if (!input.startsWith(LOOPBACK_CLIENT_ID_ORIGIN)) {\n return {\n success: false,\n message: `Value must start with \"${LOOPBACK_CLIENT_ID_ORIGIN}\"`,\n }\n }\n\n if (input.includes('#', LOOPBACK_CLIENT_ID_ORIGIN.length)) {\n return {\n success: false,\n message: 'Value must not contain a hash component',\n }\n }\n\n // Since we don't allow a path component (except for a single \"/\") the query\n // string starts after the origin (+ 1 if there is a \"/\")\n const queryStringIdx =\n input.length > LOOPBACK_CLIENT_ID_ORIGIN.length &&\n input.charCodeAt(LOOPBACK_CLIENT_ID_ORIGIN.length) === 0x2f /* '/' */\n ? LOOPBACK_CLIENT_ID_ORIGIN.length + 1\n : LOOPBACK_CLIENT_ID_ORIGIN.length\n\n // Since we determined the position of the query string based on the origin\n // length (instead of looking for a \"?\"), we need to make sure the query\n // string position (if any) indeed starts with a \"?\".\n if (\n input.length !== queryStringIdx &&\n input.charCodeAt(queryStringIdx) !== 0x3f /* '?' */\n ) {\n return {\n success: false,\n message: 'Value must not contain a path component',\n }\n }\n\n const queryString = input.slice(queryStringIdx + 1)\n return safeParseOAuthLoopbackClientIdQueryString(queryString)\n}\n\nexport function safeParseOAuthLoopbackClientIdQueryString(\n input: string | Iterable<[key: string, value: string]>,\n): LightParseReturnType<OAuthLoopbackClientIdParams> {\n // Parse query params\n const params: OAuthLoopbackClientIdParams = {}\n\n const it = typeof input === 'string' ? new URLSearchParams(input) : input\n for (const [key, value] of it) {\n if (key === 'scope') {\n if ('scope' in params) {\n return {\n success: false,\n message: 'Duplicate \"scope\" query parameter',\n }\n }\n\n const res = oauthScopeSchema.safeParse(value)\n if (!res.success) {\n const reason = res.error.issues.map((i) => i.message).join(', ')\n return {\n success: false,\n message: `Invalid \"scope\" query parameter: ${reason || 'Validation failed'}`,\n }\n }\n\n params.scope = res.data\n } else if (key === 'redirect_uri') {\n const res = oauthLoopbackClientRedirectUriSchema.safeParse(value)\n if (!res.success) {\n const reason = res.error.issues.map((i) => i.message).join(', ')\n return {\n success: false,\n message: `Invalid \"redirect_uri\" query parameter: ${reason || 'Validation failed'}`,\n }\n }\n\n if (params.redirect_uris == null) params.redirect_uris = [res.data]\n else params.redirect_uris.push(res.data)\n } else {\n return {\n success: false,\n message: `Unexpected query parameter \"${key}\"`,\n }\n }\n }\n\n return {\n success: true,\n value: params,\n }\n}\n"]}
|
package/dist/oauth-client-id.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthClientIdSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthClientIdSchema = zod_1.z.string().min(1);
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthClientIdSchema = z.string().min(1);
|
|
6
3
|
//# sourceMappingURL=oauth-client-id.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-client-id.js","sourceRoot":"","sources":["../src/oauth-client-id.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-client-id.js","sourceRoot":"","sources":["../src/oauth-client-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthClientIdSchema = z.string().min(1)\nexport type OAuthClientId = z.infer<typeof oauthClientIdSchema>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-client-metadata.d.ts","sourceRoot":"","sources":["../src/oauth-client-metadata.ts"],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|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const oauth_response_type_js_1 = require("./oauth-response-type.js");
|
|
11
|
-
const oauth_scope_js_1 = require("./oauth-scope.js");
|
|
12
|
-
const uri_js_1 = require("./uri.js");
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { jwksPubSchema } from '@atproto/jwk';
|
|
3
|
+
import { oauthClientIdSchema } from './oauth-client-id.js';
|
|
4
|
+
import { oauthEndpointAuthMethod } 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';
|
|
13
10
|
/**
|
|
14
11
|
* @see {@link https://openid.net/specs/openid-connect-registration-1_0.html}
|
|
15
12
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc7591}
|
|
@@ -17,47 +14,47 @@ const uri_js_1 = require("./uri.js");
|
|
|
17
14
|
* environments. Make sure to validate the URIs before using it in a production
|
|
18
15
|
* environment.
|
|
19
16
|
*/
|
|
20
|
-
|
|
17
|
+
export const oauthClientMetadataSchema = z.object({
|
|
21
18
|
/**
|
|
22
19
|
* @note redirect_uris require additional validation
|
|
23
20
|
*/
|
|
24
21
|
// https://www.rfc-editor.org/rfc/rfc7591.html#section-2
|
|
25
|
-
redirect_uris:
|
|
26
|
-
response_types:
|
|
27
|
-
.array(
|
|
22
|
+
redirect_uris: z.array(oauthRedirectUriSchema).nonempty(),
|
|
23
|
+
response_types: z
|
|
24
|
+
.array(oauthResponseTypeSchema)
|
|
28
25
|
.nonempty()
|
|
29
26
|
// > If omitted, the default is that the client will use only the "code"
|
|
30
27
|
// > response type.
|
|
31
28
|
.default(['code']),
|
|
32
|
-
grant_types:
|
|
33
|
-
.array(
|
|
29
|
+
grant_types: z
|
|
30
|
+
.array(oauthGrantTypeSchema)
|
|
34
31
|
.nonempty()
|
|
35
32
|
// > If omitted, the default behavior is that the client will use only the
|
|
36
33
|
// > "authorization_code" Grant Type.
|
|
37
34
|
.default(['authorization_code']),
|
|
38
|
-
scope:
|
|
35
|
+
scope: oauthScopeSchema.optional(),
|
|
39
36
|
// https://www.rfc-editor.org/rfc/rfc7591.html#section-2
|
|
40
|
-
token_endpoint_auth_method:
|
|
37
|
+
token_endpoint_auth_method: oauthEndpointAuthMethod
|
|
41
38
|
// > If unspecified or omitted, the default is "client_secret_basic" [...].
|
|
42
39
|
.default('client_secret_basic'),
|
|
43
|
-
token_endpoint_auth_signing_alg:
|
|
44
|
-
userinfo_signed_response_alg:
|
|
45
|
-
userinfo_encrypted_response_alg:
|
|
46
|
-
jwks_uri:
|
|
47
|
-
jwks:
|
|
48
|
-
application_type:
|
|
49
|
-
subject_type:
|
|
50
|
-
request_object_signing_alg:
|
|
51
|
-
id_token_signed_response_alg:
|
|
52
|
-
authorization_signed_response_alg:
|
|
53
|
-
authorization_encrypted_response_enc:
|
|
54
|
-
authorization_encrypted_response_alg:
|
|
55
|
-
client_id:
|
|
56
|
-
client_name:
|
|
57
|
-
client_uri:
|
|
58
|
-
policy_uri:
|
|
59
|
-
tos_uri:
|
|
60
|
-
logo_uri:
|
|
40
|
+
token_endpoint_auth_signing_alg: z.string().optional(),
|
|
41
|
+
userinfo_signed_response_alg: z.string().optional(),
|
|
42
|
+
userinfo_encrypted_response_alg: z.string().optional(),
|
|
43
|
+
jwks_uri: webUriSchema.optional(),
|
|
44
|
+
jwks: jwksPubSchema.optional(),
|
|
45
|
+
application_type: z.enum(['web', 'native']).default('web'), // default, per spec, is "web"
|
|
46
|
+
subject_type: z.enum(['public', 'pairwise']).default('public'),
|
|
47
|
+
request_object_signing_alg: z.string().optional(),
|
|
48
|
+
id_token_signed_response_alg: z.string().optional(),
|
|
49
|
+
authorization_signed_response_alg: z.string().default('RS256'),
|
|
50
|
+
authorization_encrypted_response_enc: z.enum(['A128CBC-HS256']).optional(),
|
|
51
|
+
authorization_encrypted_response_alg: z.string().optional(),
|
|
52
|
+
client_id: oauthClientIdSchema.optional(),
|
|
53
|
+
client_name: z.string().optional(),
|
|
54
|
+
client_uri: webUriSchema.optional(),
|
|
55
|
+
policy_uri: webUriSchema.optional(),
|
|
56
|
+
tos_uri: webUriSchema.optional(),
|
|
57
|
+
logo_uri: webUriSchema.optional(), // @TODO: allow data: uri ?
|
|
61
58
|
/**
|
|
62
59
|
* Default Maximum Authentication Age. Specifies that the End-User MUST be
|
|
63
60
|
* actively authenticated if the End-User was authenticated longer ago than
|
|
@@ -65,13 +62,13 @@ exports.oauthClientMetadataSchema = zod_1.z.object({
|
|
|
65
62
|
* this default value. If omitted, no default Maximum Authentication Age is
|
|
66
63
|
* specified.
|
|
67
64
|
*/
|
|
68
|
-
default_max_age:
|
|
69
|
-
require_auth_time:
|
|
70
|
-
contacts:
|
|
71
|
-
tls_client_certificate_bound_access_tokens:
|
|
65
|
+
default_max_age: z.number().optional(),
|
|
66
|
+
require_auth_time: z.boolean().optional(),
|
|
67
|
+
contacts: z.array(z.string().email()).optional(),
|
|
68
|
+
tls_client_certificate_bound_access_tokens: z.boolean().optional(),
|
|
72
69
|
// https://datatracker.ietf.org/doc/html/rfc9449#section-5.2
|
|
73
|
-
dpop_bound_access_tokens:
|
|
70
|
+
dpop_bound_access_tokens: z.boolean().optional(),
|
|
74
71
|
// https://datatracker.ietf.org/doc/html/rfc9396#section-14.5
|
|
75
|
-
authorization_details_types:
|
|
72
|
+
authorization_details_types: z.array(z.string()).optional(),
|
|
76
73
|
});
|
|
77
74
|
//# sourceMappingURL=oauth-client-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-client-metadata.js","sourceRoot":"","sources":["../src/oauth-client-metadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-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AQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE;IAChD,0CAA0C,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAElE,4DAA4D;IAC5D,wBAAwB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAEhD,6DAA6D;IAC7D,2BAA2B,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC5D,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\nimport { jwksPubSchema } from '@atproto/jwk'\nimport { oauthClientIdSchema } from './oauth-client-id.js'\nimport { oauthEndpointAuthMethod } from './oauth-endpoint-auth-method.js'\nimport { oauthGrantTypeSchema } from './oauth-grant-type.js'\nimport { oauthRedirectUriSchema } from './oauth-redirect-uri.js'\nimport { oauthResponseTypeSchema } from './oauth-response-type.js'\nimport { oauthScopeSchema } from './oauth-scope.js'\nimport { webUriSchema } from './uri.js'\n\n/**\n * @see {@link https://openid.net/specs/openid-connect-registration-1_0.html}\n * @see {@link https://datatracker.ietf.org/doc/html/rfc7591}\n * @note we do not enforce https: scheme in URIs to support development\n * environments. Make sure to validate the URIs before using it in a production\n * environment.\n */\nexport const oauthClientMetadataSchema = z.object({\n /**\n * @note redirect_uris require additional validation\n */\n // https://www.rfc-editor.org/rfc/rfc7591.html#section-2\n redirect_uris: z.array(oauthRedirectUriSchema).nonempty(),\n response_types: z\n .array(oauthResponseTypeSchema)\n .nonempty()\n // > If omitted, the default is that the client will use only the \"code\"\n // > response type.\n .default(['code']),\n grant_types: z\n .array(oauthGrantTypeSchema)\n .nonempty()\n // > If omitted, the default behavior is that the client will use only the\n // > \"authorization_code\" Grant Type.\n .default(['authorization_code']),\n scope: oauthScopeSchema.optional(),\n // https://www.rfc-editor.org/rfc/rfc7591.html#section-2\n token_endpoint_auth_method: oauthEndpointAuthMethod\n // > If unspecified or omitted, the default is \"client_secret_basic\" [...].\n .default('client_secret_basic'),\n token_endpoint_auth_signing_alg: z.string().optional(),\n userinfo_signed_response_alg: z.string().optional(),\n userinfo_encrypted_response_alg: z.string().optional(),\n jwks_uri: webUriSchema.optional(),\n jwks: jwksPubSchema.optional(),\n application_type: z.enum(['web', 'native']).default('web'), // default, per spec, is \"web\"\n subject_type: z.enum(['public', 'pairwise']).default('public'),\n request_object_signing_alg: z.string().optional(),\n id_token_signed_response_alg: z.string().optional(),\n authorization_signed_response_alg: z.string().default('RS256'),\n authorization_encrypted_response_enc: z.enum(['A128CBC-HS256']).optional(),\n authorization_encrypted_response_alg: z.string().optional(),\n client_id: oauthClientIdSchema.optional(),\n client_name: z.string().optional(),\n client_uri: webUriSchema.optional(),\n policy_uri: webUriSchema.optional(),\n tos_uri: webUriSchema.optional(),\n logo_uri: webUriSchema.optional(), // @TODO: allow data: uri ?\n\n /**\n * Default Maximum Authentication Age. Specifies that the End-User MUST be\n * actively authenticated if the End-User was authenticated longer ago than\n * the specified number of seconds. The max_age request parameter overrides\n * this default value. If omitted, no default Maximum Authentication Age is\n * specified.\n */\n default_max_age: z.number().optional(),\n require_auth_time: z.boolean().optional(),\n contacts: z.array(z.string().email()).optional(),\n tls_client_certificate_bound_access_tokens: z.boolean().optional(),\n\n // https://datatracker.ietf.org/doc/html/rfc9449#section-5.2\n dpop_bound_access_tokens: z.boolean().optional(),\n\n // https://datatracker.ietf.org/doc/html/rfc9396#section-14.5\n authorization_details_types: z.array(z.string()).optional(),\n})\n\nexport type OAuthClientMetadata = z.infer<typeof oauthClientMetadataSchema>\nexport type OAuthClientMetadataInput = z.input<typeof oauthClientMetadataSchema>\n"]}
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthCodeChallengeMethodSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthCodeChallengeMethodSchema = zod_1.z.enum(['S256', 'plain']);
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthCodeChallengeMethodSchema = z.enum(['S256', 'plain']);
|
|
6
3
|
//# sourceMappingURL=oauth-code-challenge-method.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-code-challenge-method.js","sourceRoot":"","sources":["../src/oauth-code-challenge-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-code-challenge-method.js","sourceRoot":"","sources":["../src/oauth-code-challenge-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthCodeChallengeMethodSchema = z.enum(['S256', 'plain'])\n"]}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthEndpointAuthMethod = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthEndpointAuthMethod = zod_1.z.enum([
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthEndpointAuthMethod = z.enum([
|
|
6
3
|
'client_secret_basic',
|
|
7
4
|
'client_secret_jwt',
|
|
8
5
|
'client_secret_post',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-endpoint-auth-method.js","sourceRoot":"","sources":["../src/oauth-endpoint-auth-method.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-endpoint-auth-method.js","sourceRoot":"","sources":["../src/oauth-endpoint-auth-method.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAAC;IAC5C,qBAAqB;IACrB,mBAAmB;IACnB,oBAAoB;IACpB,MAAM;IACN,iBAAiB;IACjB,6BAA6B;IAC7B,iBAAiB;CAClB,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthEndpointAuthMethod = z.enum([\n 'client_secret_basic',\n 'client_secret_jwt',\n 'client_secret_post',\n 'none',\n 'private_key_jwt',\n 'self_signed_tls_client_auth',\n 'tls_client_auth',\n])\n\nexport type OauthEndpointAuthMethod = z.infer<typeof oauthEndpointAuthMethod>\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-endpoint-name.js","sourceRoot":"","sources":["../src/oauth-endpoint-name.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-endpoint-name.js","sourceRoot":"","sources":["../src/oauth-endpoint-name.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,OAAO;IACP,YAAY;IACZ,eAAe;IACf,8BAA8B;CACtB,CAAA","sourcesContent":["export const OAUTH_ENDPOINT_NAMES = [\n 'token',\n 'revocation',\n 'introspection',\n 'pushed_authorization_request',\n] as const\n\nexport type OAuthEndpointName = (typeof OAUTH_ENDPOINT_NAMES)[number]\n"]}
|
package/dist/oauth-grant-type.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.oauthGrantTypeSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
exports.oauthGrantTypeSchema = zod_1.z.enum([
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const oauthGrantTypeSchema = z.enum([
|
|
6
3
|
'authorization_code',
|
|
7
4
|
'implicit',
|
|
8
5
|
'refresh_token',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-grant-type.js","sourceRoot":"","sources":["../src/oauth-grant-type.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"oauth-grant-type.js","sourceRoot":"","sources":["../src/oauth-grant-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC;IACzC,oBAAoB;IACpB,UAAU;IACV,eAAe;IACf,UAAU,EAAE,wBAAwB;IACpC,oBAAoB;IACpB,6CAA6C;IAC7C,+CAA+C;CAChD,CAAC,CAAA","sourcesContent":["import { z } from 'zod'\n\nexport const oauthGrantTypeSchema = z.enum([\n 'authorization_code',\n 'implicit',\n 'refresh_token',\n 'password', // Not part of OAuth 2.1\n 'client_credentials',\n 'urn:ietf:params:oauth:grant-type:jwt-bearer',\n 'urn:ietf:params:oauth:grant-type:saml2-bearer',\n])\n\nexport type OAuthGrantType = z.infer<typeof oauthGrantTypeSchema>\n"]}
|