@atproto/oauth-provider 0.2.1 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/account/account-store.d.ts +2 -2
  3. package/dist/assets/app/bundle-manifest.json +3 -3
  4. package/dist/assets/app/main.css +1 -1
  5. package/dist/assets/app/main.js +3 -3
  6. package/dist/assets/app/main.js.map +1 -1
  7. package/dist/assets/assets-middleware.d.ts.map +1 -1
  8. package/dist/assets/assets-middleware.js +4 -2
  9. package/dist/assets/assets-middleware.js.map +1 -1
  10. package/dist/client/client-manager.d.ts.map +1 -1
  11. package/dist/client/client-manager.js +127 -118
  12. package/dist/client/client-manager.js.map +1 -1
  13. package/dist/client/client-utils.d.ts +1 -2
  14. package/dist/client/client-utils.d.ts.map +1 -1
  15. package/dist/client/client-utils.js +3 -12
  16. package/dist/client/client-utils.js.map +1 -1
  17. package/dist/client/client.d.ts +8 -3
  18. package/dist/client/client.d.ts.map +1 -1
  19. package/dist/client/client.js +70 -1
  20. package/dist/client/client.js.map +1 -1
  21. package/dist/constants.d.ts +0 -1
  22. package/dist/constants.d.ts.map +1 -1
  23. package/dist/constants.js +1 -2
  24. package/dist/constants.js.map +1 -1
  25. package/dist/errors/access-denied-error.d.ts +4 -4
  26. package/dist/errors/access-denied-error.d.ts.map +1 -1
  27. package/dist/errors/access-denied-error.js +2 -2
  28. package/dist/errors/access-denied-error.js.map +1 -1
  29. package/dist/errors/account-selection-required-error.d.ts +2 -2
  30. package/dist/errors/account-selection-required-error.d.ts.map +1 -1
  31. package/dist/errors/account-selection-required-error.js.map +1 -1
  32. package/dist/errors/consent-required-error.d.ts +2 -2
  33. package/dist/errors/consent-required-error.d.ts.map +1 -1
  34. package/dist/errors/consent-required-error.js.map +1 -1
  35. package/dist/errors/invalid-authorization-details-error.d.ts +2 -2
  36. package/dist/errors/invalid-authorization-details-error.d.ts.map +1 -1
  37. package/dist/errors/invalid-authorization-details-error.js.map +1 -1
  38. package/dist/errors/invalid-client-id-error.d.ts +1 -1
  39. package/dist/errors/invalid-client-id-error.d.ts.map +1 -1
  40. package/dist/errors/invalid-client-id-error.js +12 -6
  41. package/dist/errors/invalid-client-id-error.js.map +1 -1
  42. package/dist/errors/invalid-client-metadata-error.d.ts +1 -1
  43. package/dist/errors/invalid-client-metadata-error.d.ts.map +1 -1
  44. package/dist/errors/invalid-client-metadata-error.js +11 -3
  45. package/dist/errors/invalid-client-metadata-error.js.map +1 -1
  46. package/dist/errors/invalid-parameters-error.d.ts +2 -2
  47. package/dist/errors/invalid-parameters-error.d.ts.map +1 -1
  48. package/dist/errors/invalid-parameters-error.js.map +1 -1
  49. package/dist/errors/invalid-scope-error.d.ts +9 -0
  50. package/dist/errors/invalid-scope-error.d.ts.map +1 -0
  51. package/dist/errors/invalid-scope-error.js +14 -0
  52. package/dist/errors/invalid-scope-error.js.map +1 -0
  53. package/dist/errors/login-required-error.d.ts +2 -2
  54. package/dist/errors/login-required-error.d.ts.map +1 -1
  55. package/dist/errors/login-required-error.js.map +1 -1
  56. package/dist/lib/html/html.d.ts +1 -1
  57. package/dist/lib/html/html.d.ts.map +1 -1
  58. package/dist/lib/html/html.js +14 -11
  59. package/dist/lib/html/html.js.map +1 -1
  60. package/dist/lib/http/parser.d.ts +9 -2
  61. package/dist/lib/http/parser.d.ts.map +1 -1
  62. package/dist/lib/http/parser.js +15 -7
  63. package/dist/lib/http/parser.js.map +1 -1
  64. package/dist/lib/http/request.d.ts +0 -23
  65. package/dist/lib/http/request.d.ts.map +1 -1
  66. package/dist/lib/http/request.js +1 -11
  67. package/dist/lib/http/request.js.map +1 -1
  68. package/dist/lib/http/stream.d.ts +28 -6
  69. package/dist/lib/http/stream.d.ts.map +1 -1
  70. package/dist/lib/http/stream.js +21 -32
  71. package/dist/lib/http/stream.js.map +1 -1
  72. package/dist/lib/util/authorization-header.d.ts.map +1 -1
  73. package/dist/lib/util/authorization-header.js +1 -1
  74. package/dist/lib/util/authorization-header.js.map +1 -1
  75. package/dist/lib/util/hostname.d.ts +3 -2
  76. package/dist/lib/util/hostname.d.ts.map +1 -1
  77. package/dist/lib/util/hostname.js +12 -8
  78. package/dist/lib/util/hostname.js.map +1 -1
  79. package/dist/metadata/build-metadata.d.ts.map +1 -1
  80. package/dist/metadata/build-metadata.js +2 -1
  81. package/dist/metadata/build-metadata.js.map +1 -1
  82. package/dist/oauth-errors.d.ts +1 -0
  83. package/dist/oauth-errors.d.ts.map +1 -1
  84. package/dist/oauth-errors.js +3 -1
  85. package/dist/oauth-errors.js.map +1 -1
  86. package/dist/oauth-hooks.d.ts +3 -3
  87. package/dist/oauth-hooks.d.ts.map +1 -1
  88. package/dist/oauth-provider.d.ts +20 -22
  89. package/dist/oauth-provider.d.ts.map +1 -1
  90. package/dist/oauth-provider.js +234 -176
  91. package/dist/oauth-provider.js.map +1 -1
  92. package/dist/oauth-verifier.d.ts +2 -2
  93. package/dist/oauth-verifier.d.ts.map +1 -1
  94. package/dist/oauth-verifier.js.map +1 -1
  95. package/dist/output/build-authorize-data.d.ts +2 -2
  96. package/dist/output/build-authorize-data.d.ts.map +1 -1
  97. package/dist/output/send-authorize-redirect.d.ts +2 -4
  98. package/dist/output/send-authorize-redirect.d.ts.map +1 -1
  99. package/dist/output/send-authorize-redirect.js +5 -2
  100. package/dist/output/send-authorize-redirect.js.map +1 -1
  101. package/dist/request/request-data.d.ts +2 -2
  102. package/dist/request/request-data.d.ts.map +1 -1
  103. package/dist/request/request-info.d.ts +2 -2
  104. package/dist/request/request-info.d.ts.map +1 -1
  105. package/dist/request/request-manager.d.ts +4 -4
  106. package/dist/request/request-manager.d.ts.map +1 -1
  107. package/dist/request/request-manager.js +94 -60
  108. package/dist/request/request-manager.js.map +1 -1
  109. package/dist/signer/signed-token-payload.d.ts +122 -122
  110. package/dist/signer/signer.d.ts +41 -40
  111. package/dist/signer/signer.d.ts.map +1 -1
  112. package/dist/signer/signer.js +13 -15
  113. package/dist/signer/signer.js.map +1 -1
  114. package/dist/token/token-claims.d.ts +121 -121
  115. package/dist/token/token-data.d.ts +3 -3
  116. package/dist/token/token-data.d.ts.map +1 -1
  117. package/dist/token/token-manager.d.ts +4 -5
  118. package/dist/token/token-manager.d.ts.map +1 -1
  119. package/dist/token/token-manager.js +96 -72
  120. package/dist/token/token-manager.js.map +1 -1
  121. package/dist/token/verify-token-claims.d.ts +3 -3
  122. package/dist/token/verify-token-claims.d.ts.map +1 -1
  123. package/dist/token/verify-token-claims.js.map +1 -1
  124. package/package.json +5 -4
  125. package/src/assets/app/components/accept-form.tsx +6 -2
  126. package/src/assets/app/components/client-name.tsx +10 -11
  127. package/src/assets/app/components/sign-in-form.tsx +31 -2
  128. package/src/assets/assets-middleware.ts +4 -2
  129. package/src/client/client-manager.ts +163 -161
  130. package/src/client/client-utils.ts +7 -12
  131. package/src/client/client.ts +112 -3
  132. package/src/constants.ts +0 -2
  133. package/src/errors/access-denied-error.ts +10 -4
  134. package/src/errors/account-selection-required-error.ts +2 -2
  135. package/src/errors/consent-required-error.ts +2 -2
  136. package/src/errors/invalid-authorization-details-error.ts +2 -2
  137. package/src/errors/invalid-client-id-error.ts +15 -4
  138. package/src/errors/invalid-client-metadata-error.ts +15 -3
  139. package/src/errors/invalid-parameters-error.ts +2 -2
  140. package/src/errors/invalid-scope-error.ts +15 -0
  141. package/src/errors/login-required-error.ts +2 -2
  142. package/src/lib/html/html.ts +14 -12
  143. package/src/lib/http/parser.ts +21 -8
  144. package/src/lib/http/request.ts +1 -23
  145. package/src/lib/http/stream.ts +29 -60
  146. package/src/lib/util/authorization-header.ts +5 -2
  147. package/src/lib/util/hostname.ts +9 -5
  148. package/src/metadata/build-metadata.ts +3 -1
  149. package/src/oauth-errors.ts +1 -0
  150. package/src/oauth-hooks.ts +3 -3
  151. package/src/oauth-provider.ts +368 -269
  152. package/src/oauth-verifier.ts +2 -2
  153. package/src/output/build-authorize-data.ts +2 -2
  154. package/src/output/send-authorize-redirect.ts +7 -6
  155. package/src/request/request-data.ts +2 -2
  156. package/src/request/request-info.ts +2 -2
  157. package/src/request/request-manager.ts +129 -103
  158. package/src/signer/signer.ts +24 -25
  159. package/src/token/token-data.ts +3 -3
  160. package/src/token/token-manager.ts +141 -99
  161. package/src/token/verify-token-claims.ts +3 -3
  162. package/dist/request/types.d.ts +0 -328
  163. package/dist/request/types.d.ts.map +0 -1
  164. package/dist/request/types.js +0 -27
  165. package/dist/request/types.js.map +0 -1
  166. package/dist/token/types.d.ts +0 -250
  167. package/dist/token/types.d.ts.map +0 -1
  168. package/dist/token/types.js +0 -36
  169. package/dist/token/types.js.map +0 -1
  170. package/src/request/types.ts +0 -48
  171. package/src/token/types.ts +0 -86
