@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.
Files changed (153) hide show
  1. package/README.md +6 -5
  2. package/dist/build-client-metadata.d.ts +5 -320
  3. package/dist/build-client-metadata.d.ts.map +1 -1
  4. package/dist/build-client-metadata.js +3 -2
  5. package/dist/build-client-metadata.js.map +1 -1
  6. package/dist/index.d.ts +31 -31
  7. package/dist/schemas/atcute-client-shared.d.ts +8 -0
  8. package/dist/schemas/atcute-client-shared.d.ts.map +1 -0
  9. package/dist/schemas/atcute-client-shared.js +15 -0
  10. package/dist/schemas/atcute-client-shared.js.map +1 -0
  11. package/dist/schemas/atcute-confidential-client-metadata.d.ts +228 -4
  12. package/dist/schemas/atcute-confidential-client-metadata.d.ts.map +1 -1
  13. package/dist/schemas/atcute-confidential-client-metadata.js +48 -88
  14. package/dist/schemas/atcute-confidential-client-metadata.js.map +1 -1
  15. package/dist/schemas/atcute-public-client-metadata.d.ts +75 -35
  16. package/dist/schemas/atcute-public-client-metadata.d.ts.map +1 -1
  17. package/dist/schemas/atcute-public-client-metadata.js +25 -110
  18. package/dist/schemas/atcute-public-client-metadata.js.map +1 -1
  19. package/dist/schemas/atproto-authorization-server-metadata.d.ts +786 -4
  20. package/dist/schemas/atproto-authorization-server-metadata.d.ts.map +1 -1
  21. package/dist/schemas/atproto-authorization-server-metadata.js +2 -18
  22. package/dist/schemas/atproto-authorization-server-metadata.js.map +1 -1
  23. package/dist/schemas/atproto-oauth-scope.d.ts +3 -3
  24. package/dist/schemas/atproto-oauth-scope.d.ts.map +1 -1
  25. package/dist/schemas/atproto-oauth-scope.js +2 -2
  26. package/dist/schemas/atproto-oauth-scope.js.map +1 -1
  27. package/dist/schemas/atproto-oauth-token-response.d.ts +17 -17
  28. package/dist/schemas/atproto-oauth-token-response.d.ts.map +1 -1
  29. package/dist/schemas/atproto-oauth-token-response.js +6 -6
  30. package/dist/schemas/atproto-oauth-token-response.js.map +1 -1
  31. package/dist/schemas/atproto-protected-resource-metadata.d.ts +100 -4
  32. package/dist/schemas/atproto-protected-resource-metadata.d.ts.map +1 -1
  33. package/dist/schemas/atproto-protected-resource-metadata.js +2 -11
  34. package/dist/schemas/atproto-protected-resource-metadata.js.map +1 -1
  35. package/dist/schemas/jwk.d.ts +4289 -42
  36. package/dist/schemas/jwk.d.ts.map +1 -1
  37. package/dist/schemas/jwk.js +58 -91
  38. package/dist/schemas/jwk.js.map +1 -1
  39. package/dist/schemas/jwks.d.ts +87 -42
  40. package/dist/schemas/jwks.d.ts.map +1 -1
  41. package/dist/schemas/jwks.js +13 -29
  42. package/dist/schemas/jwks.js.map +1 -1
  43. package/dist/schemas/oauth-authorization-details.d.ts +18 -18
  44. package/dist/schemas/oauth-authorization-details.d.ts.map +1 -1
  45. package/dist/schemas/oauth-authorization-details.js +7 -7
  46. package/dist/schemas/oauth-authorization-details.js.map +1 -1
  47. package/dist/schemas/oauth-authorization-server-metadata.d.ts +462 -48
  48. package/dist/schemas/oauth-authorization-server-metadata.d.ts.map +1 -1
  49. package/dist/schemas/oauth-authorization-server-metadata.js +46 -65
  50. package/dist/schemas/oauth-authorization-server-metadata.js.map +1 -1
  51. package/dist/schemas/oauth-client-id-discoverable.d.ts +2 -2
  52. package/dist/schemas/oauth-client-id-discoverable.d.ts.map +1 -1
  53. package/dist/schemas/oauth-client-id-discoverable.js +20 -22
  54. package/dist/schemas/oauth-client-id-discoverable.js.map +1 -1
  55. package/dist/schemas/oauth-client-id.d.ts +3 -3
  56. package/dist/schemas/oauth-client-id.d.ts.map +1 -1
  57. package/dist/schemas/oauth-client-id.js +2 -2
  58. package/dist/schemas/oauth-client-id.js.map +1 -1
  59. package/dist/schemas/oauth-client-metadata.d.ts +73 -51
  60. package/dist/schemas/oauth-client-metadata.d.ts.map +1 -1
  61. package/dist/schemas/oauth-client-metadata.js +33 -40
  62. package/dist/schemas/oauth-client-metadata.js.map +1 -1
  63. package/dist/schemas/oauth-code-challenge-method.d.ts +3 -3
  64. package/dist/schemas/oauth-code-challenge-method.d.ts.map +1 -1
  65. package/dist/schemas/oauth-code-challenge-method.js +2 -2
  66. package/dist/schemas/oauth-code-challenge-method.js.map +1 -1
  67. package/dist/schemas/oauth-endpoint-auth-method.d.ts +3 -3
  68. package/dist/schemas/oauth-endpoint-auth-method.d.ts.map +1 -1
  69. package/dist/schemas/oauth-endpoint-auth-method.js +10 -2
  70. package/dist/schemas/oauth-endpoint-auth-method.js.map +1 -1
  71. package/dist/schemas/oauth-grant-type.d.ts +3 -3
  72. package/dist/schemas/oauth-grant-type.d.ts.map +1 -1
  73. package/dist/schemas/oauth-grant-type.js +10 -3
  74. package/dist/schemas/oauth-grant-type.js.map +1 -1
  75. package/dist/schemas/oauth-issuer-identifier.d.ts +3 -3
  76. package/dist/schemas/oauth-issuer-identifier.d.ts.map +1 -1
  77. package/dist/schemas/oauth-issuer-identifier.js +16 -9
  78. package/dist/schemas/oauth-issuer-identifier.js.map +1 -1
  79. package/dist/schemas/oauth-par-response.d.ts +5 -5
  80. package/dist/schemas/oauth-par-response.d.ts.map +1 -1
  81. package/dist/schemas/oauth-par-response.js +3 -3
  82. package/dist/schemas/oauth-par-response.js.map +1 -1
  83. package/dist/schemas/oauth-prompt.d.ts +3 -3
  84. package/dist/schemas/oauth-prompt.d.ts.map +1 -1
  85. package/dist/schemas/oauth-prompt.js +2 -2
  86. package/dist/schemas/oauth-prompt.js.map +1 -1
  87. package/dist/schemas/oauth-protected-resource-metadata.d.ts +88 -16
  88. package/dist/schemas/oauth-protected-resource-metadata.d.ts.map +1 -1
  89. package/dist/schemas/oauth-protected-resource-metadata.js +14 -26
  90. package/dist/schemas/oauth-protected-resource-metadata.js.map +1 -1
  91. package/dist/schemas/oauth-redirect-uri.d.ts +5 -5
  92. package/dist/schemas/oauth-redirect-uri.d.ts.map +1 -1
  93. package/dist/schemas/oauth-redirect-uri.js +3 -16
  94. package/dist/schemas/oauth-redirect-uri.js.map +1 -1
  95. package/dist/schemas/oauth-response-mode.d.ts +3 -3
  96. package/dist/schemas/oauth-response-mode.d.ts.map +1 -1
  97. package/dist/schemas/oauth-response-mode.js +2 -2
  98. package/dist/schemas/oauth-response-mode.js.map +1 -1
  99. package/dist/schemas/oauth-response-type.d.ts +3 -3
  100. package/dist/schemas/oauth-response-type.d.ts.map +1 -1
  101. package/dist/schemas/oauth-response-type.js +13 -7
  102. package/dist/schemas/oauth-response-type.js.map +1 -1
  103. package/dist/schemas/oauth-scope.d.ts +3 -3
  104. package/dist/schemas/oauth-scope.d.ts.map +1 -1
  105. package/dist/schemas/oauth-scope.js +2 -2
  106. package/dist/schemas/oauth-scope.js.map +1 -1
  107. package/dist/schemas/oauth-token-response.d.ts +17 -17
  108. package/dist/schemas/oauth-token-response.d.ts.map +1 -1
  109. package/dist/schemas/oauth-token-response.js +7 -7
  110. package/dist/schemas/oauth-token-response.js.map +1 -1
  111. package/dist/schemas/oauth-token-type.d.ts +3 -3
  112. package/dist/schemas/oauth-token-type.d.ts.map +1 -1
  113. package/dist/schemas/oauth-token-type.js +8 -7
  114. package/dist/schemas/oauth-token-type.js.map +1 -1
  115. package/dist/schemas/uri.d.ts +7 -7
  116. package/dist/schemas/uri.d.ts.map +1 -1
  117. package/dist/schemas/uri.js +44 -44
  118. package/dist/schemas/uri.js.map +1 -1
  119. package/dist/schemas/utils.d.ts.map +1 -1
  120. package/dist/schemas/utils.js.map +1 -1
  121. package/dist/scope.d.ts.map +1 -1
  122. package/dist/scope.js.map +1 -1
  123. package/lib/build-client-metadata.ts +9 -7
  124. package/lib/index.ts +31 -31
  125. package/lib/schemas/atcute-client-shared.ts +25 -0
  126. package/lib/schemas/atcute-confidential-client-metadata.ts +81 -111
  127. package/lib/schemas/atcute-public-client-metadata.ts +70 -166
  128. package/lib/schemas/atproto-authorization-server-metadata.ts +22 -23
  129. package/lib/schemas/atproto-oauth-scope.ts +8 -5
  130. package/lib/schemas/atproto-oauth-token-response.ts +10 -9
  131. package/lib/schemas/atproto-protected-resource-metadata.ts +15 -15
  132. package/lib/schemas/jwk.ts +104 -120
  133. package/lib/schemas/jwks.ts +28 -40
  134. package/lib/schemas/oauth-authorization-details.ts +10 -10
  135. package/lib/schemas/oauth-authorization-server-metadata.ts +72 -74
  136. package/lib/schemas/oauth-client-id-discoverable.ts +43 -48
  137. package/lib/schemas/oauth-client-id.ts +3 -3
  138. package/lib/schemas/oauth-client-metadata.ts +45 -49
  139. package/lib/schemas/oauth-code-challenge-method.ts +3 -3
  140. package/lib/schemas/oauth-endpoint-auth-method.ts +11 -11
  141. package/lib/schemas/oauth-grant-type.ts +11 -11
  142. package/lib/schemas/oauth-issuer-identifier.ts +35 -27
  143. package/lib/schemas/oauth-par-response.ts +4 -4
  144. package/lib/schemas/oauth-prompt.ts +3 -9
  145. package/lib/schemas/oauth-protected-resource-metadata.ts +26 -35
  146. package/lib/schemas/oauth-redirect-uri.ts +15 -23
  147. package/lib/schemas/oauth-response-mode.ts +3 -7
  148. package/lib/schemas/oauth-response-type.ts +12 -12
  149. package/lib/schemas/oauth-scope.ts +3 -3
  150. package/lib/schemas/oauth-token-response.ts +10 -10
  151. package/lib/schemas/oauth-token-type.ts +16 -12
  152. package/lib/schemas/uri.ts +89 -76
  153. package/package.json +9 -8
