@atproto/oauth-types 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +44 -0
- package/dist/atproto-loopback-client-metadata.d.ts.map +1 -1
- package/dist/atproto-loopback-client-metadata.js +4 -16
- package/dist/atproto-loopback-client-metadata.js.map +1 -1
- package/dist/constants.d.ts +0 -6
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +1 -17
- package/dist/constants.js.map +1 -1
- package/dist/index.d.ts +18 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/oauth-access-token.d.ts +4 -0
- package/dist/oauth-access-token.d.ts.map +1 -0
- package/dist/oauth-access-token.js +6 -0
- package/dist/oauth-access-token.js.map +1 -0
- package/dist/oauth-authorization-code-grant-token-request.d.ts +20 -0
- package/dist/oauth-authorization-code-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-authorization-code-grant-token-request.js +17 -0
- package/dist/oauth-authorization-code-grant-token-request.js.map +1 -0
- package/dist/oauth-authorization-request-jar.d.ts +16 -0
- package/dist/oauth-authorization-request-jar.d.ts.map +1 -0
- package/dist/oauth-authorization-request-jar.js +15 -0
- package/dist/oauth-authorization-request-jar.js.map +1 -0
- package/dist/oauth-authorization-request-par.d.ts +122 -0
- package/dist/oauth-authorization-request-par.d.ts.map +1 -0
- package/dist/oauth-authorization-request-par.js +11 -0
- package/dist/oauth-authorization-request-par.js.map +1 -0
- package/dist/{oauth-authentication-request-parameters.d.ts → oauth-authorization-request-parameters.d.ts} +18 -18
- package/dist/oauth-authorization-request-parameters.d.ts.map +1 -0
- package/dist/{oauth-authentication-request-parameters.js → oauth-authorization-request-parameters.js} +16 -17
- package/dist/oauth-authorization-request-parameters.js.map +1 -0
- package/dist/oauth-authorization-request-query.d.ts +128 -0
- package/dist/oauth-authorization-request-query.d.ts.map +1 -0
- package/dist/oauth-authorization-request-query.js +13 -0
- package/dist/oauth-authorization-request-query.js.map +1 -0
- package/dist/oauth-authorization-request-uri.d.ts +10 -0
- package/dist/oauth-authorization-request-uri.d.ts.map +1 -0
- package/dist/oauth-authorization-request-uri.js +9 -0
- package/dist/oauth-authorization-request-uri.js.map +1 -0
- package/dist/oauth-authorization-server-metadata.d.ts +16 -16
- package/dist/oauth-authorization-server-metadata.d.ts.map +1 -1
- package/dist/oauth-authorization-server-metadata.js +5 -1
- package/dist/oauth-authorization-server-metadata.js.map +1 -1
- package/dist/oauth-client-credentials-grant-token-request.d.ts +10 -0
- package/dist/oauth-client-credentials-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-client-credentials-grant-token-request.js +8 -0
- package/dist/oauth-client-credentials-grant-token-request.js.map +1 -0
- package/dist/oauth-client-credentials.d.ts +18 -2
- package/dist/oauth-client-credentials.d.ts.map +1 -1
- package/dist/oauth-client-credentials.js +8 -2
- package/dist/oauth-client-credentials.js.map +1 -1
- package/dist/oauth-client-id-discoverable.d.ts +3 -2
- package/dist/oauth-client-id-discoverable.d.ts.map +1 -1
- package/dist/oauth-client-id-discoverable.js +22 -20
- package/dist/oauth-client-id-discoverable.js.map +1 -1
- package/dist/oauth-client-id-loopback.d.ts +10 -3
- package/dist/oauth-client-id-loopback.d.ts.map +1 -1
- package/dist/oauth-client-id-loopback.js +59 -23
- package/dist/oauth-client-id-loopback.js.map +1 -1
- package/dist/oauth-client-metadata.d.ts +91 -91
- package/dist/oauth-client-metadata.d.ts.map +1 -1
- package/dist/oauth-client-metadata.js +2 -1
- package/dist/oauth-client-metadata.js.map +1 -1
- package/dist/oauth-code-challenge-method.d.ts +3 -0
- package/dist/oauth-code-challenge-method.d.ts.map +1 -0
- package/dist/oauth-code-challenge-method.js +6 -0
- package/dist/oauth-code-challenge-method.js.map +1 -0
- package/dist/oauth-introspection-response.d.ts +20 -0
- package/dist/oauth-introspection-response.d.ts.map +1 -0
- package/dist/oauth-introspection-response.js +3 -0
- package/dist/oauth-introspection-response.js.map +1 -0
- package/dist/oauth-issuer-identifier.d.ts +2 -1
- package/dist/oauth-issuer-identifier.d.ts.map +1 -1
- package/dist/oauth-issuer-identifier.js +13 -12
- package/dist/oauth-issuer-identifier.js.map +1 -1
- package/dist/oauth-par-response.d.ts +3 -0
- package/dist/oauth-par-response.d.ts.map +1 -1
- package/dist/oauth-par-response.js +1 -0
- package/dist/oauth-par-response.js.map +1 -1
- package/dist/oauth-password-grant-token-request.d.ts +16 -0
- package/dist/oauth-password-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-password-grant-token-request.js +10 -0
- package/dist/oauth-password-grant-token-request.js.map +1 -0
- package/dist/oauth-protected-resource-metadata.d.ts +2 -2
- package/dist/oauth-refresh-token-grant-token-request.d.ts +13 -0
- package/dist/oauth-refresh-token-grant-token-request.d.ts.map +1 -0
- package/dist/oauth-refresh-token-grant-token-request.js +10 -0
- package/dist/oauth-refresh-token-grant-token-request.js.map +1 -0
- package/dist/oauth-refresh-token.d.ts +4 -0
- package/dist/oauth-refresh-token.d.ts.map +1 -0
- package/dist/oauth-refresh-token.js +6 -0
- package/dist/oauth-refresh-token.js.map +1 -0
- package/dist/oauth-request-uri.d.ts +4 -0
- package/dist/oauth-request-uri.d.ts.map +1 -0
- package/dist/oauth-request-uri.js +6 -0
- package/dist/oauth-request-uri.js.map +1 -0
- package/dist/oauth-scope.d.ts +10 -0
- package/dist/oauth-scope.d.ts.map +1 -0
- package/dist/oauth-scope.js +16 -0
- package/dist/oauth-scope.js.map +1 -0
- package/dist/oauth-token-identification.d.ts +13 -0
- package/dist/oauth-token-identification.d.ts.map +1 -0
- package/dist/oauth-token-identification.js +11 -0
- package/dist/oauth-token-identification.js.map +1 -0
- package/dist/oauth-token-request.d.ts +46 -0
- package/dist/oauth-token-request.d.ts.map +1 -0
- package/dist/oauth-token-request.js +15 -0
- package/dist/oauth-token-request.js.map +1 -0
- package/dist/oauth-token-response.d.ts +3 -6
- package/dist/oauth-token-response.d.ts.map +1 -1
- package/dist/oauth-token-response.js +4 -2
- package/dist/oauth-token-response.js.map +1 -1
- package/dist/util.d.ts +2 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +36 -6
- package/dist/util.js.map +1 -1
- package/package.json +2 -2
- package/src/atproto-loopback-client-metadata.ts +7 -20
- package/src/constants.ts +0 -16
- package/src/index.ts +18 -5
- package/src/oauth-access-token.ts +4 -0
- package/src/oauth-authorization-code-grant-token-request.ts +18 -0
- package/src/oauth-authorization-request-jar.ts +16 -0
- package/src/oauth-authorization-request-par.ts +13 -0
- package/src/{oauth-authentication-request-parameters.ts → oauth-authorization-request-parameters.ts} +21 -22
- package/src/oauth-authorization-request-query.ts +15 -0
- package/src/oauth-authorization-request-uri.ts +11 -0
- package/src/oauth-authorization-server-metadata.ts +5 -1
- package/src/oauth-client-credentials-grant-token-request.ts +9 -0
- package/src/oauth-client-credentials.ts +21 -1
- package/src/oauth-client-id-discoverable.ts +29 -26
- package/src/oauth-client-id-loopback.ts +78 -30
- package/src/oauth-client-metadata.ts +2 -1
- package/src/oauth-code-challenge-method.ts +3 -0
- package/src/oauth-introspection-response.ts +23 -0
- package/src/oauth-issuer-identifier.ts +17 -12
- package/src/oauth-par-response.ts +1 -0
- package/src/oauth-password-grant-token-request.ts +11 -0
- package/src/oauth-refresh-token-grant-token-request.ts +11 -0
- package/src/oauth-refresh-token.ts +4 -0
- package/src/oauth-request-uri.ts +5 -0
- package/src/oauth-scope.ts +15 -0
- package/src/oauth-token-identification.ts +12 -0
- package/src/oauth-token-request.ts +14 -0
- package/src/oauth-token-response.ts +4 -2
- package/src/util.ts +41 -1
- package/tsconfig.build.tsbuildinfo +1 -0
- package/dist/access-token.d.ts +0 -4
- package/dist/access-token.d.ts.map +0 -1
- package/dist/access-token.js +0 -6
- package/dist/access-token.js.map +0 -1
- package/dist/oauth-authentication-request-parameters.d.ts.map +0 -1
- package/dist/oauth-authentication-request-parameters.js.map +0 -1
- package/dist/oauth-client-id-url.d.ts +0 -3
- package/dist/oauth-client-id-url.d.ts.map +0 -1
- package/dist/oauth-client-id-url.js +0 -21
- package/dist/oauth-client-id-url.js.map +0 -1
- package/dist/oauth-client-identification.d.ts +0 -31
- package/dist/oauth-client-identification.d.ts.map +0 -1
- package/dist/oauth-client-identification.js +0 -12
- package/dist/oauth-client-identification.js.map +0 -1
- package/src/access-token.ts +0 -4
- package/src/oauth-client-id-url.ts +0 -25
- package/src/oauth-client-identification.ts +0 -14
@@ -1,7 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
3
|
+
exports.isOAuthClientIdDiscoverable = isOAuthClientIdDiscoverable;
|
4
|
+
exports.assertOAuthDiscoverableClientId = assertOAuthDiscoverableClientId;
|
5
|
+
exports.parseOAuthDiscoverableClientId = parseOAuthDiscoverableClientId;
|
5
6
|
const util_js_1 = require("./util.js");
|
6
7
|
function isOAuthClientIdDiscoverable(clientId) {
|
7
8
|
try {
|
@@ -12,37 +13,38 @@ function isOAuthClientIdDiscoverable(clientId) {
|
|
12
13
|
return false;
|
13
14
|
}
|
14
15
|
}
|
15
|
-
|
16
|
+
function assertOAuthDiscoverableClientId(value) {
|
17
|
+
void parseOAuthDiscoverableClientId(value);
|
18
|
+
}
|
16
19
|
function parseOAuthDiscoverableClientId(clientId) {
|
17
|
-
const url =
|
18
|
-
// Optimization: cheap checks first
|
19
|
-
if (url.hostname === 'localhost') {
|
20
|
-
throw new TypeError('ClientID must not be a loopback hostname');
|
21
|
-
}
|
20
|
+
const url = new URL(clientId);
|
22
21
|
if (url.protocol !== 'https:') {
|
23
22
|
throw new TypeError('ClientID must use the "https:" protocol');
|
24
23
|
}
|
24
|
+
if (url.username || url.password) {
|
25
|
+
throw new TypeError('ClientID must not contain credentials');
|
26
|
+
}
|
25
27
|
if (url.hash) {
|
26
28
|
throw new TypeError('ClientID must not contain a fragment');
|
27
29
|
}
|
28
|
-
if (url.
|
29
|
-
throw new TypeError('ClientID must not
|
30
|
+
if (url.hostname === 'localhost') {
|
31
|
+
throw new TypeError('ClientID hostname must not be "localhost"');
|
30
32
|
}
|
31
33
|
if (url.pathname === '/') {
|
32
|
-
throw new TypeError('ClientID must contain a path (e.g. "/client-metadata")');
|
34
|
+
throw new TypeError('ClientID must contain a path component (e.g. "/client-metadata.json")');
|
33
35
|
}
|
34
|
-
if (url.pathname
|
35
|
-
throw new TypeError('ClientID must not end with a trailing slash');
|
36
|
+
if (url.pathname.endsWith('/')) {
|
37
|
+
throw new TypeError('ClientID path must not end with a trailing slash');
|
36
38
|
}
|
37
|
-
if (url.
|
38
|
-
throw new TypeError(
|
39
|
+
if ((0, util_js_1.isHostnameIP)(url.hostname)) {
|
40
|
+
throw new TypeError('ClientID hostname must not be an IP address');
|
39
41
|
}
|
40
|
-
//
|
41
|
-
//
|
42
|
-
|
43
|
-
|
42
|
+
// URL constructor normalizes the URL, so we extract the path manually to
|
43
|
+
// avoid normalization, then compare it to the normalized path to ensure
|
44
|
+
// that the URL does not contain path traversal or other unexpected characters
|
45
|
+
if ((0, util_js_1.extractUrlPath)(clientId) !== url.pathname) {
|
46
|
+
throw new TypeError(`ClientID must be in canonical form ("${url.href}", got "${clientId}")`);
|
44
47
|
}
|
45
48
|
return url;
|
46
49
|
}
|
47
|
-
exports.parseOAuthDiscoverableClientId = parseOAuthDiscoverableClientId;
|
48
50
|
//# 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":";;AAQA,kEASC;AAED,0EAIC;AAED,wEA2CC;AAnED,uCAAwD;AAOxD,SAAgB,2BAA2B,CACzC,QAAgB;IAEhB,IAAI,CAAC;QACH,8BAA8B,CAAC,QAAQ,CAAC,CAAA;QACxC,OAAO,IAAI,CAAA;IACb,CAAC;IAA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9C,MAAM,IAAI,SAAS,CACjB,wCAAwC,GAAG,CAAC,IAAI,WAAW,QAAQ,IAAI,CACxE,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
@@ -1,5 +1,12 @@
|
|
1
1
|
import { OAuthClientId } from './oauth-client-id.js';
|
2
|
-
|
3
|
-
|
4
|
-
export
|
2
|
+
import { OAuthScope } from './oauth-scope.js';
|
3
|
+
declare const OAUTH_CLIENT_ID_LOOPBACK_URL = "http://localhost";
|
4
|
+
export type OAuthClientIdLoopback = OAuthClientId & `${typeof OAUTH_CLIENT_ID_LOOPBACK_URL}${'' | '/'}${'' | `?${string}`}`;
|
5
|
+
export declare function isOAuthClientIdLoopback(clientId: string): clientId is OAuthClientIdLoopback;
|
6
|
+
export declare function assertOAuthLoopbackClientId(clientId: string): asserts clientId is OAuthClientIdLoopback;
|
7
|
+
export declare function parseOAuthLoopbackClientId(clientId: string): {
|
8
|
+
scope?: OAuthScope;
|
9
|
+
redirect_uris?: [string, ...string[]];
|
10
|
+
};
|
11
|
+
export {};
|
5
12
|
//# sourceMappingURL=oauth-client-id-loopback.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"oauth-client-id-loopback.d.ts","sourceRoot":"","sources":["../src/oauth-client-id-loopback.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"oauth-client-id-loopback.d.ts","sourceRoot":"","sources":["../src/oauth-client-id-loopback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAA;AAG/D,QAAA,MAAM,4BAA4B,qBAAqB,CAAA;AAEvD,MAAM,MAAM,qBAAqB,GAAG,aAAa,GAC/C,GAAG,OAAO,4BAA4B,GAAG,EAAE,GAAG,GAAG,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,EAAE,CAAA;AAEzE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,GACf,QAAQ,IAAI,qBAAqB,CAOnC;AAED,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,IAAI,qBAAqB,CAE3C;AAID,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG;IAC5D,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;CACtC,CA0EA"}
|
@@ -1,7 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
|
3
|
+
exports.isOAuthClientIdLoopback = isOAuthClientIdLoopback;
|
4
|
+
exports.assertOAuthLoopbackClientId = assertOAuthLoopbackClientId;
|
5
|
+
exports.parseOAuthLoopbackClientId = parseOAuthLoopbackClientId;
|
6
|
+
const oauth_scope_js_1 = require("./oauth-scope.js");
|
7
|
+
const util_js_1 = require("./util.js");
|
8
|
+
const OAUTH_CLIENT_ID_LOOPBACK_URL = 'http://localhost';
|
5
9
|
function isOAuthClientIdLoopback(clientId) {
|
6
10
|
try {
|
7
11
|
parseOAuthLoopbackClientId(clientId);
|
@@ -11,34 +15,66 @@ function isOAuthClientIdLoopback(clientId) {
|
|
11
15
|
return false;
|
12
16
|
}
|
13
17
|
}
|
14
|
-
|
18
|
+
function assertOAuthLoopbackClientId(clientId) {
|
19
|
+
void parseOAuthLoopbackClientId(clientId);
|
20
|
+
}
|
21
|
+
// @TODO: should we turn this into a zod schema? (more coherent error with other
|
22
|
+
// validation functions)
|
15
23
|
function parseOAuthLoopbackClientId(clientId) {
|
16
|
-
|
17
|
-
|
18
|
-
if (url.protocol !== 'http:') {
|
19
|
-
throw new TypeError('Loopback ClientID must use the "http:" protocol');
|
24
|
+
if (!clientId.startsWith(OAUTH_CLIENT_ID_LOOPBACK_URL)) {
|
25
|
+
throw new TypeError(`Loopback ClientID must start with "${OAUTH_CLIENT_ID_LOOPBACK_URL}"`);
|
20
26
|
}
|
21
|
-
if (
|
22
|
-
throw new TypeError('Loopback ClientID must
|
27
|
+
else if (clientId.includes('#', OAUTH_CLIENT_ID_LOOPBACK_URL.length)) {
|
28
|
+
throw new TypeError('Loopback ClientID must not contain a hash component');
|
23
29
|
}
|
24
|
-
|
25
|
-
|
30
|
+
const queryStringIdx = clientId.length > OAUTH_CLIENT_ID_LOOPBACK_URL.length &&
|
31
|
+
clientId[OAUTH_CLIENT_ID_LOOPBACK_URL.length] === '/'
|
32
|
+
? OAUTH_CLIENT_ID_LOOPBACK_URL.length + 1
|
33
|
+
: OAUTH_CLIENT_ID_LOOPBACK_URL.length;
|
34
|
+
if (clientId.length === queryStringIdx) {
|
35
|
+
return {}; // no query string to parse
|
26
36
|
}
|
27
|
-
if (
|
28
|
-
throw new TypeError('Loopback ClientID must not contain
|
37
|
+
if (clientId[queryStringIdx] !== '?') {
|
38
|
+
throw new TypeError('Loopback ClientID must not contain a path component');
|
29
39
|
}
|
30
|
-
|
31
|
-
|
40
|
+
const searchParams = new URLSearchParams(clientId.slice(queryStringIdx + 1));
|
41
|
+
for (const name of searchParams.keys()) {
|
42
|
+
if (name !== 'redirect_uri' && name !== 'scope') {
|
43
|
+
throw new TypeError(`Invalid query parameter "${name}" in client ID`);
|
44
|
+
}
|
32
45
|
}
|
33
|
-
|
34
|
-
if (
|
35
|
-
|
46
|
+
const scope = searchParams.get('scope') ?? undefined;
|
47
|
+
if (scope != null) {
|
48
|
+
if (searchParams.getAll('scope').length > 1) {
|
49
|
+
throw new TypeError('Loopback ClientID must contain at most one scope query parameter');
|
50
|
+
}
|
51
|
+
else if (!oauth_scope_js_1.oauthScopeSchema.safeParse(scope).success) {
|
52
|
+
throw new TypeError('Invalid scope query parameter in client ID');
|
53
|
+
}
|
36
54
|
}
|
37
|
-
|
38
|
-
|
55
|
+
const redirect_uris = searchParams.has('redirect_uri')
|
56
|
+
? searchParams.getAll('redirect_uri')
|
57
|
+
: undefined;
|
58
|
+
if (redirect_uris) {
|
59
|
+
for (const uri of redirect_uris) {
|
60
|
+
const url = (0, util_js_1.safeUrl)(uri);
|
61
|
+
if (!url) {
|
62
|
+
throw new TypeError(`Invalid redirect_uri in client ID: ${uri}`);
|
63
|
+
}
|
64
|
+
if (url.protocol !== 'http:') {
|
65
|
+
throw new TypeError(`Loopback ClientID must use "http:" redirect_uri's (got ${uri})`);
|
66
|
+
}
|
67
|
+
if (url.hostname === 'localhost') {
|
68
|
+
throw new TypeError(`Loopback ClientID must not use "localhost" as redirect_uri hostname (got ${uri})`);
|
69
|
+
}
|
70
|
+
if (!(0, util_js_1.isLoopbackHost)(url.hostname)) {
|
71
|
+
throw new TypeError(`Loopback ClientID must use loopback addresses as redirect_uri's (got ${uri})`);
|
72
|
+
}
|
73
|
+
}
|
39
74
|
}
|
40
|
-
|
41
|
-
|
75
|
+
return {
|
76
|
+
scope,
|
77
|
+
redirect_uris,
|
78
|
+
};
|
42
79
|
}
|
43
|
-
exports.parseOAuthLoopbackClientId = parseOAuthLoopbackClientId;
|
44
80
|
//# sourceMappingURL=oauth-client-id-loopback.js.map
|
@@ -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":";;AASA,0DASC;AAED,kEAIC;AAID,gEA6EC;AAxGD,qDAA+D;AAC/D,uCAAmD;AAEnD,MAAM,4BAA4B,GAAG,kBAAkB,CAAA;AAKvD,SAAgB,uBAAuB,CACrC,QAAgB;IAEhB,IAAI,CAAC;QACH,0BAA0B,CAAC,QAAQ,CAAC,CAAA;QACpC,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;A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