@@ -4,9 +4,13 @@ exports.Client = void 0;
4
4
  const oauth_types_1 = require("@atproto/oauth-types");
5
5
  const jose_1 = require("jose");
6
6
  const constants_js_1 = require("../constants.js");
7
+ const invalid_authorization_details_error_js_1 = require("../errors/invalid-authorization-details-error.js");
7
8
  const invalid_client_error_js_1 = require("../errors/invalid-client-error.js");
8
9
  const invalid_client_metadata_error_js_1 = require("../errors/invalid-client-metadata-error.js");
10
+ const invalid_parameters_error_js_1 = require("../errors/invalid-parameters-error.js");
9
11
  const invalid_request_error_js_1 = require("../errors/invalid-request-error.js");
12
+ const invalid_scope_error_js_1 = require("../errors/invalid-scope-error.js");
13
+ const redirect_uri_js_1 = require("../lib/util/redirect-uri.js");
10
14
  const client_auth_js_1 = require("./client-auth.js");
11
15
  const { JOSEError } = jose_1.errors;
12
16
  class Client {
@@ -72,7 +76,7 @@ class Client {
72
76
  }
73
77
  /**
74
78
  * @see {@link https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1}
75
- * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-jwt-bearer-11#section-3}
79
+ * @see {@link https://datatracker.ietf.org/doc/html/rfc7523#section-3}
76
80
  * @see {@link https://www.iana.org/assignments/oauth-parameters/oauth-parameters.xhtml#token-endpoint-auth-method}
77
81
  */
78
82
  async verifyCredentials(input, checks) {
@@ -152,6 +156,71 @@ class Client {
152
156
  // @ts-expect-error
153
157
  throw new Error(`Invalid method "${clientAuth.method}"`);
154
158
  }
159
+ /**
160
+ * Validates the request parameters against the client metadata.
161
+ */
162
+ validateRequest(parameters) {
163
+ if (parameters.client_id !== this.id) {
164
+ throw new invalid_parameters_error_js_1.InvalidParametersError(parameters, 'The "client_id" parameter field does not match the value used to authenticate the client');
165
+ }
166
+ if (parameters.scope !== undefined) {
167
+ // Any scope requested by the client must be registered in the client
168
+ // metadata.
169
+ const declaredScopes = this.metadata.scope?.split(' ');
170
+ if (!declaredScopes) {
171
+ throw new invalid_scope_error_js_1.InvalidScopeError(parameters, 'Client has no declared scopes in its metadata');
172
+ }
173
+ for (const scope of parameters.scope.split(' ')) {
174
+ if (!declaredScopes.includes(scope)) {
175
+ throw new invalid_scope_error_js_1.InvalidScopeError(parameters, `Scope "${scope}" is not declared in the client metadata`);
176
+ }
177
+ }
178
+ }
179
+ if (!this.metadata.response_types.includes(parameters.response_type)) {
180
+ throw new invalid_parameters_error_js_1.InvalidParametersError(parameters, `Invalid response_type "${parameters.response_type}" requested by the client`);
181
+ }
182
+ if (parameters.response_type.includes('code')) {
183
+ if (!this.metadata.grant_types.includes('authorization_code')) {
184
+ throw new invalid_parameters_error_js_1.InvalidParametersError(parameters, `This client is not allowed to use the "authorization_code" grant type`);
185
+ }
186
+ }
187
+ const { redirect_uri } = parameters;
188
+ if (redirect_uri) {
189
+ if (!this.metadata.redirect_uris.some((uri) => (0, redirect_uri_js_1.compareRedirectUri)(uri, redirect_uri))) {
190
+ throw new invalid_parameters_error_js_1.InvalidParametersError(parameters, `Invalid redirect_uri ${redirect_uri}`);
191
+ }
192
+ }
193
+ else {
194
+ const { defaultRedirectUri } = this;
195
+ if (defaultRedirectUri) {
196
+ parameters = { ...parameters, redirect_uri: defaultRedirectUri };
197
+ }
198
+ else {
199
+ // https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-10#authorization-request
200
+ //
201
+ // > "redirect_uri": OPTIONAL if only one redirect URI is registered for
202
+ // > this client. REQUIRED if multiple redirect URIs are registered for this
203
+ // > client.
204
+ throw new invalid_parameters_error_js_1.InvalidParametersError(parameters, 'redirect_uri is required');
205
+ }
206
+ }
207
+ if (parameters.authorization_details) {
208
+ const { authorization_details_types } = this.metadata;
209
+ if (!authorization_details_types) {
210
+ throw new invalid_authorization_details_error_js_1.InvalidAuthorizationDetailsError(parameters, 'Client Metadata does not declare any "authorization_details"');
211
+ }
212
+ for (const detail of parameters.authorization_details) {
213
+ if (!authorization_details_types?.includes(detail.type)) {
214
+ throw new invalid_authorization_details_error_js_1.InvalidAuthorizationDetailsError(parameters, `Client Metadata does not declare any "authorization_details" of type "${detail.type}"`);
215
+ }
216
+ }
217
+ }
218
+ return parameters;
219
+ }
220
+ get defaultRedirectUri() {
221
+ const { redirect_uris } = this.metadata;
222
+ return redirect_uris.length === 1 ? redirect_uris[0] : undefined;
223
+ }
155
224
  }
156
225
  exports.Client = Client;
157
226
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":";;;AACA,sDAI6B;AAC7B,+BAaa;AAEb,kDAAuE;AACvE,+EAAsE;AACtE,iGAAuF;AACvF,iFAAwE;AACxE,qDAAgE;AAIhE,MAAM,EAAE,SAAS,EAAE,GAAG,aAAM,CAAA;AAE5B,MAAa,MAAM;IASC;IACA;IACA;IACA;IAXlB;;OAEG;IACH,MAAM,CAAU,sBAAsB,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAU,CAAA;IAE5D,SAAS,CAAiB;IAE3C,YACkB,EAAY,EACZ,QAA6B,EAC7B,OAAyB,QAAQ,CAAC,IAAI,EACtC,IAAgB;QAHhB,OAAE,GAAF,EAAE,CAAU;QACZ,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,SAAI,GAAJ,IAAI,CAAkC;QACtC,SAAI,GAAJ,IAAI,CAAY;QAEhC,2EAA2E;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PREFIX = "req-";
10
10
  export declare const REQUEST_ID_BYTES_LENGTH = 16;
11
11
  export declare const CODE_PREFIX = "cod-";
12
12
  export declare const CODE_BYTES_LENGTH = 32;
13
- export declare const ALLOW_LOOPBACK_CLIENT_REFRESH_TOKEN = true;
14
13
  /** 7 days */
15
14
  export declare const AUTHENTICATION_MAX_AGE: number;
16
15
  /** 60 minutes */
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,sBAAsB,KAAK,CAAA;AAExC,eAAO,MAAM,iBAAiB,SAAS,CAAA;AACvC,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC,eAAO,MAAM,oBAAoB,SAAS,CAAA;AAC1C,eAAO,MAAM,0BAA0B,KAAK,CAAA;AAE5C,eAAO,MAAM,eAAe,SAAS,CAAA;AACrC,eAAO,MAAM,qBAAqB,KAAK,CAAA;AAEvC,eAAO,MAAM,iBAAiB,SAAS,CAAA;AACvC,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC,eAAO,MAAM,WAAW,SAAS,CAAA;AACjC,eAAO,MAAM,iBAAiB,KAAK,CAAA;AAEnC,eAAO,MAAM,mCAAmC,OAAO,CAAA;AAUvD,aAAa;AACb,eAAO,MAAM,sBAAsB,QAAU,CAAA;AAE7C,iBAAiB;AACjB,eAAO,MAAM,aAAa,QAAc,CAAA;AAExC,gBAAgB;AAChB,eAAO,MAAM,gCAAgC,QAAa,CAAA;AAE1D,eAAe;AACf,eAAO,MAAM,wCAAwC,QAAY,CAAA;AAEjE,aAAa;AACb,eAAO,MAAM,0CAA0C,QAAU,CAAA;AAEjE,aAAa;AACb,eAAO,MAAM,gCAAgC,QAAW,CAAA;AAExD,aAAa;AACb,eAAO,MAAM,8BAA8B,QAAW,CAAA;AAEtD,gBAAgB;AAChB,eAAO,MAAM,cAAc,QAAa,CAAA;AAEx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W,QAAc,CAAA;AAEtC,eAAe;AACf,eAAO,MAAM,wBAAwB,QAAa,CAAA;AAElD,gBAAgB;AAChB,eAAO,MAAM,kBAAkB,QAAa,CAAA;AAE5C,gBAAgB;AAChB,eAAO,MAAM,wBAAwB,QAAa,CAAA;AAElD,YAAY;AACZ,eAAO,MAAM,+BAA+B,QAAU,CAAA"}
package/dist/constants.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  // The purpose of the prefix is to provide type safety
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.CODE_CHALLENGE_REPLAY_TIMEFRAME = exports.SESSION_FIXATION_MAX_AGE = exports.DPOP_NONCE_MAX_AGE = exports.CLIENT_ASSERTION_MAX_AGE = exports.JAR_MAX_AGE = exports.PAR_EXPIRES_IN = exports.AUTHENTICATED_REFRESH_LIFETIME = exports.UNAUTHENTICATED_REFRESH_LIFETIME = exports.UNAUTHENTICATED_REFRESH_INACTIVITY_TIMEOUT = exports.AUTHENTICATED_REFRESH_INACTIVITY_TIMEOUT = exports.AUTHORIZATION_INACTIVITY_TIMEOUT = exports.TOKEN_MAX_AGE = exports.AUTHENTICATION_MAX_AGE = exports.ALLOW_LOOPBACK_CLIENT_REFRESH_TOKEN = exports.CODE_BYTES_LENGTH = exports.CODE_PREFIX = exports.REQUEST_ID_BYTES_LENGTH = exports.REQUEST_ID_PREFIX = exports.TOKEN_ID_BYTES_LENGTH = exports.TOKEN_ID_PREFIX = exports.REFRESH_TOKEN_BYTES_LENGTH = exports.REFRESH_TOKEN_PREFIX = exports.SESSION_ID_BYTES_LENGTH = exports.SESSION_ID_PREFIX = exports.DEVICE_ID_BYTES_LENGTH = exports.DEVICE_ID_PREFIX = void 0;
4
+ exports.CODE_CHALLENGE_REPLAY_TIMEFRAME = exports.SESSION_FIXATION_MAX_AGE = exports.DPOP_NONCE_MAX_AGE = exports.CLIENT_ASSERTION_MAX_AGE = exports.JAR_MAX_AGE = exports.PAR_EXPIRES_IN = exports.AUTHENTICATED_REFRESH_LIFETIME = exports.UNAUTHENTICATED_REFRESH_LIFETIME = exports.UNAUTHENTICATED_REFRESH_INACTIVITY_TIMEOUT = exports.AUTHENTICATED_REFRESH_INACTIVITY_TIMEOUT = exports.AUTHORIZATION_INACTIVITY_TIMEOUT = exports.TOKEN_MAX_AGE = exports.AUTHENTICATION_MAX_AGE = exports.CODE_BYTES_LENGTH = exports.CODE_PREFIX = exports.REQUEST_ID_BYTES_LENGTH = exports.REQUEST_ID_PREFIX = exports.TOKEN_ID_BYTES_LENGTH = exports.TOKEN_ID_PREFIX = exports.REFRESH_TOKEN_BYTES_LENGTH = exports.REFRESH_TOKEN_PREFIX = exports.SESSION_ID_BYTES_LENGTH = exports.SESSION_ID_PREFIX = exports.DEVICE_ID_BYTES_LENGTH = exports.DEVICE_ID_PREFIX = void 0;
5
5
  exports.DEVICE_ID_PREFIX = 'dev-';
6
6
  exports.DEVICE_ID_BYTES_LENGTH = 16; // 128 bits
7
7
  exports.SESSION_ID_PREFIX = 'ses-';
@@ -14,7 +14,6 @@ exports.REQUEST_ID_PREFIX = 'req-';
14
14
  exports.REQUEST_ID_BYTES_LENGTH = 16; // 128 bits
15
15
  exports.CODE_PREFIX = 'cod-';
16
16
  exports.CODE_BYTES_LENGTH = 32;
17
- exports.ALLOW_LOOPBACK_CLIENT_REFRESH_TOKEN = true;
18
17
  const SECOND = 1e3;
19
18
  const MINUTE = 60 * SECOND;
20
19
  const HOUR = 60 * MINUTE;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";AAAA,sDAAsD;;;AAEzC,QAAA,gBAAgB,GAAG,MAAM,CAAA;AACzB,QAAA,sBAAsB,GAAG,EAAE,CAAA,CAAC,WAAW;AAEvC,QAAA,iBAAiB,GAAG,MAAM,CAAA;AAC1B,QAAA,uBAAuB,GAAG,EAAE,CAAA,CAAC,8CAA8C;AAE3E,QAAA,oBAAoB,GAAG,MAAM,CAA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AsB,GAAG,CAAC,GAAG,GAAG,CAAA;AAE7C,iBAAiB;AACJ,QAAA,aAAa,GAAG,EAAE,GAAG,MAAM,CAAA;AAExC,gBAAgB;AACH,QAAA,gCAAgC,GAAG,CAAC,GAAG,MAAM,CAAA;AAE1D,eAAe;AACF,QAAA,wCAAwC,GAAG,CAAC,GAAG,KAAK,CAAA;AAEjE,aAAa;AACA,QAAA,0CAA0C,GAAG,CAAC,GAAG,GAAG,CAAA;AAEjE,aAAa;AACA,QAAA,gCAAgC,GAAG,CAAC,GAAG,IAAI,CAAA;AAExD,aAAa;AACA,QAAA,8BAA8B,GAAG,CAAC,GAAG,IAAI,CAAA;AAEtD,gBAAgB;AACH,QAAA,cAAc,GAAG,CAAC,GAAG,MAAM,CAAA;AAExC;;;;GAIG;AACU,QAAA,WAAW,GAAG,EAAE,GAAG,MAAM,CAAA;AAEtC,eAAe;AACF,QAAA,wBAAwB,GAAG,CAAC,GAAG,MAAM,CAAA;AAElD,gBAAgB;AACH,QAAA,kBAAkB,GAAG,CAAC,GAAG,MAAM,CAAA;AAE5C,gBAAgB;AACH,QAAA,wBAAwB,GAAG,CAAC,GAAG,MAAM,CAAA;AAElD,YAAY;AACC,QAAA,+BAA+B,GAAG,CAAC,GAAG,GAAG,CAAA"}
