@atcute/oauth-types 0.1.1 → 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 +5 -320
- package/dist/build-client-metadata.d.ts.map +1 -1
- package/dist/build-client-metadata.js +3 -2
- package/dist/build-client-metadata.js.map +1 -1
- package/dist/index.d.ts +31 -31
- 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 +75 -35
- package/dist/schemas/atcute-public-client-metadata.d.ts.map +1 -1
- package/dist/schemas/atcute-public-client-metadata.js +25 -110
- package/dist/schemas/atcute-public-client-metadata.js.map +1 -1
- 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 +9 -7
- package/lib/index.ts +31 -31
- 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 +70 -166
- 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
package/README.md
CHANGED
|
@@ -33,16 +33,17 @@ import {
|
|
|
33
33
|
oauthTokenResponseSchema,
|
|
34
34
|
atprotoAuthorizationServerMetadataSchema,
|
|
35
35
|
} from '@atcute/oauth-types';
|
|
36
|
+
import * as v from 'valibot';
|
|
36
37
|
|
|
37
38
|
// validate client metadata
|
|
38
|
-
const result =
|
|
39
|
-
if (result.
|
|
40
|
-
console.log(result.
|
|
39
|
+
const result = v.safeParse(confidentialClientMetadataSchema, input);
|
|
40
|
+
if (result.success) {
|
|
41
|
+
console.log(result.output);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
// validate token response
|
|
44
|
-
const tokenResult =
|
|
45
|
+
const tokenResult = v.safeParse(oauthTokenResponseSchema, response);
|
|
45
46
|
|
|
46
47
|
// validate authorization server metadata
|
|
47
|
-
const asResult =
|
|
48
|
+
const asResult = v.safeParse(atprotoAuthorizationServerMetadataSchema, metadata);
|
|
48
49
|
```
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Keyset } from '@atcute/oauth-keyset';
|
|
2
|
+
import { type ConfidentialClientMetadata } from './schemas/atcute-confidential-client-metadata.ts';
|
|
3
|
+
import { type PublicClientMetadata } from './schemas/atcute-public-client-metadata.ts';
|
|
4
|
+
import type { OAuthClientMetadata } from './schemas/oauth-client-metadata.ts';
|
|
2
5
|
/**
|
|
3
6
|
* builds an atproto client metadata for a confidential client.
|
|
4
7
|
*
|
|
@@ -6,164 +9,7 @@ import type { Keyset } from '@atcute/oauth-keyset';
|
|
|
6
9
|
* @param keyset available keys
|
|
7
10
|
* @returns built client metadata
|
|
8
11
|
*/
|
|
9
|
-
export declare const buildClientMetadata: (input:
|
|
10
|
-
client_id: string;
|
|
11
|
-
redirect_uris: string[];
|
|
12
|
-
scope: string | string[];
|
|
13
|
-
client_uri?: string | undefined;
|
|
14
|
-
client_name?: string | undefined;
|
|
15
|
-
policy_uri?: string | undefined;
|
|
16
|
-
tos_uri?: string | undefined;
|
|
17
|
-
logo_uri?: string | undefined;
|
|
18
|
-
jwks_uri?: string | undefined;
|
|
19
|
-
}, keyset: Keyset) => {
|
|
20
|
-
redirect_uris: string[];
|
|
21
|
-
response_types?: ("code" | "code id_token" | "code id_token token" | "code token" | "id_token" | "id_token token" | "none" | "token")[] | undefined;
|
|
22
|
-
grant_types?: ("authorization_code" | "client_credentials" | "implicit" | "password" | "refresh_token" | "urn:ietf:params:oauth:grant-type:jwt-bearer" | "urn:ietf:params:oauth:grant-type:saml2-bearer")[] | undefined;
|
|
23
|
-
scope?: string | undefined;
|
|
24
|
-
token_endpoint_auth_method?: "client_secret_basic" | "client_secret_jwt" | "client_secret_post" | "none" | "private_key_jwt" | "self_signed_tls_client_auth" | "tls_client_auth" | undefined;
|
|
25
|
-
token_endpoint_auth_signing_alg?: string | undefined;
|
|
26
|
-
userinfo_signed_response_alg?: string | undefined;
|
|
27
|
-
userinfo_encrypted_response_alg?: string | undefined;
|
|
28
|
-
jwks_uri?: string | undefined;
|
|
29
|
-
jwks?: {
|
|
30
|
-
keys: ({
|
|
31
|
-
kid?: string | undefined;
|
|
32
|
-
use?: "enc" | "sig" | undefined;
|
|
33
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
34
|
-
x5c?: string[] | undefined;
|
|
35
|
-
x5t?: string | undefined;
|
|
36
|
-
'x5t#S256'?: string | undefined;
|
|
37
|
-
x5u?: string | undefined;
|
|
38
|
-
ext?: boolean | undefined;
|
|
39
|
-
iat?: number | undefined;
|
|
40
|
-
exp?: number | undefined;
|
|
41
|
-
nbf?: number | undefined;
|
|
42
|
-
revoked?: {
|
|
43
|
-
revoked_at: number;
|
|
44
|
-
reason?: string | undefined;
|
|
45
|
-
} | undefined;
|
|
46
|
-
kty: "RSA";
|
|
47
|
-
alg?: "PS256" | "PS384" | "PS512" | "RS256" | "RS384" | "RS512" | undefined;
|
|
48
|
-
n: string;
|
|
49
|
-
e: string;
|
|
50
|
-
d?: string | undefined;
|
|
51
|
-
p?: string | undefined;
|
|
52
|
-
q?: string | undefined;
|
|
53
|
-
dp?: string | undefined;
|
|
54
|
-
dq?: string | undefined;
|
|
55
|
-
qi?: string | undefined;
|
|
56
|
-
oth?: {
|
|
57
|
-
r?: string | undefined;
|
|
58
|
-
d?: string | undefined;
|
|
59
|
-
t?: string | undefined;
|
|
60
|
-
}[] | undefined;
|
|
61
|
-
} | {
|
|
62
|
-
kid?: string | undefined;
|
|
63
|
-
use?: "enc" | "sig" | undefined;
|
|
64
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
65
|
-
x5c?: string[] | undefined;
|
|
66
|
-
x5t?: string | undefined;
|
|
67
|
-
'x5t#S256'?: string | undefined;
|
|
68
|
-
x5u?: string | undefined;
|
|
69
|
-
ext?: boolean | undefined;
|
|
70
|
-
iat?: number | undefined;
|
|
71
|
-
exp?: number | undefined;
|
|
72
|
-
nbf?: number | undefined;
|
|
73
|
-
revoked?: {
|
|
74
|
-
revoked_at: number;
|
|
75
|
-
reason?: string | undefined;
|
|
76
|
-
} | undefined;
|
|
77
|
-
kty: "EC";
|
|
78
|
-
alg?: "ES256" | "ES384" | "ES512" | undefined;
|
|
79
|
-
crv: "P-256" | "P-384" | "P-521";
|
|
80
|
-
x: string;
|
|
81
|
-
y: string;
|
|
82
|
-
d?: string | undefined;
|
|
83
|
-
} | {
|
|
84
|
-
kid?: string | undefined;
|
|
85
|
-
use?: "enc" | "sig" | undefined;
|
|
86
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
87
|
-
x5c?: string[] | undefined;
|
|
88
|
-
x5t?: string | undefined;
|
|
89
|
-
'x5t#S256'?: string | undefined;
|
|
90
|
-
x5u?: string | undefined;
|
|
91
|
-
ext?: boolean | undefined;
|
|
92
|
-
iat?: number | undefined;
|
|
93
|
-
exp?: number | undefined;
|
|
94
|
-
nbf?: number | undefined;
|
|
95
|
-
revoked?: {
|
|
96
|
-
revoked_at: number;
|
|
97
|
-
reason?: string | undefined;
|
|
98
|
-
} | undefined;
|
|
99
|
-
kty: "EC";
|
|
100
|
-
alg?: "ES256K" | undefined;
|
|
101
|
-
crv: "secp256k1";
|
|
102
|
-
x: string;
|
|
103
|
-
y: string;
|
|
104
|
-
d?: string | undefined;
|
|
105
|
-
} | {
|
|
106
|
-
kid?: string | undefined;
|
|
107
|
-
use?: "enc" | "sig" | undefined;
|
|
108
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
109
|
-
x5c?: string[] | undefined;
|
|
110
|
-
x5t?: string | undefined;
|
|
111
|
-
'x5t#S256'?: string | undefined;
|
|
112
|
-
x5u?: string | undefined;
|
|
113
|
-
ext?: boolean | undefined;
|
|
114
|
-
iat?: number | undefined;
|
|
115
|
-
exp?: number | undefined;
|
|
116
|
-
nbf?: number | undefined;
|
|
117
|
-
revoked?: {
|
|
118
|
-
revoked_at: number;
|
|
119
|
-
reason?: string | undefined;
|
|
120
|
-
} | undefined;
|
|
121
|
-
kty: "OKP";
|
|
122
|
-
alg?: "EdDSA" | undefined;
|
|
123
|
-
crv: "Ed25519" | "Ed448";
|
|
124
|
-
x: string;
|
|
125
|
-
d?: string | undefined;
|
|
126
|
-
} | {
|
|
127
|
-
kid?: string | undefined;
|
|
128
|
-
use?: "enc" | "sig" | undefined;
|
|
129
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
130
|
-
x5c?: string[] | undefined;
|
|
131
|
-
x5t?: string | undefined;
|
|
132
|
-
'x5t#S256'?: string | undefined;
|
|
133
|
-
x5u?: string | undefined;
|
|
134
|
-
ext?: boolean | undefined;
|
|
135
|
-
iat?: number | undefined;
|
|
136
|
-
exp?: number | undefined;
|
|
137
|
-
nbf?: number | undefined;
|
|
138
|
-
revoked?: {
|
|
139
|
-
revoked_at: number;
|
|
140
|
-
reason?: string | undefined;
|
|
141
|
-
} | undefined;
|
|
142
|
-
kty: "oct";
|
|
143
|
-
alg?: "HS256" | "HS384" | "HS512" | undefined;
|
|
144
|
-
k: string;
|
|
145
|
-
})[];
|
|
146
|
-
} | undefined;
|
|
147
|
-
application_type?: "native" | "web" | undefined;
|
|
148
|
-
subject_type?: "pairwise" | "public" | undefined;
|
|
149
|
-
request_object_signing_alg?: string | undefined;
|
|
150
|
-
id_token_signed_response_alg?: string | undefined;
|
|
151
|
-
authorization_signed_response_alg?: string | undefined;
|
|
152
|
-
authorization_encrypted_response_enc?: "A128CBC-HS256" | undefined;
|
|
153
|
-
authorization_encrypted_response_alg?: string | undefined;
|
|
154
|
-
client_id?: string | undefined;
|
|
155
|
-
client_name?: string | undefined;
|
|
156
|
-
client_uri?: string | undefined;
|
|
157
|
-
policy_uri?: string | undefined;
|
|
158
|
-
tos_uri?: string | undefined;
|
|
159
|
-
logo_uri?: string | undefined;
|
|
160
|
-
default_max_age?: number | undefined;
|
|
161
|
-
require_auth_time?: boolean | undefined;
|
|
162
|
-
contacts?: string[] | undefined;
|
|
163
|
-
tls_client_certificate_bound_access_tokens?: boolean | undefined;
|
|
164
|
-
dpop_bound_access_tokens?: boolean | undefined;
|
|
165
|
-
authorization_details_types?: string[] | undefined;
|
|
166
|
-
};
|
|
12
|
+
export declare const buildClientMetadata: (input: ConfidentialClientMetadata, keyset: Keyset) => OAuthClientMetadata;
|
|
167
13
|
/**
|
|
168
14
|
* builds an atproto client metadata for a public client.
|
|
169
15
|
*
|
|
@@ -176,166 +22,5 @@ export declare const buildClientMetadata: (input: {
|
|
|
176
22
|
* @param input public client metadata
|
|
177
23
|
* @returns built client metadata
|
|
178
24
|
*/
|
|
179
|
-
export declare const buildPublicClientMetadata: (input:
|
|
180
|
-
client_id?: undefined;
|
|
181
|
-
redirect_uris: string[];
|
|
182
|
-
scope: string | string[];
|
|
183
|
-
} | {
|
|
184
|
-
client_id: string;
|
|
185
|
-
redirect_uris: string[];
|
|
186
|
-
scope: string | string[];
|
|
187
|
-
application_type?: "native" | "web" | undefined;
|
|
188
|
-
client_uri?: string | undefined;
|
|
189
|
-
client_name?: string | undefined;
|
|
190
|
-
policy_uri?: string | undefined;
|
|
191
|
-
tos_uri?: string | undefined;
|
|
192
|
-
logo_uri?: string | undefined;
|
|
193
|
-
}) => {
|
|
194
|
-
redirect_uris: string[];
|
|
195
|
-
response_types?: ("code" | "code id_token" | "code id_token token" | "code token" | "id_token" | "id_token token" | "none" | "token")[] | undefined;
|
|
196
|
-
grant_types?: ("authorization_code" | "client_credentials" | "implicit" | "password" | "refresh_token" | "urn:ietf:params:oauth:grant-type:jwt-bearer" | "urn:ietf:params:oauth:grant-type:saml2-bearer")[] | undefined;
|
|
197
|
-
scope?: string | undefined;
|
|
198
|
-
token_endpoint_auth_method?: "client_secret_basic" | "client_secret_jwt" | "client_secret_post" | "none" | "private_key_jwt" | "self_signed_tls_client_auth" | "tls_client_auth" | undefined;
|
|
199
|
-
token_endpoint_auth_signing_alg?: string | undefined;
|
|
200
|
-
userinfo_signed_response_alg?: string | undefined;
|
|
201
|
-
userinfo_encrypted_response_alg?: string | undefined;
|
|
202
|
-
jwks_uri?: string | undefined;
|
|
203
|
-
jwks?: {
|
|
204
|
-
keys: ({
|
|
205
|
-
kid?: string | undefined;
|
|
206
|
-
use?: "enc" | "sig" | undefined;
|
|
207
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
208
|
-
x5c?: string[] | undefined;
|
|
209
|
-
x5t?: string | undefined;
|
|
210
|
-
'x5t#S256'?: string | undefined;
|
|
211
|
-
x5u?: string | undefined;
|
|
212
|
-
ext?: boolean | undefined;
|
|
213
|
-
iat?: number | undefined;
|
|
214
|
-
exp?: number | undefined;
|
|
215
|
-
nbf?: number | undefined;
|
|
216
|
-
revoked?: {
|
|
217
|
-
revoked_at: number;
|
|
218
|
-
reason?: string | undefined;
|
|
219
|
-
} | undefined;
|
|
220
|
-
kty: "RSA";
|
|
221
|
-
alg?: "PS256" | "PS384" | "PS512" | "RS256" | "RS384" | "RS512" | undefined;
|
|
222
|
-
n: string;
|
|
223
|
-
e: string;
|
|
224
|
-
d?: string | undefined;
|
|
225
|
-
p?: string | undefined;
|
|
226
|
-
q?: string | undefined;
|
|
227
|
-
dp?: string | undefined;
|
|
228
|
-
dq?: string | undefined;
|
|
229
|
-
qi?: string | undefined;
|
|
230
|
-
oth?: {
|
|
231
|
-
r?: string | undefined;
|
|
232
|
-
d?: string | undefined;
|
|
233
|
-
t?: string | undefined;
|
|
234
|
-
}[] | undefined;
|
|
235
|
-
} | {
|
|
236
|
-
kid?: string | undefined;
|
|
237
|
-
use?: "enc" | "sig" | undefined;
|
|
238
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
239
|
-
x5c?: string[] | undefined;
|
|
240
|
-
x5t?: string | undefined;
|
|
241
|
-
'x5t#S256'?: string | undefined;
|
|
242
|
-
x5u?: string | undefined;
|
|
243
|
-
ext?: boolean | undefined;
|
|
244
|
-
iat?: number | undefined;
|
|
245
|
-
exp?: number | undefined;
|
|
246
|
-
nbf?: number | undefined;
|
|
247
|
-
revoked?: {
|
|
248
|
-
revoked_at: number;
|
|
249
|
-
reason?: string | undefined;
|
|
250
|
-
} | undefined;
|
|
251
|
-
kty: "EC";
|
|
252
|
-
alg?: "ES256" | "ES384" | "ES512" | undefined;
|
|
253
|
-
crv: "P-256" | "P-384" | "P-521";
|
|
254
|
-
x: string;
|
|
255
|
-
y: string;
|
|
256
|
-
d?: string | undefined;
|
|
257
|
-
} | {
|
|
258
|
-
kid?: string | undefined;
|
|
259
|
-
use?: "enc" | "sig" | undefined;
|
|
260
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
261
|
-
x5c?: string[] | undefined;
|
|
262
|
-
x5t?: string | undefined;
|
|
263
|
-
'x5t#S256'?: string | undefined;
|
|
264
|
-
x5u?: string | undefined;
|
|
265
|
-
ext?: boolean | undefined;
|
|
266
|
-
iat?: number | undefined;
|
|
267
|
-
exp?: number | undefined;
|
|
268
|
-
nbf?: number | undefined;
|
|
269
|
-
revoked?: {
|
|
270
|
-
revoked_at: number;
|
|
271
|
-
reason?: string | undefined;
|
|
272
|
-
} | undefined;
|
|
273
|
-
kty: "EC";
|
|
274
|
-
alg?: "ES256K" | undefined;
|
|
275
|
-
crv: "secp256k1";
|
|
276
|
-
x: string;
|
|
277
|
-
y: string;
|
|
278
|
-
d?: string | undefined;
|
|
279
|
-
} | {
|
|
280
|
-
kid?: string | undefined;
|
|
281
|
-
use?: "enc" | "sig" | undefined;
|
|
282
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
283
|
-
x5c?: string[] | undefined;
|
|
284
|
-
x5t?: string | undefined;
|
|
285
|
-
'x5t#S256'?: string | undefined;
|
|
286
|
-
x5u?: string | undefined;
|
|
287
|
-
ext?: boolean | undefined;
|
|
288
|
-
iat?: number | undefined;
|
|
289
|
-
exp?: number | undefined;
|
|
290
|
-
nbf?: number | undefined;
|
|
291
|
-
revoked?: {
|
|
292
|
-
revoked_at: number;
|
|
293
|
-
reason?: string | undefined;
|
|
294
|
-
} | undefined;
|
|
295
|
-
kty: "OKP";
|
|
296
|
-
alg?: "EdDSA" | undefined;
|
|
297
|
-
crv: "Ed25519" | "Ed448";
|
|
298
|
-
x: string;
|
|
299
|
-
d?: string | undefined;
|
|
300
|
-
} | {
|
|
301
|
-
kid?: string | undefined;
|
|
302
|
-
use?: "enc" | "sig" | undefined;
|
|
303
|
-
key_ops?: ("decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey")[] | undefined;
|
|
304
|
-
x5c?: string[] | undefined;
|
|
305
|
-
x5t?: string | undefined;
|
|
306
|
-
'x5t#S256'?: string | undefined;
|
|
307
|
-
x5u?: string | undefined;
|
|
308
|
-
ext?: boolean | undefined;
|
|
309
|
-
iat?: number | undefined;
|
|
310
|
-
exp?: number | undefined;
|
|
311
|
-
nbf?: number | undefined;
|
|
312
|
-
revoked?: {
|
|
313
|
-
revoked_at: number;
|
|
314
|
-
reason?: string | undefined;
|
|
315
|
-
} | undefined;
|
|
316
|
-
kty: "oct";
|
|
317
|
-
alg?: "HS256" | "HS384" | "HS512" | undefined;
|
|
318
|
-
k: string;
|
|
319
|
-
})[];
|
|
320
|
-
} | undefined;
|
|
321
|
-
application_type?: "native" | "web" | undefined;
|
|
322
|
-
subject_type?: "pairwise" | "public" | undefined;
|
|
323
|
-
request_object_signing_alg?: string | undefined;
|
|
324
|
-
id_token_signed_response_alg?: string | undefined;
|
|
325
|
-
authorization_signed_response_alg?: string | undefined;
|
|
326
|
-
authorization_encrypted_response_enc?: "A128CBC-HS256" | undefined;
|
|
327
|
-
authorization_encrypted_response_alg?: string | undefined;
|
|
328
|
-
client_id?: string | undefined;
|
|
329
|
-
client_name?: string | undefined;
|
|
330
|
-
client_uri?: string | undefined;
|
|
331
|
-
policy_uri?: string | undefined;
|
|
332
|
-
tos_uri?: string | undefined;
|
|
333
|
-
logo_uri?: string | undefined;
|
|
334
|
-
default_max_age?: number | undefined;
|
|
335
|
-
require_auth_time?: boolean | undefined;
|
|
336
|
-
contacts?: string[] | undefined;
|
|
337
|
-
tls_client_certificate_bound_access_tokens?: boolean | undefined;
|
|
338
|
-
dpop_bound_access_tokens?: boolean | undefined;
|
|
339
|
-
authorization_details_types?: string[] | undefined;
|
|
340
|
-
};
|
|
25
|
+
export declare const buildPublicClientMetadata: (input: PublicClientMetadata) => OAuthClientMetadata;
|
|
341
26
|
//# sourceMappingURL=build-client-metadata.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-client-metadata.d.ts","sourceRoot":"","sources":["../lib/build-client-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"build-client-metadata.d.ts","sourceRoot":"","sources":["../lib/build-client-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAKnD,OAAO,EAEN,KAAK,0BAA0B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,UACxB,0BAA0B,UACzB,MAAM,KACZ,mBAmDF,CAAC;AA6BF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,UAAW,oBAAoB,KAAG,mBAuCvE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
1
2
|
import { FALLBACK_ALG } from './constants.js';
|
|
2
3
|
import { confidentialClientMetadataSchema, } from './schemas/atcute-confidential-client-metadata.js';
|
|
3
4
|
import { publicClientMetadataSchema, } from './schemas/atcute-public-client-metadata.js';
|
|
@@ -11,7 +12,7 @@ import { DEFAULT_ATPROTO_OAUTH_SCOPE } from './schemas/atproto-oauth-scope.js';
|
|
|
11
12
|
*/
|
|
12
13
|
export const buildClientMetadata = (input, keyset) => {
|
|
13
14
|
// validate user-facing schema is correct
|
|
14
|
-
const conf =
|
|
15
|
+
const conf = v.parse(confidentialClientMetadataSchema, input);
|
|
15
16
|
// build full OAuth client metadata (atproto defaults and requirements)
|
|
16
17
|
const metadata = {
|
|
17
18
|
client_id: conf.client_id,
|
|
@@ -86,7 +87,7 @@ const buildLoopbackClientId = (redirectUris, scope) => {
|
|
|
86
87
|
* @returns built client metadata
|
|
87
88
|
*/
|
|
88
89
|
export const buildPublicClientMetadata = (input) => {
|
|
89
|
-
const parsed =
|
|
90
|
+
const parsed = v.parse(publicClientMetadataSchema, input);
|
|
90
91
|
const scope = Array.isArray(parsed.scope) ? parsed.scope.join(' ') : parsed.scope;
|
|
91
92
|
if (parsed.client_id === undefined) {
|
|
92
93
|
// loopback client - server generates metadata from client_id URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-client-metadata.js","sourceRoot":"","sources":["../lib/build-client-metadata.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACN,gCAAgC,GAEhC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,0BAA0B,GAE1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAClC,KAAiC,EACjC,MAAc,EACQ,EAAE
|
|
1
|
+
{"version":3,"file":"build-client-metadata.js","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,UAAU;QAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,KAAK;QAEL,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,IAAI,KAAK;QAClD,YAAY,EAAE,QAAQ;QACtB,cAAc,EAAE,CAAC,MAAM,CAAC;QACxB,WAAW,EAAE,CAAC,oBAAoB,EAAE,eAAe,CAAC;QAEpD,0BAA0B,EAAE,MAAM;QAClC,wBAAwB,EAAE,IAAI;KAC9B,CAAC;AACH,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
export { buildClientMetadata, buildPublicClientMetadata } from './build-client-metadata.
|
|
2
|
-
export { CLIENT_ASSERTION_TYPE_JWT_BEARER, FALLBACK_ALG } from './constants.
|
|
3
|
-
export * as scope from './scope.
|
|
4
|
-
export { confidentialClientMetadataSchema, type ConfidentialClientMetadata, } from './schemas/atcute-confidential-client-metadata.
|
|
5
|
-
export { discoverablePublicClientMetadataSchema, loopbackClientMetadataSchema, publicClientMetadataSchema, type DiscoverablePublicClientMetadata, type LoopbackClientMetadata, type PublicClientMetadata, } from './schemas/atcute-public-client-metadata.
|
|
6
|
-
export { atprotoOAuthScopeSchema, ATPROTO_SCOPE_VALUE, DEFAULT_ATPROTO_OAUTH_SCOPE, type AtprotoOAuthScope, } from './schemas/atproto-oauth-scope.
|
|
7
|
-
export { jwkPubSchema, jwkSchema, keyUsageSchema, publicKeyUsageSchema, type Jwk, type JwkPub, type KeyUsage, } from './schemas/jwk.
|
|
8
|
-
export { jwksPubSchema, jwksSchema, type Jwks, type JwksPub } from './schemas/jwks.
|
|
9
|
-
export { oauthClientIdDiscoverableSchema } from './schemas/oauth-client-id-discoverable.
|
|
10
|
-
export { oauthClientIdSchema, type OAuthClientId } from './schemas/oauth-client-id.
|
|
11
|
-
export { oauthClientMetadataSchema, type OAuthClientMetadata } from './schemas/oauth-client-metadata.
|
|
12
|
-
export { oauthEndpointAuthMethodSchema, type OAuthEndpointAuthMethod, } from './schemas/oauth-endpoint-auth-method.
|
|
13
|
-
export { oauthGrantTypeSchema, type OAuthGrantType } from './schemas/oauth-grant-type.
|
|
14
|
-
export { loopbackRedirectUriSchema, oauthRedirectUriSchema, type LoopbackRedirectUri, type OAuthRedirectUri, } from './schemas/oauth-redirect-uri.
|
|
15
|
-
export { oauthResponseTypeSchema, type OAuthResponseType } from './schemas/oauth-response-type.
|
|
16
|
-
export { isOAuthScope, OAUTH_SCOPE_REGEXP, oauthScopeSchema, type OAuthScope, } from './schemas/oauth-scope.
|
|
17
|
-
export { httpsUriSchema, loopbackUriSchema, nonLocalWebUriSchema, privateUseUriSchema, urlSchema, webUriSchema, } from './schemas/uri.
|
|
18
|
-
export { extractUrlPath, isHostnameIP, isLastOccurrence, isLocalHostname, isLoopbackHost, isSpaceSeparatedValue, } from './schemas/utils.
|
|
19
|
-
export { oauthTokenTypeSchema, type OAuthTokenType } from './schemas/oauth-token-type.
|
|
20
|
-
export { oauthTokenResponseSchema, type OAuthTokenResponse } from './schemas/oauth-token-response.
|
|
21
|
-
export { atprotoOAuthTokenResponseSchema, type AtprotoOAuthTokenResponse, } from './schemas/atproto-oauth-token-response.
|
|
22
|
-
export { oauthParResponseSchema, type OAuthParResponse } from './schemas/oauth-par-response.
|
|
23
|
-
export { oauthCodeChallengeMethodSchema, type OAuthCodeChallengeMethod, } from './schemas/oauth-code-challenge-method.
|
|
24
|
-
export { oauthResponseModeSchema, type OAuthResponseMode } from './schemas/oauth-response-mode.
|
|
25
|
-
export { oauthPromptSchema, type OAuthPrompt } from './schemas/oauth-prompt.
|
|
26
|
-
export { oauthAuthorizationDetailSchema, oauthAuthorizationDetailsSchema, type OAuthAuthorizationDetail, type OAuthAuthorizationDetails, } from './schemas/oauth-authorization-details.
|
|
27
|
-
export { oauthIssuerIdentifierSchema, type OAuthIssuerIdentifier, } from './schemas/oauth-issuer-identifier.
|
|
28
|
-
export { oauthAuthorizationServerMetadataSchema, oauthAuthorizationServerMetadataValidator, type OAuthAuthorizationServerMetadata, } from './schemas/oauth-authorization-server-metadata.
|
|
29
|
-
export { atprotoAuthorizationServerMetadataValidator, type AtprotoAuthorizationServerMetadata, } from './schemas/atproto-authorization-server-metadata.
|
|
30
|
-
export { oauthBearerMethodSchema, oauthProtectedResourceMetadataSchema, oauthProtectedResourceMetadataValidator, type OAuthBearerMethod, type OAuthProtectedResourceMetadata, } from './schemas/oauth-protected-resource-metadata.
|
|
31
|
-
export { atprotoProtectedResourceMetadataValidator, type AtprotoProtectedResourceMetadata, } from './schemas/atproto-protected-resource-metadata.
|
|
1
|
+
export { buildClientMetadata, buildPublicClientMetadata } from './build-client-metadata.ts';
|
|
2
|
+
export { CLIENT_ASSERTION_TYPE_JWT_BEARER, FALLBACK_ALG } from './constants.ts';
|
|
3
|
+
export * as scope from './scope.ts';
|
|
4
|
+
export { confidentialClientMetadataSchema, type ConfidentialClientMetadata, } from './schemas/atcute-confidential-client-metadata.ts';
|
|
5
|
+
export { discoverablePublicClientMetadataSchema, loopbackClientMetadataSchema, publicClientMetadataSchema, type DiscoverablePublicClientMetadata, type LoopbackClientMetadata, type PublicClientMetadata, } from './schemas/atcute-public-client-metadata.ts';
|
|
6
|
+
export { atprotoOAuthScopeSchema, ATPROTO_SCOPE_VALUE, DEFAULT_ATPROTO_OAUTH_SCOPE, type AtprotoOAuthScope, } from './schemas/atproto-oauth-scope.ts';
|
|
7
|
+
export { jwkPubSchema, jwkSchema, keyUsageSchema, publicKeyUsageSchema, type Jwk, type JwkPub, type KeyUsage, } from './schemas/jwk.ts';
|
|
8
|
+
export { jwksPubSchema, jwksSchema, type Jwks, type JwksPub } from './schemas/jwks.ts';
|
|
9
|
+
export { oauthClientIdDiscoverableSchema } from './schemas/oauth-client-id-discoverable.ts';
|
|
10
|
+
export { oauthClientIdSchema, type OAuthClientId } from './schemas/oauth-client-id.ts';
|
|
11
|
+
export { oauthClientMetadataSchema, type OAuthClientMetadata } from './schemas/oauth-client-metadata.ts';
|
|
12
|
+
export { oauthEndpointAuthMethodSchema, type OAuthEndpointAuthMethod, } from './schemas/oauth-endpoint-auth-method.ts';
|
|
13
|
+
export { oauthGrantTypeSchema, type OAuthGrantType } from './schemas/oauth-grant-type.ts';
|
|
14
|
+
export { loopbackRedirectUriSchema, oauthRedirectUriSchema, type LoopbackRedirectUri, type OAuthRedirectUri, } from './schemas/oauth-redirect-uri.ts';
|
|
15
|
+
export { oauthResponseTypeSchema, type OAuthResponseType } from './schemas/oauth-response-type.ts';
|
|
16
|
+
export { isOAuthScope, OAUTH_SCOPE_REGEXP, oauthScopeSchema, type OAuthScope, } from './schemas/oauth-scope.ts';
|
|
17
|
+
export { httpsUriSchema, loopbackUriSchema, nonLocalWebUriSchema, privateUseUriSchema, urlSchema, webUriSchema, } from './schemas/uri.ts';
|
|
18
|
+
export { extractUrlPath, isHostnameIP, isLastOccurrence, isLocalHostname, isLoopbackHost, isSpaceSeparatedValue, } from './schemas/utils.ts';
|
|
19
|
+
export { oauthTokenTypeSchema, type OAuthTokenType } from './schemas/oauth-token-type.ts';
|
|
20
|
+
export { oauthTokenResponseSchema, type OAuthTokenResponse } from './schemas/oauth-token-response.ts';
|
|
21
|
+
export { atprotoOAuthTokenResponseSchema, type AtprotoOAuthTokenResponse, } from './schemas/atproto-oauth-token-response.ts';
|
|
22
|
+
export { oauthParResponseSchema, type OAuthParResponse } from './schemas/oauth-par-response.ts';
|
|
23
|
+
export { oauthCodeChallengeMethodSchema, type OAuthCodeChallengeMethod, } from './schemas/oauth-code-challenge-method.ts';
|
|
24
|
+
export { oauthResponseModeSchema, type OAuthResponseMode } from './schemas/oauth-response-mode.ts';
|
|
25
|
+
export { oauthPromptSchema, type OAuthPrompt } from './schemas/oauth-prompt.ts';
|
|
26
|
+
export { oauthAuthorizationDetailSchema, oauthAuthorizationDetailsSchema, type OAuthAuthorizationDetail, type OAuthAuthorizationDetails, } from './schemas/oauth-authorization-details.ts';
|
|
27
|
+
export { oauthIssuerIdentifierSchema, type OAuthIssuerIdentifier, } from './schemas/oauth-issuer-identifier.ts';
|
|
28
|
+
export { oauthAuthorizationServerMetadataSchema, oauthAuthorizationServerMetadataValidator, type OAuthAuthorizationServerMetadata, } from './schemas/oauth-authorization-server-metadata.ts';
|
|
29
|
+
export { atprotoAuthorizationServerMetadataValidator, type AtprotoAuthorizationServerMetadata, } from './schemas/atproto-authorization-server-metadata.ts';
|
|
30
|
+
export { oauthBearerMethodSchema, oauthProtectedResourceMetadataSchema, oauthProtectedResourceMetadataValidator, type OAuthBearerMethod, type OAuthProtectedResourceMetadata, } from './schemas/oauth-protected-resource-metadata.ts';
|
|
31
|
+
export { atprotoProtectedResourceMetadataValidator, type AtprotoProtectedResourceMetadata, } from './schemas/atproto-protected-resource-metadata.ts';
|
|
32
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
/**
|
|
3
|
+
* OAuth scope - either:
|
|
4
|
+
* - a space-separated string (must include "atproto")
|
|
5
|
+
* - an array of scope strings ('atproto' is added automatically)
|
|
6
|
+
*/
|
|
7
|
+
export declare const scopeSchema: v.UnionSchema<[v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid atproto OAuth scope">]>, v.CheckAction<string, "duplicate scope">]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "invalid OAuth scope">]>, undefined>, v.TransformAction<string[], string[]>, v.CheckItemsAction<string[], "duplicate scope">]>], undefined>;
|
|
8
|
+
//# sourceMappingURL=atcute-client-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atcute-client-shared.d.ts","sourceRoot":"","sources":["../../lib/schemas/atcute-client-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAS7B;;;;GAIG;AACH,eAAO,MAAM,WAAW,scAUtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
import { atprotoOAuthScopeSchema } from './atproto-oauth-scope.js';
|
|
3
|
+
import { isLastOccurrence } from './utils.js';
|
|
4
|
+
const SINGLE_SCOPE_RE = /^[\x21\x23-\x5B\x5D-\x7E]+$/;
|
|
5
|
+
const singleScopeSchema = v.pipe(v.string(), v.regex(SINGLE_SCOPE_RE, `invalid OAuth scope`));
|
|
6
|
+
/**
|
|
7
|
+
* OAuth scope - either:
|
|
8
|
+
* - a space-separated string (must include "atproto")
|
|
9
|
+
* - an array of scope strings ('atproto' is added automatically)
|
|
10
|
+
*/
|
|
11
|
+
export const scopeSchema = v.union([
|
|
12
|
+
v.pipe(atprotoOAuthScopeSchema, v.check((input) => input.split(/\s+/).every(isLastOccurrence), `duplicate scope`)),
|
|
13
|
+
v.pipe(v.array(singleScopeSchema), v.transform((input) => (input.includes('atproto') ? input : ['atproto', ...input])), v.checkItems(isLastOccurrence, `duplicate scope`)),
|
|
14
|
+
]);
|
|
15
|
+
//# sourceMappingURL=atcute-client-shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"atcute-client-shared.js","sourceRoot":"","sources":["../../lib/schemas/atcute-client-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAEtD,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAE9F;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC;IAClC,CAAC,CAAC,IAAI,CACL,uBAAuB,EACvB,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC,CACjF;IACD,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAC1B,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,EACnF,CAAC,CAAC,UAAU,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CACjD;CACD,CAAC,CAAC"}
|