@@ -1,64 +1,64 @@
1
- import * as v from '@badrap/valita';
1
+ import * as v from 'valibot';
2
2
  /**
3
3
  * @see {@link https://datatracker.ietf.org/doc/html/rfc9396#section-2 | RFC 9396, Section 2}
4
4
  */
5
- export declare const oauthAuthorizationDetailSchema: v.ObjectType<{
6
- type: v.Type<string>;
5
+ export declare const oauthAuthorizationDetailSchema: v.LooseObjectSchema<{
6
+ readonly type: v.StringSchema<undefined>;
7
7
  /**
8
8
  * an array of strings representing the location of the resource or RS. these
9
9
  * strings are typically URIs identifying the location of the RS.
10
10
  */
11
- locations: v.Optional<string[]>;
11
+ readonly locations: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, undefined>, undefined>;
12
12
  /**
13
13
  * an array of strings representing the kinds of actions to be taken at the
14
14
  * resource.
15
15
  */
16
- actions: v.Optional<string[]>;
16
+ readonly actions: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
17
17
  /**
18
18
  * an array of strings representing the kinds of data being requested from the
19
19
  * resource.
20
20
  */
21
- datatypes: v.Optional<string[]>;
21
+ readonly datatypes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
22
22
  /**
23
23
  * a string identifier indicating a specific resource available at the API.
24
24
  */
25
- identifier: v.Optional<string>;
25
+ readonly identifier: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
26
26
  /**
27
27
  * an array of strings representing the types or levels of privilege being
28
28
  * requested at the resource.
29
29
  */
30
- privileges: v.Optional<string[]>;
30
+ readonly privileges: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
31
31
  }, undefined>;
32
- export type OAuthAuthorizationDetail = v.Infer<typeof oauthAuthorizationDetailSchema>;
32
+ export type OAuthAuthorizationDetail = v.InferOutput<typeof oauthAuthorizationDetailSchema>;
33
33
  /**
34
34
  * @see {@link https://datatracker.ietf.org/doc/html/rfc9396#section-2 | RFC 9396, Section 2}
35
35
  */
36
- export declare const oauthAuthorizationDetailsSchema: v.ArrayType<v.ObjectType<{
37
- type: v.Type<string>;
36
+ export declare const oauthAuthorizationDetailsSchema: v.ArraySchema<v.LooseObjectSchema<{
37
+ readonly type: v.StringSchema<undefined>;
38
38
  /**
39
39
  * an array of strings representing the location of the resource or RS. these
40
40
  * strings are typically URIs identifying the location of the RS.
41
41
  */
42
- locations: v.Optional<string[]>;
42
+ readonly locations: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "must be a valid url">]>, undefined>, undefined>;
43
43
  /**
44
44
  * an array of strings representing the kinds of actions to be taken at the
45
45
  * resource.
46
46
  */
47
- actions: v.Optional<string[]>;
47
+ readonly actions: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
48
48
  /**
49
49
  * an array of strings representing the kinds of data being requested from the
50
50
  * resource.
51
51
  */
52
- datatypes: v.Optional<string[]>;
52
+ readonly datatypes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
53
53
  /**
54
54
  * a string identifier indicating a specific resource available at the API.
55
55
  */
56
- identifier: v.Optional<string>;
56
+ readonly identifier: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
57
57
  /**
58
58
  * an array of strings representing the types or levels of privilege being
59
59
  * requested at the resource.
60
60
  */
61
- privileges: v.Optional<string[]>;
62
- }, undefined>>;
63
- export type OAuthAuthorizationDetails = v.Infer<typeof oauthAuthorizationDetailsSchema>;
61
+ readonly privileges: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
62
+ }, undefined>, undefined>;
63
+ export type OAuthAuthorizationDetails = v.InferOutput<typeof oauthAuthorizationDetailsSchema>;
64
64
  //# sourceMappingURL=oauth-authorization-details.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-details.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-authorization-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAIpC;;GAEG;AACH,eAAO,MAAM,8BAA8B;;IAE1C;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;aAEF,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAEtF;;GAEG;AACH,eAAO,MAAM,+BAA+B;;IA/B3C;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;cASkF,CAAC;AAEvF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