@@ -1,8 +1,8 @@
1
- import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
2
  import { OAuthError } from './oauth-error.js';
3
3
  export declare class AccessDeniedError extends OAuthError {
4
- readonly parameters: OAuthAuthenticationRequestParameters;
5
- constructor(parameters: OAuthAuthenticationRequestParameters, error_description: string, error?: string, cause?: unknown);
6
- static from(parameters: OAuthAuthenticationRequestParameters, cause?: unknown): AccessDeniedError;
4
+ readonly parameters: OAuthAuthorizationRequestParameters;
5
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description: string, error?: string, cause?: unknown);
6
+ static from(parameters: OAuthAuthorizationRequestParameters, cause?: unknown, fallbackError?: string): AccessDeniedError;
7
7
  }
8
8
  //# sourceMappingURL=access-denied-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"access-denied-error.d.ts","sourceRoot":"","sources":["../../src/errors/access-denied-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,qBAAa,iBAAkB,SAAQ,UAAU;aAE7B,UAAU,EAAE,oCAAoC;gBAAhD,UAAU,EAAE,oCAAoC,EAChE,iBAAiB,EAAE,MAAM,EACzB,KAAK,SAAkB,EACvB,KAAK,CAAC,EAAE,OAAO;IAKjB,MAAM,CAAC,IAAI,CACT,UAAU,EAAE,oCAAoC,EAChD,KAAK,CAAC,EAAE,OAAO;CASlB"}
