@atcute/oauth-types 0.1.0 → 1.0.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/README.md +6 -5
- package/dist/build-client-metadata.d.ts +18 -160
- package/dist/build-client-metadata.d.ts.map +1 -1
- package/dist/build-client-metadata.js +73 -3
- package/dist/build-client-metadata.js.map +1 -1
- package/dist/index.d.ts +31 -30
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/schemas/atcute-client-shared.d.ts +8 -0
- package/dist/schemas/atcute-client-shared.d.ts.map +1 -0
- package/dist/schemas/atcute-client-shared.js +15 -0
- package/dist/schemas/atcute-client-shared.js.map +1 -0
- package/dist/schemas/atcute-confidential-client-metadata.d.ts +228 -4
- package/dist/schemas/atcute-confidential-client-metadata.d.ts.map +1 -1
- package/dist/schemas/atcute-confidential-client-metadata.js +48 -88
- package/dist/schemas/atcute-confidential-client-metadata.js.map +1 -1
- package/dist/schemas/atcute-public-client-metadata.d.ts +95 -0
- package/dist/schemas/atcute-public-client-metadata.d.ts.map +1 -0
- package/dist/schemas/atcute-public-client-metadata.js +74 -0
- package/dist/schemas/atcute-public-client-metadata.js.map +1 -0
- package/dist/schemas/atproto-authorization-server-metadata.d.ts +786 -4
- package/dist/schemas/atproto-authorization-server-metadata.d.ts.map +1 -1
- package/dist/schemas/atproto-authorization-server-metadata.js +2 -18
- package/dist/schemas/atproto-authorization-server-metadata.js.map +1 -1
- package/dist/schemas/atproto-oauth-scope.d.ts +3 -3
- package/dist/schemas/atproto-oauth-scope.d.ts.map +1 -1
- package/dist/schemas/atproto-oauth-scope.js +2 -2
- package/dist/schemas/atproto-oauth-scope.js.map +1 -1
- package/dist/schemas/atproto-oauth-token-response.d.ts +17 -17
- package/dist/schemas/atproto-oauth-token-response.d.ts.map +1 -1
- package/dist/schemas/atproto-oauth-token-response.js +6 -6
- package/dist/schemas/atproto-oauth-token-response.js.map +1 -1
- package/dist/schemas/atproto-protected-resource-metadata.d.ts +100 -4
- package/dist/schemas/atproto-protected-resource-metadata.d.ts.map +1 -1
- package/dist/schemas/atproto-protected-resource-metadata.js +2 -11
- package/dist/schemas/atproto-protected-resource-metadata.js.map +1 -1
- package/dist/schemas/jwk.d.ts +4289 -42
- package/dist/schemas/jwk.d.ts.map +1 -1
- package/dist/schemas/jwk.js +58 -91
- package/dist/schemas/jwk.js.map +1 -1
- package/dist/schemas/jwks.d.ts +87 -42
- package/dist/schemas/jwks.d.ts.map +1 -1
- package/dist/schemas/jwks.js +13 -29
- package/dist/schemas/jwks.js.map +1 -1
- package/dist/schemas/oauth-authorization-details.d.ts +18 -18
- package/dist/schemas/oauth-authorization-details.d.ts.map +1 -1
- package/dist/schemas/oauth-authorization-details.js +7 -7
- package/dist/schemas/oauth-authorization-details.js.map +1 -1
- package/dist/schemas/oauth-authorization-server-metadata.d.ts +462 -48
- package/dist/schemas/oauth-authorization-server-metadata.d.ts.map +1 -1
- package/dist/schemas/oauth-authorization-server-metadata.js +46 -65
- package/dist/schemas/oauth-authorization-server-metadata.js.map +1 -1
- package/dist/schemas/oauth-client-id-discoverable.d.ts +2 -2
- package/dist/schemas/oauth-client-id-discoverable.d.ts.map +1 -1
- package/dist/schemas/oauth-client-id-discoverable.js +20 -22
- package/dist/schemas/oauth-client-id-discoverable.js.map +1 -1
- package/dist/schemas/oauth-client-id.d.ts +3 -3
- package/dist/schemas/oauth-client-id.d.ts.map +1 -1
- package/dist/schemas/oauth-client-id.js +2 -2
- package/dist/schemas/oauth-client-id.js.map +1 -1
- package/dist/schemas/oauth-client-metadata.d.ts +73 -51
- package/dist/schemas/oauth-client-metadata.d.ts.map +1 -1
- package/dist/schemas/oauth-client-metadata.js +33 -40
- package/dist/schemas/oauth-client-metadata.js.map +1 -1
- package/dist/schemas/oauth-code-challenge-method.d.ts +3 -3
- package/dist/schemas/oauth-code-challenge-method.d.ts.map +1 -1
- package/dist/schemas/oauth-code-challenge-method.js +2 -2
- package/dist/schemas/oauth-code-challenge-method.js.map +1 -1
- package/dist/schemas/oauth-endpoint-auth-method.d.ts +3 -3
- package/dist/schemas/oauth-endpoint-auth-method.d.ts.map +1 -1
- package/dist/schemas/oauth-endpoint-auth-method.js +10 -2
- package/dist/schemas/oauth-endpoint-auth-method.js.map +1 -1
- package/dist/schemas/oauth-grant-type.d.ts +3 -3
- package/dist/schemas/oauth-grant-type.d.ts.map +1 -1
- package/dist/schemas/oauth-grant-type.js +10 -3
- package/dist/schemas/oauth-grant-type.js.map +1 -1
- package/dist/schemas/oauth-issuer-identifier.d.ts +3 -3
- package/dist/schemas/oauth-issuer-identifier.d.ts.map +1 -1
- package/dist/schemas/oauth-issuer-identifier.js +16 -9
- package/dist/schemas/oauth-issuer-identifier.js.map +1 -1
- package/dist/schemas/oauth-par-response.d.ts +5 -5
- package/dist/schemas/oauth-par-response.d.ts.map +1 -1
- package/dist/schemas/oauth-par-response.js +3 -3
- package/dist/schemas/oauth-par-response.js.map +1 -1
- package/dist/schemas/oauth-prompt.d.ts +3 -3
- package/dist/schemas/oauth-prompt.d.ts.map +1 -1
- package/dist/schemas/oauth-prompt.js +2 -2
- package/dist/schemas/oauth-prompt.js.map +1 -1
- package/dist/schemas/oauth-protected-resource-metadata.d.ts +88 -16
- package/dist/schemas/oauth-protected-resource-metadata.d.ts.map +1 -1
- package/dist/schemas/oauth-protected-resource-metadata.js +14 -26
- package/dist/schemas/oauth-protected-resource-metadata.js.map +1 -1
- package/dist/schemas/oauth-redirect-uri.d.ts +5 -5
- package/dist/schemas/oauth-redirect-uri.d.ts.map +1 -1
- package/dist/schemas/oauth-redirect-uri.js +3 -16
- package/dist/schemas/oauth-redirect-uri.js.map +1 -1
- package/dist/schemas/oauth-response-mode.d.ts +3 -3
- package/dist/schemas/oauth-response-mode.d.ts.map +1 -1
- package/dist/schemas/oauth-response-mode.js +2 -2
- package/dist/schemas/oauth-response-mode.js.map +1 -1
- package/dist/schemas/oauth-response-type.d.ts +3 -3
- package/dist/schemas/oauth-response-type.d.ts.map +1 -1
- package/dist/schemas/oauth-response-type.js +13 -7
- package/dist/schemas/oauth-response-type.js.map +1 -1
- package/dist/schemas/oauth-scope.d.ts +3 -3
- package/dist/schemas/oauth-scope.d.ts.map +1 -1
- package/dist/schemas/oauth-scope.js +2 -2
- package/dist/schemas/oauth-scope.js.map +1 -1
- package/dist/schemas/oauth-token-response.d.ts +17 -17
- package/dist/schemas/oauth-token-response.d.ts.map +1 -1
- package/dist/schemas/oauth-token-response.js +7 -7
- package/dist/schemas/oauth-token-response.js.map +1 -1
- package/dist/schemas/oauth-token-type.d.ts +3 -3
- package/dist/schemas/oauth-token-type.d.ts.map +1 -1
- package/dist/schemas/oauth-token-type.js +8 -7
- package/dist/schemas/oauth-token-type.js.map +1 -1
- package/dist/schemas/uri.d.ts +7 -7
- package/dist/schemas/uri.d.ts.map +1 -1
- package/dist/schemas/uri.js +44 -44
- package/dist/schemas/uri.js.map +1 -1
- package/dist/schemas/utils.d.ts.map +1 -1
- package/dist/schemas/utils.js.map +1 -1
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js.map +1 -1
- package/lib/build-client-metadata.ts +92 -6
- package/lib/index.ts +38 -30
- package/lib/schemas/atcute-client-shared.ts +25 -0
- package/lib/schemas/atcute-confidential-client-metadata.ts +81 -111
- package/lib/schemas/atcute-public-client-metadata.ts +101 -0
- package/lib/schemas/atproto-authorization-server-metadata.ts +22 -23
- package/lib/schemas/atproto-oauth-scope.ts +8 -5
- package/lib/schemas/atproto-oauth-token-response.ts +10 -9
- package/lib/schemas/atproto-protected-resource-metadata.ts +15 -15
- package/lib/schemas/jwk.ts +104 -120
- package/lib/schemas/jwks.ts +28 -40
- package/lib/schemas/oauth-authorization-details.ts +10 -10
- package/lib/schemas/oauth-authorization-server-metadata.ts +72 -74
- package/lib/schemas/oauth-client-id-discoverable.ts +43 -48
- package/lib/schemas/oauth-client-id.ts +3 -3
- package/lib/schemas/oauth-client-metadata.ts +45 -49
- package/lib/schemas/oauth-code-challenge-method.ts +3 -3
- package/lib/schemas/oauth-endpoint-auth-method.ts +11 -11
- package/lib/schemas/oauth-grant-type.ts +11 -11
- package/lib/schemas/oauth-issuer-identifier.ts +35 -27
- package/lib/schemas/oauth-par-response.ts +4 -4
- package/lib/schemas/oauth-prompt.ts +3 -9
- package/lib/schemas/oauth-protected-resource-metadata.ts +26 -35
- package/lib/schemas/oauth-redirect-uri.ts +15 -23
- package/lib/schemas/oauth-response-mode.ts +3 -7
- package/lib/schemas/oauth-response-type.ts +12 -12
- package/lib/schemas/oauth-scope.ts +3 -3
- package/lib/schemas/oauth-token-response.ts +10 -10
- package/lib/schemas/oauth-token-type.ts +16 -12
- package/lib/schemas/uri.ts +89 -76
- package/package.json +9 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-authorization-server-metadata.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-authorization-server-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"atproto-authorization-server-metadata.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-authorization-server-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B;;;;GAIG;AACH,eAAO,MAAM,2CAA2C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAgB8B,MAAM;IAC3F,CAAC;AAEF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,WAAW,CAC7D,OAAO,2CAA2C,CAClD,CAAC"}
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
import * as v from '
|
|
1
|
+
import * as v from 'valibot';
|
|
2
2
|
import { oauthAuthorizationServerMetadataValidator } from './oauth-authorization-server-metadata.js';
|
|
3
3
|
/**
|
|
4
4
|
* AT Protocol authorization server metadata with required fields and assertions.
|
|
5
5
|
*
|
|
6
6
|
* @see {@link https://atproto.com/specs/oauth}
|
|
7
7
|
*/
|
|
8
|
-
export const atprotoAuthorizationServerMetadataValidator = oauthAuthorizationServerMetadataValidator.
|
|
9
|
-
// atproto requires client_id_metadata_document support
|
|
10
|
-
if (data.client_id_metadata_document_supported !== true) {
|
|
11
|
-
return v.err({
|
|
12
|
-
message: `atproto requires client_id_metadata_document_supported to be true`,
|
|
13
|
-
path: ['client_id_metadata_document_supported'],
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
// atproto requires PAR
|
|
17
|
-
if (!data.pushed_authorization_request_endpoint) {
|
|
18
|
-
return v.err({
|
|
19
|
-
message: `atproto requires pushed_authorization_request_endpoint to be true`,
|
|
20
|
-
path: ['pushed_authorization_request_endpoint'],
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return v.ok(data);
|
|
24
|
-
});
|
|
8
|
+
export const atprotoAuthorizationServerMetadataValidator = v.pipe(oauthAuthorizationServerMetadataValidator, v.forward(v.check((data) => data.client_id_metadata_document_supported === true, `atproto requires client_id_metadata_document_supported to be true`), ['client_id_metadata_document_supported']), v.forward(v.check((data) => !!data.pushed_authorization_request_endpoint, `atproto requires pushed_authorization_request_endpoint to be true`), ['pushed_authorization_request_endpoint']), v.transform((data) => data));
|
|
25
9
|
//# sourceMappingURL=atproto-authorization-server-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-authorization-server-metadata.js","sourceRoot":"","sources":["../../lib/schemas/atproto-authorization-server-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"atproto-authorization-server-metadata.js","sourceRoot":"","sources":["../../lib/schemas/atproto-authorization-server-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AAErG;;;;GAIG;AACH,MAAM,CAAC,MAAM,2CAA2C,GAAG,CAAC,CAAC,IAAI,CAChE,yCAAyC,EACzC,CAAC,CAAC,OAAO,CACR,CAAC,CAAC,KAAK,CACN,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,qCAAqC,KAAK,IAAI,EAC7D,mEAAmE,CACnE,EACD,CAAC,uCAAuC,CAAC,CACzC,EACD,CAAC,CAAC,OAAO,CACR,CAAC,CAAC,KAAK,CACN,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,qCAAqC,EACtD,mEAAmE,CACnE,EACD,CAAC,uCAAuC,CAAC,CACzC,EACD,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAuE,CAAC,CAC9F,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as v from '
|
|
1
|
+
import * as v from 'valibot';
|
|
2
2
|
export declare const ATPROTO_SCOPE_VALUE = "atproto";
|
|
3
3
|
/** atproto OAuth scope (must include "atproto") */
|
|
4
|
-
export declare const atprotoOAuthScopeSchema: v.
|
|
5
|
-
export type AtprotoOAuthScope = v.
|
|
4
|
+
export declare const atprotoOAuthScopeSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid atproto OAuth scope">]>;
|
|
5
|
+
export type AtprotoOAuthScope = v.InferOutput<typeof atprotoOAuthScopeSchema>;
|
|
6
6
|
/** default scope is for reading identity (did) only */
|
|
7
7
|
export declare const DEFAULT_ATPROTO_OAUTH_SCOPE: AtprotoOAuthScope;
|
|
8
8
|
//# sourceMappingURL=atproto-oauth-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-oauth-scope.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"atproto-oauth-scope.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAK7B,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAM7C,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,8GAGnC,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,uDAAuD;AACvD,eAAO,MAAM,2BAA2B,EAAE,iBAAuC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as v from '
|
|
1
|
+
import * as v from 'valibot';
|
|
2
2
|
import { isOAuthScope } from './oauth-scope.js';
|
|
3
3
|
import { isSpaceSeparatedValue } from './utils.js';
|
|
4
4
|
export const ATPROTO_SCOPE_VALUE = 'atproto';
|
|
@@ -6,7 +6,7 @@ const isAtprotoOAuthScope = (input) => {
|
|
|
6
6
|
return isOAuthScope(input) && isSpaceSeparatedValue(ATPROTO_SCOPE_VALUE, input);
|
|
7
7
|
};
|
|
8
8
|
/** atproto OAuth scope (must include "atproto") */
|
|
9
|
-
export const atprotoOAuthScopeSchema = v.string().
|
|
9
|
+
export const atprotoOAuthScopeSchema = v.pipe(v.string(), v.check(isAtprotoOAuthScope, `invalid atproto OAuth scope`));
|
|
10
10
|
/** default scope is for reading identity (did) only */
|
|
11
11
|
export const DEFAULT_ATPROTO_OAUTH_SCOPE = ATPROTO_SCOPE_VALUE;
|
|
12
12
|
//# sourceMappingURL=atproto-oauth-scope.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-oauth-scope.js","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"atproto-oauth-scope.js","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,CAAC;AAE7C,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAW,EAAE;IACtD,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;AACjF,CAAC,CAAC;AAEF,mDAAmD;AACnD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,IAAI,CAC5C,CAAC,CAAC,MAAM,EAAE,EACV,CAAC,CAAC,KAAK,CAAC,mBAAmB,EAAE,6BAA6B,CAAC,CAC3D,CAAC;AAIF,uDAAuD;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAsB,mBAAmB,CAAC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import * as v from '
|
|
2
|
-
export declare const atprotoOAuthTokenResponseSchema: v.
|
|
3
|
-
access_token: v.
|
|
4
|
-
token_type: v.
|
|
5
|
-
sub: v.
|
|
6
|
-
scope: v.
|
|
7
|
-
refresh_token: v.
|
|
8
|
-
expires_in: v.
|
|
9
|
-
authorization_details: v.
|
|
10
|
-
type:
|
|
11
|
-
locations
|
|
12
|
-
actions
|
|
13
|
-
datatypes
|
|
14
|
-
identifier
|
|
15
|
-
privileges
|
|
16
|
-
}
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const atprotoOAuthTokenResponseSchema: v.LooseObjectSchema<{
|
|
3
|
+
readonly access_token: v.StringSchema<undefined>;
|
|
4
|
+
readonly token_type: v.LiteralSchema<"DPoP", undefined>;
|
|
5
|
+
readonly sub: v.CustomSchema<`did:${string}:${string}`, v.ErrorMessage<v.CustomIssue> | undefined>;
|
|
6
|
+
readonly scope: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid atproto OAuth scope">]>;
|
|
7
|
+
readonly refresh_token: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
8
|
+
readonly expires_in: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
|
|
9
|
+
readonly authorization_details: v.OptionalSchema<v.ArraySchema<v.LooseObjectSchema<{
|
|
10
|
+
readonly type: v.StringSchema<undefined>;
|
|
11
|
+
readonly locations: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, undefined>, undefined>;
|
|
12
|
+
readonly actions: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
13
|
+
readonly datatypes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
14
|
+
readonly identifier: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
15
|
+
readonly privileges: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
16
|
+
}, undefined>, undefined>, undefined>;
|
|
17
17
|
}, undefined>;
|
|
18
|
-
export type AtprotoOAuthTokenResponse = v.
|
|
18
|
+
export type AtprotoOAuthTokenResponse = v.InferOutput<typeof atprotoOAuthTokenResponseSchema>;
|
|
19
19
|
//# sourceMappingURL=atproto-oauth-token-response.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-oauth-token-response.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-token-response.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"atproto-oauth-token-response.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-token-response.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAK7B,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;aAU1C,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { isAtprotoDid } from '@atcute/identity';
|
|
2
|
-
import * as v from '
|
|
2
|
+
import * as v from 'valibot';
|
|
3
3
|
import { atprotoOAuthScopeSchema } from './atproto-oauth-scope.js';
|
|
4
4
|
import { oauthAuthorizationDetailsSchema } from './oauth-authorization-details.js';
|
|
5
|
-
export const atprotoOAuthTokenResponseSchema = v.
|
|
5
|
+
export const atprotoOAuthTokenResponseSchema = v.looseObject({
|
|
6
6
|
access_token: v.string(),
|
|
7
7
|
token_type: v.literal('DPoP'),
|
|
8
|
-
sub: v.
|
|
8
|
+
sub: v.custom(isAtprotoDid, `must be a did:plc or did:web`),
|
|
9
9
|
scope: atprotoOAuthScopeSchema,
|
|
10
|
-
refresh_token: v.
|
|
11
|
-
expires_in: v.
|
|
10
|
+
refresh_token: v.optional(v.string()),
|
|
11
|
+
expires_in: v.optional(v.number()),
|
|
12
12
|
// https://datatracker.ietf.org/doc/html/rfc9396#name-enriched-authorization-deta
|
|
13
|
-
authorization_details:
|
|
13
|
+
authorization_details: v.optional(oauthAuthorizationDetailsSchema),
|
|
14
14
|
// OpenID is not compatible with atproto identities
|
|
15
15
|
});
|
|
16
16
|
//# sourceMappingURL=atproto-oauth-token-response.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-oauth-token-response.js","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-token-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"atproto-oauth-token-response.js","sourceRoot":"","sources":["../../lib/schemas/atproto-oauth-token-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGhD,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAEnF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,WAAW,CAAC;IAC5D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM,CAAM,YAAY,EAAE,8BAA8B,CAAC;IAChE,KAAK,EAAE,uBAAuB;IAC9B,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACrC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,iFAAiF;IACjF,qBAAqB,EAAE,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAClE,mDAAmD;CACnD,CAAC,CAAC"}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import * as v from '
|
|
1
|
+
import * as v from 'valibot';
|
|
2
2
|
/**
|
|
3
3
|
* AT Protocol protected resource metadata with required fields.
|
|
4
4
|
*
|
|
5
5
|
* @see {@link https://atproto.com/specs/oauth}
|
|
6
6
|
*/
|
|
7
|
-
export declare const atprotoProtectedResourceMetadataValidator: v.
|
|
7
|
+
export declare const atprotoProtectedResourceMetadataValidator: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.LooseObjectSchema<{
|
|
8
|
+
readonly resource: v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>], "url must use http: or https: protocol">;
|
|
9
|
+
readonly authorization_servers: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>], "url must use http: or https: protocol">, v.RawCheckAction<string>]>, undefined>, undefined>;
|
|
10
|
+
readonly jwks_uri: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>], "url must use http: or https: protocol">, undefined>;
|
|
11
|
+
readonly scopes_supported: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
12
|
+
readonly bearer_methods_supported: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<["header", "body", "query"], undefined>, undefined>, undefined>;
|
|
13
|
+
readonly resource_signing_alg_values_supported: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
|
|
14
|
+
readonly resource_documentation: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>], "url must use http: or https: protocol">, undefined>;
|
|
15
|
+
readonly resource_policy_uri: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>], "url must use http: or https: protocol">, undefined>;
|
|
16
|
+
readonly resource_tos_uri: v.OptionalSchema<v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>, v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, v.RawCheckAction<string>]>], "url must use http: or https: protocol">, undefined>;
|
|
17
|
+
}, undefined>, v.BaseValidation<{
|
|
8
18
|
resource: string;
|
|
9
19
|
authorization_servers?: string[] | undefined;
|
|
10
20
|
jwks_uri?: string | undefined;
|
|
@@ -14,8 +24,94 @@ export declare const atprotoProtectedResourceMetadataValidator: v.Type<{
|
|
|
14
24
|
resource_documentation?: string | undefined;
|
|
15
25
|
resource_policy_uri?: string | undefined;
|
|
16
26
|
resource_tos_uri?: string | undefined;
|
|
27
|
+
} & {
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}, {
|
|
30
|
+
resource: string;
|
|
31
|
+
authorization_servers?: string[] | undefined;
|
|
32
|
+
jwks_uri?: string | undefined;
|
|
33
|
+
scopes_supported?: string[] | undefined;
|
|
34
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
35
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
36
|
+
resource_documentation?: string | undefined;
|
|
37
|
+
resource_policy_uri?: string | undefined;
|
|
38
|
+
resource_tos_uri?: string | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}, v.CheckIssue<{
|
|
42
|
+
resource: string;
|
|
43
|
+
authorization_servers?: string[] | undefined;
|
|
44
|
+
jwks_uri?: string | undefined;
|
|
45
|
+
scopes_supported?: string[] | undefined;
|
|
46
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
47
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
48
|
+
resource_documentation?: string | undefined;
|
|
49
|
+
resource_policy_uri?: string | undefined;
|
|
50
|
+
resource_tos_uri?: string | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
}>>]>, v.BaseValidation<{
|
|
54
|
+
resource: string;
|
|
55
|
+
authorization_servers?: string[] | undefined;
|
|
56
|
+
jwks_uri?: string | undefined;
|
|
57
|
+
scopes_supported?: string[] | undefined;
|
|
58
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
59
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
60
|
+
resource_documentation?: string | undefined;
|
|
61
|
+
resource_policy_uri?: string | undefined;
|
|
62
|
+
resource_tos_uri?: string | undefined;
|
|
63
|
+
} & {
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
}, {
|
|
66
|
+
resource: string;
|
|
67
|
+
authorization_servers?: string[] | undefined;
|
|
68
|
+
jwks_uri?: string | undefined;
|
|
69
|
+
scopes_supported?: string[] | undefined;
|
|
70
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
71
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
72
|
+
resource_documentation?: string | undefined;
|
|
73
|
+
resource_policy_uri?: string | undefined;
|
|
74
|
+
resource_tos_uri?: string | undefined;
|
|
75
|
+
} & {
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
}, v.CheckIssue<{
|
|
78
|
+
resource: string;
|
|
79
|
+
authorization_servers?: string[] | undefined;
|
|
80
|
+
jwks_uri?: string | undefined;
|
|
81
|
+
scopes_supported?: string[] | undefined;
|
|
82
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
83
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
84
|
+
resource_documentation?: string | undefined;
|
|
85
|
+
resource_policy_uri?: string | undefined;
|
|
86
|
+
resource_tos_uri?: string | undefined;
|
|
87
|
+
} & {
|
|
88
|
+
[key: string]: unknown;
|
|
89
|
+
}>>, v.TransformAction<{
|
|
90
|
+
resource: string;
|
|
91
|
+
authorization_servers?: string[] | undefined;
|
|
92
|
+
jwks_uri?: string | undefined;
|
|
93
|
+
scopes_supported?: string[] | undefined;
|
|
94
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
95
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
96
|
+
resource_documentation?: string | undefined;
|
|
97
|
+
resource_policy_uri?: string | undefined;
|
|
98
|
+
resource_tos_uri?: string | undefined;
|
|
99
|
+
} & {
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
}, {
|
|
102
|
+
resource: string;
|
|
103
|
+
authorization_servers?: string[] | undefined;
|
|
104
|
+
jwks_uri?: string | undefined;
|
|
105
|
+
scopes_supported?: string[] | undefined;
|
|
106
|
+
bearer_methods_supported?: ("body" | "header" | "query")[] | undefined;
|
|
107
|
+
resource_signing_alg_values_supported?: string[] | undefined;
|
|
108
|
+
resource_documentation?: string | undefined;
|
|
109
|
+
resource_policy_uri?: string | undefined;
|
|
110
|
+
resource_tos_uri?: string | undefined;
|
|
111
|
+
} & {
|
|
112
|
+
[key: string]: unknown;
|
|
17
113
|
} & {
|
|
18
114
|
authorization_servers: [string];
|
|
19
|
-
}>;
|
|
20
|
-
export type AtprotoProtectedResourceMetadata = v.
|
|
115
|
+
}>]>;
|
|
116
|
+
export type AtprotoProtectedResourceMetadata = v.InferOutput<typeof atprotoProtectedResourceMetadataValidator>;
|
|
21
117
|
//# sourceMappingURL=atproto-protected-resource-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-protected-resource-metadata.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"atproto-protected-resource-metadata.d.ts","sourceRoot":"","sources":["../../lib/schemas/atproto-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B;;;;GAIG;AACH,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BASgB,CAAC,MAAM,CAAC;IAC7E,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,WAAW,CAC3D,OAAO,yCAAyC,CAChD,CAAC"}
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import * as v from '
|
|
1
|
+
import * as v from 'valibot';
|
|
2
2
|
import { oauthProtectedResourceMetadataValidator } from './oauth-protected-resource-metadata.js';
|
|
3
3
|
/**
|
|
4
4
|
* AT Protocol protected resource metadata with required fields.
|
|
5
5
|
*
|
|
6
6
|
* @see {@link https://atproto.com/specs/oauth}
|
|
7
7
|
*/
|
|
8
|
-
export const atprotoProtectedResourceMetadataValidator = oauthProtectedResourceMetadataValidator.
|
|
9
|
-
// atproto requires exactly one authorization server
|
|
10
|
-
if (data.authorization_servers?.length !== 1) {
|
|
11
|
-
return v.err({
|
|
12
|
-
message: `atproto requires exactly one authorization server`,
|
|
13
|
-
path: ['authorization_servers'],
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
return v.ok(data);
|
|
17
|
-
});
|
|
8
|
+
export const atprotoProtectedResourceMetadataValidator = v.pipe(oauthProtectedResourceMetadataValidator, v.forward(v.check((data) => data.authorization_servers?.length === 1, `atproto requires exactly one authorization server`), ['authorization_servers']), v.transform((data) => data));
|
|
18
9
|
//# sourceMappingURL=atproto-protected-resource-metadata.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"atproto-protected-resource-metadata.js","sourceRoot":"","sources":["../../lib/schemas/atproto-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"atproto-protected-resource-metadata.js","sourceRoot":"","sources":["../../lib/schemas/atproto-protected-resource-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,uCAAuC,EAAE,MAAM,wCAAwC,CAAC;AAEjG;;;;GAIG;AACH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,IAAI,CAC9D,uCAAuC,EACvC,CAAC,CAAC,OAAO,CACR,CAAC,CAAC,KAAK,CACN,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,qBAAqB,EAAE,MAAM,KAAK,CAAC,EAClD,mDAAmD,CACnD,EACD,CAAC,uBAAuB,CAAC,CACzB,EACD,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAyD,CAAC,CAChF,CAAC"}
|