1
+ {"version":3,"file":"oauth-authorization-details.d.ts","sourceRoot":"","sources":["../../lib/schemas/oauth-authorization-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAI7B;;GAEG;AACH,eAAO,MAAM,8BAA8B;;IAE1C;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;aAEF,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE5F;;GAEG;AACH,eAAO,MAAM,+BAA+B;;IA/B3C;;;OAGG;;IAEH;;;OAGG;;IAEH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;yBASkF,CAAC;AAEvF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -1,34 +1,34 @@
1
- import * as v from '@badrap/valita';
1
+ import * as v from 'valibot';
2
2
  import { urlSchema } from './uri.js';
3
3
  /**
4
4
  * @see {@link https://datatracker.ietf.org/doc/html/rfc9396#section-2 | RFC 9396, Section 2}
5
5
  */
6
- export const oauthAuthorizationDetailSchema = v.object({
6
+ export const oauthAuthorizationDetailSchema = v.looseObject({
7
7
  type: v.string(),
8
8
  /**
9
9
  * an array of strings representing the location of the resource or RS. these
10
10
  * strings are typically URIs identifying the location of the RS.
11
11
  */
12
- locations: v.array(urlSchema).optional(),
12
+ locations: v.optional(v.array(urlSchema)),
13
13
  /**
14
14
  * an array of strings representing the kinds of actions to be taken at the
15
15
  * resource.
16
16
  */
17
- actions: v.array(v.string()).optional(),
17
+ actions: v.optional(v.array(v.string())),
18
18
  /**
19
19
  * an array of strings representing the kinds of data being requested from the
20
20
  * resource.
21
21
  */
22
- datatypes: v.array(v.string()).optional(),
22
+ datatypes: v.optional(v.array(v.string())),
23
23
  /**
24
24
  * a string identifier indicating a specific resource available at the API.
25
25
  */
26
- identifier: v.string().optional(),
26
+ identifier: v.optional(v.string()),
27
27
  /**
28
28
  * an array of strings representing the types or levels of privilege being
29
29
  * requested at the resource.
30
30
  */
31
- privileges: v.array(v.string()).optional(),
31
+ privileges: v.optional(v.array(v.string())),
32
32
  });
33
33
  /**
34
34
  * @see {@link https://datatracker.ietf.org/doc/html/rfc9396#section-2 | RFC 9396, Section 2}
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-authorization-details.js","sourceRoot":"","sources":["../../lib/schemas/oauth-authorization-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;IACxC;;;OAGG;IACH,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACvC;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACzC;;OAEG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC"}
1
+ {"version":3,"file":"oauth-authorization-details.js","sourceRoot":"","sources":["../../lib/schemas/oauth-authorization-details.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,WAAW,CAAC;IAC3D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACzC;;;OAGG;IACH,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC;;;OAGG;IACH,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1C;;OAEG;IACH,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CAC3C,CAAC,CAAC;AAIH;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC"}