1
+ {"version":3,"file":"access-denied-error.d.ts","sourceRoot":"","sources":["../../src/errors/access-denied-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAE1E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,qBAAa,iBAAkB,SAAQ,UAAU;aAE7B,UAAU,EAAE,mCAAmC;gBAA/C,UAAU,EAAE,mCAAmC,EAC/D,iBAAiB,EAAE,MAAM,EACzB,KAAK,SAAkB,EACvB,KAAK,CAAC,EAAE,OAAO;IAKjB,MAAM,CAAC,IAAI,CACT,UAAU,EAAE,mCAAmC,EAC/C,KAAK,CAAC,EAAE,OAAO,EACf,aAAa,CAAC,EAAE,MAAM;CAczB"}
@@ -9,12 +9,12 @@ class AccessDeniedError extends oauth_error_js_1.OAuthError {
9
9
  super(error, error_description, 400, cause);
10
10
  this.parameters = parameters;
11
11
  }
12
- static from(parameters, cause) {
12
+ static from(parameters, cause, fallbackError) {
13
13
  if (cause && cause instanceof AccessDeniedError) {
14
14
  return cause;
15
15
  }
16
16
  const { error, error_description } = (0, build_error_payload_js_1.buildErrorPayload)(cause);
17
- return new AccessDeniedError(parameters, error_description, error, cause);
17
+ return new AccessDeniedError(parameters, error_description, fallbackError ?? error, cause);
18
18
  }
19
19
  }
20
20
  exports.AccessDeniedError = AccessDeniedError;
@@ -1 +1 @@
1
- {"version":3,"file":"access-denied-error.js","sourceRoot":"","sources":["../../src/errors/access-denied-error.ts"],"names":[],"mappings":";;;AACA,6EAAoE;AACpE,qDAA6C;AAE7C,MAAa,iBAAkB,SAAQ,2BAAU;IAE7B;IADlB,YACkB,UAAgD,EAChE,iBAAyB,EACzB,KAAK,GAAG,eAAe,EACvB,KAAe;QAEf,KAAK,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;QAL3B,eAAU,GAAV,UAAU,CAAsC;IAMlE,CAAC;IAED,MAAM,CAAC,IAAI,CACT,UAAgD,EAChD,KAAe;QAEf,IAAI,KAAK,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;YAChD,OAAO,KAAK,CAAA;QACd,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,IAAA,0CAAiB,EAAC,KAAK,CAAC,CAAA;QAC7D,OAAO,IAAI,iBAAiB,CAAC,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,CAAA;IAC3E,CAAC;CACF;AArBD,8CAqBC"}
1
+ {"version":3,"file":"access-denied-error.js","sourceRoot":"","sources":["../../src/errors/access-denied-error.ts"],"names":[],"mappings":";;;AACA,6EAAoE;AACpE,qDAA6C;AAE7C,MAAa,iBAAkB,SAAQ,2BAAU;IAE7B;IADlB,YACkB,UAA+C,EAC/D,iBAAyB,EACzB,KAAK,GAAG,eAAe,EACvB,KAAe;QAEf,KAAK,CAAC,KAAK,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;QAL3B,eAAU,GAAV,UAAU,CAAqC;IAMjE,CAAC;IAED,MAAM,CAAC,IAAI,CACT,UAA+C,EAC/C,KAAe,EACf,aAAsB;QAEtB,IAAI,KAAK,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;YAChD,OAAO,KAAK,CAAA;QACd,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,IAAA,0CAAiB,EAAC,KAAK,CAAC,CAAA;QAC7D,OAAO,IAAI,iBAAiB,CAC1B,UAAU,EACV,iBAAiB,EACjB,aAAa,IAAI,KAAK,EACtB,KAAK,CACN,CAAA;IACH,CAAC;CACF;AA3BD,8CA2BC"}
@@ -1,6 +1,6 @@
1
- import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
2
  import { AccessDeniedError } from './access-denied-error.js';
3
3
  export declare class AccountSelectionRequiredError extends AccessDeniedError {
4
- constructor(parameters: OAuthAuthenticationRequestParameters, error_description?: string, cause?: unknown);
4
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description?: string, cause?: unknown);
5
5
  }
6
6
  //# sourceMappingURL=account-selection-required-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account-selection-required-error.d.ts","sourceRoot":"","sources":["../../src/errors/account-selection-required-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,6BAA8B,SAAQ,iBAAiB;gBAEhE,UAAU,EAAE,oCAAoC,EAChD,iBAAiB,SAA+B,EAChD,KAAK,CAAC,EAAE,OAAO;CAIlB"}
1
+ {"version":3,"file":"account-selection-required-error.d.ts","sourceRoot":"","sources":["../../src/errors/account-selection-required-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,6BAA8B,SAAQ,iBAAiB;gBAEhE,UAAU,EAAE,mCAAmC,EAC/C,iBAAiB,SAA+B,EAChD,KAAK,CAAC,EAAE,OAAO;CAIlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"account-selection-required-error.js","sourceRoot":"","sources":["../../src/errors/account-selection-required-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,6BAA8B,SAAQ,0CAAiB;IAClE,YACE,UAAgD,EAChD,iBAAiB,GAAG,4BAA4B,EAChD,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,KAAK,CAAC,CAAA;IAC3E,CAAC;CACF;AARD,sEAQC"}
1
+ {"version":3,"file":"account-selection-required-error.js","sourceRoot":"","sources":["../../src/errors/account-selection-required-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,6BAA8B,SAAQ,0CAAiB;IAClE,YACE,UAA+C,EAC/C,iBAAiB,GAAG,4BAA4B,EAChD,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,KAAK,CAAC,CAAA;IAC3E,CAAC;CACF;AARD,sEAQC"}
@@ -1,6 +1,6 @@
1
- import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
2
  import { AccessDeniedError } from './access-denied-error.js';
3
3
  export declare class ConsentRequiredError extends AccessDeniedError {
4
- constructor(parameters: OAuthAuthenticationRequestParameters, error_description?: string, cause?: unknown);
4
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description?: string, cause?: unknown);
5
5
  }
6
6
  //# sourceMappingURL=consent-required-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consent-required-error.d.ts","sourceRoot":"","sources":["../../src/errors/consent-required-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,oBAAqB,SAAQ,iBAAiB;gBAEvD,UAAU,EAAE,oCAAoC,EAChD,iBAAiB,SAA0B,EAC3C,KAAK,CAAC,EAAE,OAAO;CAIlB"}
1
+ {"version":3,"file":"consent-required-error.d.ts","sourceRoot":"","sources":["../../src/errors/consent-required-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,oBAAqB,SAAQ,iBAAiB;gBAEvD,UAAU,EAAE,mCAAmC,EAC/C,iBAAiB,SAA0B,EAC3C,KAAK,CAAC,EAAE,OAAO;CAIlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"consent-required-error.js","sourceRoot":"","sources":["../../src/errors/consent-required-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,oBAAqB,SAAQ,0CAAiB;IACzD,YACE,UAAgD,EAChD,iBAAiB,GAAG,uBAAuB,EAC3C,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAA;IACjE,CAAC;CACF;AARD,oDAQC"}
1
+ {"version":3,"file":"consent-required-error.js","sourceRoot":"","sources":["../../src/errors/consent-required-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,oBAAqB,SAAQ,0CAAiB;IACzD,YACE,UAA+C,EAC/C,iBAAiB,GAAG,uBAAuB,EAC3C,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,KAAK,CAAC,CAAA;IACjE,CAAC;CACF;AARD,oDAQC"}
@@ -1,4 +1,4 @@
1
- import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
2
  import { AccessDeniedError } from './access-denied-error.js';
3
3
  /**
4
4
  * @see
@@ -16,6 +16,6 @@ import { AccessDeniedError } from './access-denied-error.js';
16
16
  * - is missing required fields for the authorization details type.
17
17
  */
18
18
  export declare class InvalidAuthorizationDetailsError extends AccessDeniedError {
19
- constructor(parameters: OAuthAuthenticationRequestParameters, error_description: string, cause?: unknown);
19
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description: string, cause?: unknown);
20
20
  }
21
21
  //# sourceMappingURL=invalid-authorization-details-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-authorization-details-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-authorization-details-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gCAAiC,SAAQ,iBAAiB;gBAEnE,UAAU,EAAE,oCAAoC,EAChD,iBAAiB,EAAE,MAAM,EACzB,KAAK,CAAC,EAAE,OAAO;CAIlB"}
1
+ {"version":3,"file":"invalid-authorization-details-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-authorization-details-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gCAAiC,SAAQ,iBAAiB;gBAEnE,UAAU,EAAE,mCAAmC,EAC/C,iBAAiB,EAAE,MAAM,EACzB,KAAK,CAAC,EAAE,OAAO;CAIlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-authorization-details-error.js","sourceRoot":"","sources":["../../src/errors/invalid-authorization-details-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAa,gCAAiC,SAAQ,0CAAiB;IACrE,YACE,UAAgD,EAChD,iBAAyB,EACzB,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,KAAK,CAAC,CAAA;IAC9E,CAAC;CACF;AARD,4EAQC"}
1
+ {"version":3,"file":"invalid-authorization-details-error.js","sourceRoot":"","sources":["../../src/errors/invalid-authorization-details-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D;;;;;;;;;;;;;;GAcG;AACH,MAAa,gCAAiC,SAAQ,0CAAiB;IACrE,YACE,UAA+C,EAC/C,iBAAyB,EACzB,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,+BAA+B,EAAE,KAAK,CAAC,CAAA;IAC9E,CAAC;CACF;AARD,4EAQC"}
@@ -8,6 +8,6 @@ import { OAuthError } from './oauth-error.js';
8
8
  */
9
9
  export declare class InvalidClientIdError extends OAuthError {
10
10
  constructor(error_description: string, cause?: unknown);
11
- static from(err: unknown): InvalidClientIdError;
11
+ static from(cause: unknown, fallbackMessage?: string): InvalidClientIdError;
12
12
  }
13
13
  //# sourceMappingURL=invalid-client-id-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-client-id-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-client-id-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;gBACtC,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAItD,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB;CAKhD"}
1
+ {"version":3,"file":"invalid-client-id-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-client-id-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;gBACtC,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAItD,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,OAAO,EACd,eAAe,SAA8B,GAC5C,oBAAoB;CAaxB"}
@@ -13,12 +13,18 @@ class InvalidClientIdError extends oauth_error_js_1.OAuthError {
13
13
  constructor(error_description, cause) {
14
14
  super('invalid_client_id', error_description, 400, cause);
15
15
  }
16
- static from(err) {
17
- if (err instanceof InvalidClientIdError)
18
- return err;
19
- if (err instanceof TypeError)
20
- return new InvalidClientIdError(err.message);
21
- return new InvalidClientIdError('Invalid client identifier', err);
16
+ static from(cause, fallbackMessage = 'Invalid client identifier') {
17
+ if (cause instanceof InvalidClientIdError) {
18
+ return cause;
19
+ }
20
+ if (cause instanceof TypeError) {
21
+ // This method is meant to be used in the context of parsing & validating
22
+ // a client client metadata. In that context, a TypeError would more
23
+ // likely represent a problem with the data (e.g. invalid URL constructor
24
+ // arg) and not a programming error.
25
+ return new InvalidClientIdError(cause.message, cause);
26
+ }
27
+ return new InvalidClientIdError(fallbackMessage, cause);
22
28
  }
23
29
  }
24
30
  exports.InvalidClientIdError = InvalidClientIdError;
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-client-id-error.js","sourceRoot":"","sources":["../../src/errors/invalid-client-id-error.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAE7C;;;;;;GAMG;AACH,MAAa,oBAAqB,SAAQ,2BAAU;IAClD,YAAY,iBAAyB,EAAE,KAAe;QACpD,KAAK,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IAC3D,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAY;QACtB,IAAI,GAAG,YAAY,oBAAoB;YAAE,OAAO,GAAG,CAAA;QACnD,IAAI,GAAG,YAAY,SAAS;YAAE,OAAO,IAAI,oBAAoB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC1E,OAAO,IAAI,oBAAoB,CAAC,2BAA2B,EAAE,GAAG,CAAC,CAAA;IACnE,CAAC;CACF;AAVD,oDAUC"}
1
+ {"version":3,"file":"invalid-client-id-error.js","sourceRoot":"","sources":["../../src/errors/invalid-client-id-error.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAE7C;;;;;;GAMG;AACH,MAAa,oBAAqB,SAAQ,2BAAU;IAClD,YAAY,iBAAyB,EAAE,KAAe;QACpD,KAAK,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IAC3D,CAAC;IAED,MAAM,CAAC,IAAI,CACT,KAAc,EACd,eAAe,GAAG,2BAA2B;QAE7C,IAAI,KAAK,YAAY,oBAAoB,EAAE,CAAC;YAC1C,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;YAC/B,yEAAyE;YACzE,oEAAoE;YACpE,yEAAyE;YACzE,oCAAoC;YACpC,OAAO,IAAI,oBAAoB,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QACvD,CAAC;QACD,OAAO,IAAI,oBAAoB,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IACzD,CAAC;CACF;AArBD,oDAqBC"}
@@ -8,6 +8,6 @@ import { OAuthError } from './oauth-error.js';
8
8
  */
9
9
  export declare class InvalidClientMetadataError extends OAuthError {
10
10
  constructor(error_description: string, cause?: unknown);
11
- static from(cause: unknown): InvalidClientMetadataError;
11
+ static from(cause: unknown, fallbackMessage?: string): InvalidClientMetadataError;
12
12
  }
13
13
  //# sourceMappingURL=invalid-client-metadata-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-client-metadata-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-client-metadata-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,UAAU;gBAC5C,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAItD,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B;CAIxD"}
1
+ {"version":3,"file":"invalid-client-metadata-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-client-metadata-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;;;;;GAMG;AACH,qBAAa,0BAA2B,SAAQ,UAAU;gBAC5C,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;IAItD,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,OAAO,EACd,eAAe,SAAqC,GACnD,0BAA0B;CAa9B"}
@@ -13,10 +13,18 @@ class InvalidClientMetadataError extends oauth_error_js_1.OAuthError {
13
13
  constructor(error_description, cause) {
14
14
  super('invalid_client_metadata', error_description, 400, cause);
15
15
  }
16
- static from(cause) {
17
- if (cause instanceof InvalidClientMetadataError)
16
+ static from(cause, fallbackMessage = 'Invalid client metadata document') {
17
+ if (cause instanceof InvalidClientMetadataError) {
18
18
  return cause;
19
- return new InvalidClientMetadataError('Invalid client configuration', cause);
19
+ }
20
+ if (cause instanceof TypeError) {
21
+ // This method is meant to be used in the context of parsing & validating
22
+ // a client client metadata. In that context, a TypeError would more
23
+ // likely represent a problem with the data (e.g. invalid URL constructor
24
+ // arg) and not a programming error.
25
+ return new InvalidClientMetadataError(cause.message, cause);
26
+ }
27
+ return new InvalidClientMetadataError(fallbackMessage, cause);
20
28
  }
21
29
  }
22
30
  exports.InvalidClientMetadataError = InvalidClientMetadataError;
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-client-metadata-error.js","sourceRoot":"","sources":["../../src/errors/invalid-client-metadata-error.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAE7C;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,2BAAU;IACxD,YAAY,iBAAyB,EAAE,KAAe;QACpD,KAAK,CAAC,yBAAyB,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,KAAc;QACxB,IAAI,KAAK,YAAY,0BAA0B;YAAE,OAAO,KAAK,CAAA;QAC7D,OAAO,IAAI,0BAA0B,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAA;IAC9E,CAAC;CACF;AATD,gEASC"}
1
+ {"version":3,"file":"invalid-client-metadata-error.js","sourceRoot":"","sources":["../../src/errors/invalid-client-metadata-error.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAE7C;;;;;;GAMG;AACH,MAAa,0BAA2B,SAAQ,2BAAU;IACxD,YAAY,iBAAyB,EAAE,KAAe;QACpD,KAAK,CAAC,yBAAyB,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IACjE,CAAC;IAED,MAAM,CAAC,IAAI,CACT,KAAc,EACd,eAAe,GAAG,kCAAkC;QAEpD,IAAI,KAAK,YAAY,0BAA0B,EAAE,CAAC;YAChD,OAAO,KAAK,CAAA;QACd,CAAC;QACD,IAAI,KAAK,YAAY,SAAS,EAAE,CAAC;YAC/B,yEAAyE;YACzE,oEAAoE;YACpE,yEAAyE;YACzE,oCAAoC;YACpC,OAAO,IAAI,0BAA0B,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;QAC7D,CAAC;QACD,OAAO,IAAI,0BAA0B,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;IAC/D,CAAC;CACF;AArBD,gEAqBC"}
@@ -1,6 +1,6 @@
1
- import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
2
  import { AccessDeniedError } from './access-denied-error.js';
3
3
  export declare class InvalidParametersError extends AccessDeniedError {
4
- constructor(parameters: OAuthAuthenticationRequestParameters, error_description: string, cause?: unknown);
4
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description: string, cause?: unknown);
5
5
  }
6
6
  //# sourceMappingURL=invalid-parameters-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-parameters-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-parameters-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,sBAAuB,SAAQ,iBAAiB;gBAEzD,UAAU,EAAE,oCAAoC,EAChD,iBAAiB,EAAE,MAAM,EACzB,KAAK,CAAC,EAAE,OAAO;CAIlB"}
1
+ {"version":3,"file":"invalid-parameters-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-parameters-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,sBAAuB,SAAQ,iBAAiB;gBAEzD,UAAU,EAAE,mCAAmC,EAC/C,iBAAiB,EAAE,MAAM,EACzB,KAAK,CAAC,EAAE,OAAO;CAIlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-parameters-error.js","sourceRoot":"","sources":["../../src/errors/invalid-parameters-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,sBAAuB,SAAQ,0CAAiB;IAC3D,YACE,UAAgD,EAChD,iBAAyB,EACzB,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAChE,CAAC;CACF;AARD,wDAQC"}
1
+ {"version":3,"file":"invalid-parameters-error.js","sourceRoot":"","sources":["../../src/errors/invalid-parameters-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,sBAAuB,SAAQ,0CAAiB;IAC3D,YACE,UAA+C,EAC/C,iBAAyB,EACzB,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAA;IAChE,CAAC;CACF;AARD,wDAQC"}
@@ -0,0 +1,9 @@
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
+ import { AccessDeniedError } from './access-denied-error.js';
3
+ /**
4
+ * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11#section-4.1.2.1}
5
+ */
6
+ export declare class InvalidScopeError extends AccessDeniedError {
7
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description: string, cause?: unknown);
8
+ }
9
+ //# sourceMappingURL=invalid-scope-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-scope-error.d.ts","sourceRoot":"","sources":["../../src/errors/invalid-scope-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,iBAAiB;gBAEpD,UAAU,EAAE,mCAAmC,EAC/C,iBAAiB,EAAE,MAAM,EACzB,KAAK,CAAC,EAAE,OAAO;CAIlB"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InvalidScopeError = void 0;
4
+ const access_denied_error_js_1 = require("./access-denied-error.js");
5
+ /**
6
+ * @see {@link https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-11#section-4.1.2.1}
7
+ */
8
+ class InvalidScopeError extends access_denied_error_js_1.AccessDeniedError {
9
+ constructor(parameters, error_description, cause) {
10
+ super(parameters, error_description, 'invalid_scope', cause);
11
+ }
12
+ }
13
+ exports.InvalidScopeError = InvalidScopeError;
14
+ //# sourceMappingURL=invalid-scope-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invalid-scope-error.js","sourceRoot":"","sources":["../../src/errors/invalid-scope-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D;;GAEG;AACH,MAAa,iBAAkB,SAAQ,0CAAiB;IACtD,YACE,UAA+C,EAC/C,iBAAyB,EACzB,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,eAAe,EAAE,KAAK,CAAC,CAAA;IAC9D,CAAC;CACF;AARD,8CAQC"}
@@ -1,6 +1,6 @@
1
- import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
1
+ import { OAuthAuthorizationRequestParameters } from '@atproto/oauth-types';
2
2
  import { AccessDeniedError } from './access-denied-error.js';
3
3
  export declare class LoginRequiredError extends AccessDeniedError {
4
- constructor(parameters: OAuthAuthenticationRequestParameters, error_description?: string, cause?: unknown);
4
+ constructor(parameters: OAuthAuthorizationRequestParameters, error_description?: string, cause?: unknown);
5
5
  }
6
6
  //# sourceMappingURL=login-required-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"login-required-error.d.ts","sourceRoot":"","sources":["../../src/errors/login-required-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,kBAAmB,SAAQ,iBAAiB;gBAErD,UAAU,EAAE,oCAAoC,EAChD,iBAAiB,SAAsB,EACvC,KAAK,CAAC,EAAE,OAAO;CAIlB"}
1
+ {"version":3,"file":"login-required-error.d.ts","sourceRoot":"","sources":["../../src/errors/login-required-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mCAAmC,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAE5D,qBAAa,kBAAmB,SAAQ,iBAAiB;gBAErD,UAAU,EAAE,mCAAmC,EAC/C,iBAAiB,SAAsB,EACvC,KAAK,CAAC,EAAE,OAAO;CAIlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"login-required-error.js","sourceRoot":"","sources":["../../src/errors/login-required-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,kBAAmB,SAAQ,0CAAiB;IACvD,YACE,UAAgD,EAChD,iBAAiB,GAAG,mBAAmB,EACvC,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,CAAC;CACF;AARD,gDAQC"}
1
+ {"version":3,"file":"login-required-error.js","sourceRoot":"","sources":["../../src/errors/login-required-error.ts"],"names":[],"mappings":";;;AACA,qEAA4D;AAE5D,MAAa,kBAAmB,SAAQ,0CAAiB;IACvD,YACE,UAA+C,EAC/C,iBAAiB,GAAG,mBAAmB,EACvC,KAAe;QAEf,KAAK,CAAC,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,KAAK,CAAC,CAAA;IAC/D,CAAC;CACF;AARD,gDAQC"}
@@ -2,7 +2,7 @@
2
2
  * This class represents trusted HTML that can be safely embedded in a web page,
3
3
  * or used as fragments to build a larger HTML document.
4
4
  */
5
- export declare class Html {
5
+ export declare class Html implements Iterable<string> {
6
6
  #private;
7
7
  private constructor();
8
8
  toString(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/lib/html/html.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,IAAI;;IAGf,OAAO;IAYP,QAAQ,IAAI,MAAM;IAmBlB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,KAAA,GAAG,MAAM;IAUjC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC;IAK9C,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI;CAGnE"}
1
+ {"version":3,"file":"html.d.ts","sourceRoot":"","sources":["../../../src/lib/html/html.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,qBAAa,IAAK,YAAW,QAAQ,CAAC,MAAM,CAAC;;IAG3C,OAAO;IAYP,QAAQ,IAAI,MAAM;IAgBlB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,KAAA,GAAG,MAAM;IAUjC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC;IAU9C,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,IAAI;CAGnE"}
@@ -18,19 +18,16 @@ class Html {
18
18
  this.#fragments = fragments;
19
19
  }
20
20
  toString() {
21
- // Lazily compute & join the fragments when they are used, to avoid
22
- // unnecessary intermediate strings when concatenating multiple Html as
23
- // fragments.
21
+ let result = '';
22
+ for (const fragment of this)
23
+ result += fragment;
24
+ // Cache result for future calls
24
25
  if (!Array.isArray(this.#fragments) ||
25
26
  this.#fragments.length > 1 ||
26
27
  !this.#fragments.every(util_1.isString)) {
27
- // Will call `toString` recursively, as well as generating iterator
28
- // results.
29
- const fragment = Array.from(this.#fragments, String).join('');
30
- this.#fragments = [fragment]; // Cache result for future calls
31
- return fragment;
28
+ this.#fragments = result ? [result] : [];
32
29
  }
33
- return this.#fragments.join('');
30
+ return result;
34
31
  }
35
32
  [Symbol.toPrimitive](hint) {
36
33
  switch (hint) {
@@ -42,8 +39,14 @@ class Html {
42
39
  }
43
40
  }
44
41
  *[Symbol.iterator]() {
45
- // Using toString() here to use the optimized path for string concatenation
46
- yield this.toString();
42
+ for (const fragment of this.#fragments) {
43
+ if (typeof fragment === 'string') {
44
+ yield fragment;
45
+ }
46
+ else {
47
+ yield* fragment;
48
+ }
49
+ }
47
50
  }
48
51
  static dangerouslyCreate(fragments) {
49
52
  return new Html(fragments, symbol);
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/lib/html/html.ts"],"names":[],"mappings":";;;AAAA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;gBACE,MAAM,IAAI,SAAS,CAAC,4BAA4B,IAAI,EAAE,CAAC,CAAA;QAC3D,CAAC;IACH,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;gBACjC,MAAM,QAAQ,CAAA;YAChB,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,CAAC,QAAQ,CAAA;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,SAAkC;QACzD,OAAO,IAAI,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IACpC,CAAC;CACF;AAtDD,oBAsDC"}
@@ -3,7 +3,12 @@ export type JsonScalar = string | number | boolean | null;
3
3
  export type Json = JsonScalar | Json[] | {
4
4
  [_ in string]?: Json;
5
5
  };
6
- export declare const parseContentType: (type: string) => ContentType;
6
+ /**
7
+ * Parse a content-type string into its components.
8
+ *
9
+ * @throws {TypeError} If the content-type is invalid.
10
+ */
11
+ export declare function parseContentType(type: unknown): ContentType;
7
12
  export type ContentType = {
8
13
  mime: string;
9
14
  charset?: string;
@@ -27,7 +32,9 @@ export declare const parsers: [{
27
32
  }, {
28
33
  readonly name: "urlencoded";
29
34
  readonly test: (mime: string) => mime is "application/x-www-form-urlencoded";
30
- readonly parse: (buffer: Buffer, { charset }: ContentType) => Partial<Record<string, string>>;
35
+ readonly parse: (buffer: Buffer, { charset }: ContentType) => {
36
+ [x: string]: string | undefined;
37
+ };
31
38
  }, {
32
39
  readonly name: "bytes";
33
40
  readonly test: (mime: string) => mime is "application/octet-stream";
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/http/parser.ts"],"names":[],"mappings":";AAIA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IA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