@atproto/oauth-provider 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/account/account.d.ts +6 -2
  3. package/dist/account/account.d.ts.map +1 -1
  4. package/dist/assets/app/bundle-manifest.json +3 -3
  5. package/dist/assets/app/main.css +1 -1
  6. package/dist/assets/app/main.js +3 -3
  7. package/dist/assets/app/main.js.map +1 -1
  8. package/dist/assets/assets-middleware.d.ts +2 -1
  9. package/dist/assets/assets-middleware.d.ts.map +1 -1
  10. package/dist/assets/assets-middleware.js +7 -0
  11. package/dist/assets/assets-middleware.js.map +1 -1
  12. package/dist/client/client-manager.d.ts +4 -3
  13. package/dist/client/client-manager.d.ts.map +1 -1
  14. package/dist/client/client-manager.js +91 -77
  15. package/dist/client/client-manager.js.map +1 -1
  16. package/dist/client/client.d.ts +2 -3
  17. package/dist/client/client.d.ts.map +1 -1
  18. package/dist/client/client.js +6 -12
  19. package/dist/client/client.js.map +1 -1
  20. package/dist/constants.d.ts +2 -0
  21. package/dist/constants.d.ts.map +1 -1
  22. package/dist/constants.js +3 -1
  23. package/dist/constants.js.map +1 -1
  24. package/dist/device/device-manager.d.ts +1 -1
  25. package/dist/device/device-manager.d.ts.map +1 -1
  26. package/dist/device/device-manager.js +2 -2
  27. package/dist/device/device-manager.js.map +1 -1
  28. package/dist/dpop/dpop-manager.d.ts +0 -1
  29. package/dist/dpop/dpop-manager.d.ts.map +1 -1
  30. package/dist/dpop/dpop-manager.js +1 -4
  31. package/dist/dpop/dpop-manager.js.map +1 -1
  32. package/dist/errors/invalid-authorization-details-error.d.ts +4 -3
  33. package/dist/errors/invalid-authorization-details-error.d.ts.map +1 -1
  34. package/dist/errors/invalid-authorization-details-error.js +4 -4
  35. package/dist/errors/invalid-authorization-details-error.js.map +1 -1
  36. package/dist/lib/http/parser.d.ts +13 -7
  37. package/dist/lib/http/parser.d.ts.map +1 -1
  38. package/dist/lib/http/parser.js +29 -9
  39. package/dist/lib/http/parser.js.map +1 -1
  40. package/dist/lib/http/request.d.ts +8 -5
  41. package/dist/lib/http/request.d.ts.map +1 -1
  42. package/dist/lib/http/request.js +24 -12
  43. package/dist/lib/http/request.js.map +1 -1
  44. package/dist/lib/http/stream.d.ts.map +1 -1
  45. package/dist/lib/http/stream.js +3 -2
  46. package/dist/lib/http/stream.js.map +1 -1
  47. package/dist/metadata/build-metadata.d.ts +0 -1
  48. package/dist/metadata/build-metadata.d.ts.map +1 -1
  49. package/dist/metadata/build-metadata.js +9 -49
  50. package/dist/metadata/build-metadata.js.map +1 -1
  51. package/dist/oauth-hooks.d.ts +3 -10
  52. package/dist/oauth-hooks.d.ts.map +1 -1
  53. package/dist/oauth-provider.d.ts +10 -15
  54. package/dist/oauth-provider.d.ts.map +1 -1
  55. package/dist/oauth-provider.js +176 -114
  56. package/dist/oauth-provider.js.map +1 -1
  57. package/dist/oauth-verifier.d.ts +1 -2
  58. package/dist/oauth-verifier.d.ts.map +1 -1
  59. package/dist/oauth-verifier.js.map +1 -1
  60. package/dist/output/build-authorize-data.d.ts +6 -0
  61. package/dist/output/build-authorize-data.d.ts.map +1 -1
  62. package/dist/output/build-authorize-data.js +1 -0
  63. package/dist/output/build-authorize-data.js.map +1 -1
  64. package/dist/replay/replay-manager.d.ts +1 -0
  65. package/dist/replay/replay-manager.d.ts.map +1 -1
  66. package/dist/replay/replay-manager.js +3 -0
  67. package/dist/replay/replay-manager.js.map +1 -1
  68. package/dist/replay/replay-store.d.ts +1 -1
  69. package/dist/request/request-info.d.ts +2 -0
  70. package/dist/request/request-info.d.ts.map +1 -1
  71. package/dist/request/request-manager.d.ts +3 -9
  72. package/dist/request/request-manager.d.ts.map +1 -1
  73. package/dist/request/request-manager.js +52 -77
  74. package/dist/request/request-manager.js.map +1 -1
  75. package/dist/request/types.d.ts +10 -10
  76. package/dist/signer/signed-token-payload.d.ts +88 -88
  77. package/dist/signer/signer.d.ts +24 -31
  78. package/dist/signer/signer.d.ts.map +1 -1
  79. package/dist/signer/signer.js +0 -40
  80. package/dist/signer/signer.js.map +1 -1
  81. package/dist/token/token-claims.d.ts +84 -84
  82. package/dist/token/token-manager.d.ts +1 -2
  83. package/dist/token/token-manager.d.ts.map +1 -1
  84. package/dist/token/token-manager.js +10 -37
  85. package/dist/token/token-manager.js.map +1 -1
  86. package/dist/token/types.d.ts +10 -10
  87. package/package.json +3 -3
  88. package/src/account/account.ts +11 -7
  89. package/src/assets/app/backend-data.ts +9 -2
  90. package/src/assets/app/components/accept-form.tsx +65 -51
  91. package/src/assets/app/components/client-name.tsx +24 -16
  92. package/src/assets/app/components/url-viewer.tsx +3 -3
  93. package/src/assets/app/views/accept-view.tsx +7 -4
  94. package/src/assets/app/views/authorize-view.tsx +2 -1
  95. package/src/assets/assets-middleware.ts +14 -2
  96. package/src/client/client-manager.ts +124 -120
  97. package/src/client/client.ts +5 -17
  98. package/src/constants.ts +3 -0
  99. package/src/device/device-manager.ts +7 -1
  100. package/src/dpop/dpop-manager.ts +1 -6
  101. package/src/errors/invalid-authorization-details-error.ts +9 -4
  102. package/src/lib/http/parser.ts +37 -13
  103. package/src/lib/http/request.ts +61 -15
  104. package/src/lib/http/stream.ts +5 -2
  105. package/src/metadata/build-metadata.ts +9 -56
  106. package/src/oauth-hooks.ts +3 -13
  107. package/src/oauth-provider.ts +187 -177
  108. package/src/oauth-verifier.ts +1 -2
  109. package/src/output/build-authorize-data.ts +8 -0
  110. package/src/replay/replay-manager.ts +9 -0
  111. package/src/replay/replay-store.ts +1 -1
  112. package/src/request/request-info.ts +2 -0
  113. package/src/request/request-manager.ts +81 -107
  114. package/src/signer/signer.ts +0 -63
  115. package/src/token/token-manager.ts +8 -41
  116. package/dist/oidc/claims.d.ts +0 -16
  117. package/dist/oidc/claims.d.ts.map +0 -1
  118. package/dist/oidc/claims.js +0 -29
  119. package/dist/oidc/claims.js.map +0 -1
  120. package/dist/oidc/userinfo.d.ts +0 -7
  121. package/dist/oidc/userinfo.d.ts.map +0 -1
  122. package/dist/oidc/userinfo.js +0 -3
  123. package/dist/oidc/userinfo.js.map +0 -1
  124. package/dist/parameters/claims-requested.d.ts +0 -3
  125. package/dist/parameters/claims-requested.d.ts.map +0 -1
  126. package/dist/parameters/claims-requested.js +0 -77
  127. package/dist/parameters/claims-requested.js.map +0 -1
  128. package/dist/parameters/oidc-payload.d.ts +0 -31
  129. package/dist/parameters/oidc-payload.d.ts.map +0 -1
  130. package/dist/parameters/oidc-payload.js +0 -25
  131. package/dist/parameters/oidc-payload.js.map +0 -1
  132. package/src/assets/app/components/client-identifier.tsx +0 -31
  133. package/src/oidc/claims.ts +0 -35
  134. package/src/oidc/userinfo.ts +0 -11
  135. package/src/parameters/claims-requested.ts +0 -106
  136. package/src/parameters/oidc-payload.ts +0 -28
@@ -1 +1 @@
1
- {"version":3,"file":"device-manager.js","sourceRoot":"","sources":["../../src/device/device-manager.ts"],"names":[],"mappings":";;;AAEA,mCAAqD;AAErD,6BAAuB;AAEvB,mDAAqE;AAErE,kDAA0D;AAE1D,2DAA0D;AAC1D,iDAA2E;AAE3E,mDAAoE;AAEvD,QAAA,eAAe,GAAG;IAC7B;;;;;OAKG;IACH,UAAU,EAAE,IAAI;IAEhB;;;;OAIG;IACH,YAAY,EAAE,CAAC,GAAG,IAAI;IAEtB;;OAEG;IACH,MAAM,EAAE;QACN,IAAI,EAAE,SAAgC;QAEtC;;;;WAIG;QACH,MAAM,EAAE,WAAW;QAEnB;;;;WAIG;QACH,OAAO,EAAE,YAAY;QAErB;;;;WAIG;QACH,IAAI,EAAE,kBAAkB;QAExB;;;;;;WAMG;QACH,GAAG,EAAiB,CAAC,EAAE,GAAG,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QAEjD;;;;WAIG;QACH,MAAM,EAAE,IAAI;QAEZ;;;;WAIG;QACH,QAAQ,EAAE,KAAyB;KACpC;CACF,CAAA;AAID,MAAM,iBAAiB,GAAG,OAAC,CAAC,KAAK,CAAC,CAAC,6BAAc,E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AAO,EACd,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EACjD,aAAa,CACd,CACF,CAAA;QACH,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,GAAoB;QAC3C,OAAO,IAAA,wCAAoB,EAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAC3D,CAAC;CACF;AAvMD,sCAuMC"}
@@ -24,7 +24,6 @@ export declare class DpopManager {
24
24
  protectedHeader: import("jose").JWTHeaderParameters;
25
25
  payload: {
26
26
  iat: number;
27
- exp: number;
28
27
  jti: string;
29
28
  } & import("jose").JWTPayload;
30
29
  jkt: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dpop-manager.d.ts","sourceRoot":"","sources":["../../src/dpop/dpop-manager.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAI3D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,CAAA;AACzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,cAAc,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qBAAa,WAAW;IACtB,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;gBAE5B,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAE,kBAAuB;IAK7D,SAAS,IAAI,MAAM,GAAG,SAAS;IAI/B;;OAEG;IACG,UAAU,CACd,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,MAAM,EAAE,cAAc;IAC3B,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,WAAW;IAC9B,WAAW,CAAC,EAAE,MAAM;;;iBAWb,MAAM;iBACN,MAAM;iBACN,MAAM;;;;CAoEhB"}
1
+ {"version":3,"file":"dpop-manager.d.ts","sourceRoot":"","sources":["../../src/dpop/dpop-manager.ts"],"names":[],"mappings":";AAOA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAI3D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,CAAA;AACzC,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,cAAc,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qBAAa,WAAW;IACtB,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAA;gBAE5B,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAE,kBAAuB;IAK7D,SAAS,IAAI,MAAM,GAAG,SAAS;IAI/B;;OAEG;IACG,UAAU,CACd,KAAK,EAAE,OAAO,EACd,GAAG,EAAE,MAAM,EAAE,cAAc;IAC3B,GAAG,EAAE,MAAM,GAAG,GAAG,EAAE,WAAW;IAC9B,WAAW,CAAC,EAAE,MAAM;;;iBAWb,MAAM;iBACN,MAAM;;;;CAgEhB"}
@@ -34,7 +34,7 @@ class DpopManager {
34
34
  typ: 'dpop+jwt',
35
35
  maxTokenAge: 10,
36
36
  clockTolerance: constants_js_1.DPOP_NONCE_MAX_AGE / 1e3,
37
- requiredClaims: ['iat', 'exp', 'jti'],
37
+ requiredClaims: ['iat', 'jti'],
38
38
  }).catch((err) => {
39
39
  const message = err instanceof JOSEError
40
40
  ? `Invalid DPoP proof (${err.message})`
@@ -44,9 +44,6 @@ class DpopManager {
44
44
  if (!payload.jti || typeof payload.jti !== 'string') {
45
45
  throw new invalid_dpop_proof_error_js_1.InvalidDpopProofError('Invalid or missing jti property');
46
46
  }
47
- if (payload.exp - payload.iat > constants_js_1.DPOP_NONCE_MAX_AGE / 3 / 1e3) {
48
- throw new invalid_dpop_proof_error_js_1.InvalidDpopProofError('DPoP proof validity too long');
49
- }
50
47
  // Note rfc9110#section-9.1 states that the method name is case-sensitive
51
48
  if (!htm || htm !== payload['htm']) {
52
49
  throw new invalid_dpop_proof_error_js_1.InvalidDpopProofError('DPoP htm mismatch');
@@ -1 +1 @@
1
- {"version":3,"file":"dpop-manager.js","sourceRoot":"","sources":["../../src/dpop/dpop-manager.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAExC,+BAA6E;AAE7E,kDAAoD;AACpD,uFAA6E;AAC7E,+EAAqE;AACrE,mDAA2D;AAIlD,0FAJA,yBAAS,OAIA;AAFlB,MAAM,EAAE,SAAS,EAAE,GAAG,aAAM,CAAA;AAc5B,MAAa,WAAW;IACH,SAAS,CAAY;IAExC,YAAY,EAAE,UAAU,EAAE,QAAQ,KAAyB,EAAE;QAC3D,IAAI,CAAC,SAAS;YACZ,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,yBAAS,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC3E,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,CAAA;IAC/B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CACd,KAAc,EACd,GAAW,EAAE,cAAc;IAC3B,GAAiB,EAAE,WAAW;IAC9B,WAAoB;QAEpB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC/C,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;QAED,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACxC,MAAM,IAAI,mDAAqB,CAAC,qBAAqB,CAAC,CAAA;QACxD,CAAC;QAED,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,gBAAS,EAIjD,KAAK,EAAE,kBAAW,EAAE;YACrB,GAAG,E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,YAAY,CAAC,GAAY;IAChC,eAAe;IACf,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAA;IAErB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;QAChC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAA;QACb,GAAG,CAAC,MAAM,GAAG,EAAE,CAAA;QACf,OAAO,GAAG,CAAC,IAAI,CAAA;IACjB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
@@ -1,4 +1,5 @@
1
- import { OAuthError } from './oauth-error.js';
1
+ import { OAuthAuthenticationRequestParameters } from '@atproto/oauth-types';
2
+ import { AccessDeniedError } from './access-denied-error.js';
2
3
  /**
3
4
  * @see
4
5
  * {@link https://datatracker.ietf.org/doc/html/rfc9396#section-14.6 | RFC 9396 - OAuth Dynamic Client Registration Metadata Registration Error}
@@ -14,7 +15,7 @@ import { OAuthError } from './oauth-error.js';
14
15
  * - contains fields with invalid values for the authorization details type, or
15
16
  * - is missing required fields for the authorization details type.
16
17
  */
17
- export declare class InvalidAuthorizationDetailsError extends OAuthError {
18
- constructor(error_description: string, cause?: unknown);
18
+ export declare class InvalidAuthorizationDetailsError extends AccessDeniedError {
19
+ constructor(parameters: OAuthAuthenticationRequestParameters, error_description: string, cause?: unknown);
19
20
  }
20
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,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gCAAiC,SAAQ,UAAU;gBAClD,iBAAiB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAGvD"}
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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.InvalidAuthorizationDetailsError = void 0;
4
- const oauth_error_js_1 = require("./oauth-error.js");
4
+ const access_denied_error_js_1 = require("./access-denied-error.js");
5
5
  /**
6
6
  * @see
7
7
  * {@link https://datatracker.ietf.org/doc/html/rfc9396#section-14.6 | RFC 9396 - OAuth Dynamic Client Registration Metadata Registration Error}
@@ -17,9 +17,9 @@ const oauth_error_js_1 = require("./oauth-error.js");
17
17
  * - contains fields with invalid values for the authorization details type, or
18
18
  * - is missing required fields for the authorization details type.
19
19
  */
20
- class InvalidAuthorizationDetailsError extends oauth_error_js_1.OAuthError {
21
- constructor(error_description, cause) {
22
- super('invalid_authorization_details', error_description, 400, cause);
20
+ class InvalidAuthorizationDetailsError extends access_denied_error_js_1.AccessDeniedError {
21
+ constructor(parameters, error_description, cause) {
22
+ super(parameters, error_description, 'invalid_authorization_details', cause);
23
23
  }
24
24
  }
25
25
  exports.InvalidAuthorizationDetailsError = InvalidAuthorizationDetailsError;
@@ -1 +1 @@
1
- {"version":3,"file":"invalid-authorization-details-error.js","sourceRoot":"","sources":["../../src/errors/invalid-authorization-details-error.ts"],"names":[],"mappings":";;;AAAA,qDAA6C;AAE7C;;;;;;;;;;;;;;GAcG;AACH,MAAa,gCAAiC,SAAQ,2BAAU;IAC9D,YAAY,iBAAyB,EAAE,KAAe;QACpD,KAAK,CAAC,+BAA+B,EAAE,iBAAiB,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;IACvE,CAAC;CACF;AAJD,4EAIC"}
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"}
@@ -3,10 +3,16 @@ 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;
7
+ export type ContentType = {
8
+ mime: string;
9
+ charset?: string;
10
+ boundary?: string;
11
+ };
6
12
  export type Parser<T extends string = string, R = unknown> = {
7
13
  readonly name: string;
8
- readonly test: (type: string) => type is T;
9
- readonly parse: (buffer: Buffer) => R;
14
+ readonly test: (mime: string) => mime is T;
15
+ readonly parse: (buffer: Buffer, type: ContentType) => R;
10
16
  };
11
17
  export type ParserName<P extends Parser> = P extends {
12
18
  readonly name: infer N;
@@ -16,15 +22,15 @@ export type ParserResult<P extends Parser> = ReturnType<P['parse']>;
16
22
  export type ParserForType<P extends Parser, T> = P extends Parser<infer U> ? (U extends T ? P : never) : never;
17
23
  export declare const parsers: [{
18
24
  readonly name: "json";
19
- readonly test: (type: string) => type is "application/json" | `application/${string}+json`;
20
- readonly parse: (buffer: Buffer) => Json;
25
+ readonly test: (mime: string) => mime is "application/json" | `application/${string}+json`;
26
+ readonly parse: (buffer: Buffer, { charset }: ContentType) => Json;
21
27
  }, {
22
28
  readonly name: "urlencoded";
23
- readonly test: (type: string) => type is "application/x-www-form-urlencoded";
24
- readonly parse: (buffer: Buffer) => Partial<Record<string, string>>;
29
+ readonly test: (mime: string) => mime is "application/x-www-form-urlencoded";
30
+ readonly parse: (buffer: Buffer, { charset }: ContentType) => Partial<Record<string, string>>;
25
31
  }, {
26
32
  readonly name: "bytes";
27
- readonly test: (type: string) => type is "application/octet-stream";
33
+ readonly test: (mime: string) => mime is "application/octet-stream";
28
34
  readonly parse: (buffer: Buffer) => Buffer;
29
35
  }];
30
36
  export type KnownParser = (typeof parsers)[number];
@@ -1 +1 @@
1
- {"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../src/lib/http/parser.ts"],"names":[],"mappings":";AAGA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAA;AACzD,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,IAAI,EAAE,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,IAAI;CAAE,CAAA;AAEjE,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,OAAO,IAAI;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,CAAC,CAAA;CACtC,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3E,CAAC,GACD,KAAK,CAAA;AACT,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAChF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,UAAU,CAAC,CAAC,CA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rB,QAAQ,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,IAAI,CAAC,CAAA;IAC1C,QAAQ,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,KAAK,CAAC,CAAA;CACzD,CAAA;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;CAAE,GAC3E,CAAC,GACD,KAAK,CAAA;AACT,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAChF,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;AAEnE,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAC3C,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,KAAK,CAAA;AAE/D,eAAO,MAAM,OAAO;;;kEAMc,IAAI;;;;kEAgBJ,QAAQ,OAAO,MAAM,EAAE,MAAM,CAAC,CAAC;;;;wCAiB5C,MAAM;EAEE,CAAA;AAE7B,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAElD,MAAM,MAAM,UAAU,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;AAC5C,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA"}
@@ -3,16 +3,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parsers = void 0;
6
+ exports.parsers = exports.parseContentType = void 0;
7
7
  const bourne_1 = require("@hapi/bourne");
8
+ const content_1 = require("@hapi/content");
8
9
  const http_errors_1 = __importDefault(require("http-errors"));
10
+ const parseContentType = (type) => {
11
+ try {
12
+ return (0, content_1.type)(type);
13
+ }
14
+ catch (err) {
15
+ // De-boomify the error
16
+ if (err?.['isBoom']) {
17
+ throw (0, http_errors_1.default)(err['output']['statusCode'], err['message']);
18
+ }
19
+ throw err;
20
+ }
21
+ };
22
+ exports.parseContentType = parseContentType;
9
23
  exports.parsers = [
10
24
  {
11
25
  name: 'json',
12
- test: (type) => {
13
- return /^application\/(?:.+\+)?json$/.test(type);
26
+ test: (mime) => {
27
+ return /^application\/(?:.+\+)?json$/.test(mime);
14
28
  },
15
- parse: (buffer) => {
29
+ parse: (buffer, { charset }) => {
30
+ if (charset != null && !/^utf-?8$/i.test(charset)) {
31
+ throw (0, http_errors_1.default)(415, 'Unsupported charset');
32
+ }
16
33
  try {
17
34
  return (0, bourne_1.parse)(buffer.toString());
18
35
  }
@@ -23,10 +40,13 @@ exports.parsers = [
23
40
  },
24
41
  {
25
42
  name: 'urlencoded',
26
- test: (type) => {
27
- return type === 'application/x-www-form-urlencoded';
43
+ test: (mime) => {
44
+ return mime === 'application/x-www-form-urlencoded';
28
45
  },
29
- parse: (buffer) => {
46
+ parse: (buffer, { charset }) => {
47
+ if (charset != null && !/^utf-?8$/i.test(charset)) {
48
+ throw (0, http_errors_1.default)(415, 'Unsupported charset');
49
+ }
30
50
  try {
31
51
  if (!buffer.length)
32
52
  return {};
@@ -39,8 +59,8 @@ exports.parsers = [
39
59
  },
40
60
  {
41
61
  name: 'bytes',
42
- test: (type) => {
43
- return type === 'application/octet-stream';
62
+ test: (mime) => {
63
+ return mime === 'application/octet-stream';
44
64
  },
45
65
  parse: (buffer) => buffer,
46
66
  },
@@ -1 +1 @@
1
- {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/lib/http/parser.ts"],"names":[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IAAI,EAAE,CAAC,IAAI,EAA+C,EAAE;YAC1D,OAAO,IAAI,KAAK,mCAAmC,CAAA;QACrD,CAAC;QACD,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,EAAmC,EAAE;YAC9D,IAAI,OAAO,IAAI,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBAClD,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA;YACnD,CAAC;YACD,IAAI,CAAC;gBACH,IAAI,CAAC,MAAM,CAAC,MAAM;oBAAE,OAAO,EAAE,CAAA;gBAC7B,OAAO,MAAM,CAAC,WAAW,CAAC,IAAI,eAAe,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;YACnE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,0BAA0B,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;YACxE,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,CAAC,IAAI,EAAsC,EAAE;YACjD,OAAO,IAAI,KAAK,0BAA0B,CAAA;QAC5C,CAAC;QACD,KAAK,EAAE,CAAC,MAAM,EAAU,EAAE,CAAC,MAAM;KAClC;CAC0B,CAAA"}
@@ -6,25 +6,28 @@ import { IncomingMessage, ServerResponse } from './types.js';
6
6
  import { UrlReference } from './url.js';
7
7
  export declare function parseRequestPayload<A extends readonly KnownNames[] = readonly KnownNames[]>(req: IncomingMessage, allow?: A): Promise<ReturnType<(Extract<{
8
8
  readonly name: "json";
9
- readonly test: (type: string) => type is "application/json" | `application/${string}+json`;
10
- readonly parse: (buffer: Buffer) => import("./parser.js").Json;
9
+ readonly test: (mime: string) => mime is "application/json" | `application/${string}+json`;
10
+ readonly parse: (buffer: Buffer, { charset }: import("./parser.js").ContentType) => import("./parser.js").Json;
11
11
  }, {
12
12
  name: A[number];
13
13
  }> | Extract<{
14
14
  readonly name: "urlencoded";
15
- readonly test: (type: string) => type is "application/x-www-form-urlencoded";
16
- readonly parse: (buffer: Buffer) => Partial<Record<string, string>>;
15
+ readonly test: (mime: string) => mime is "application/x-www-form-urlencoded";
16
+ readonly parse: (buffer: Buffer, { charset }: import("./parser.js").ContentType) => Partial<Record<string, string>>;
17
17
  }, {
18
18
  name: A[number];
19
19
  }> | Extract<{
20
20
  readonly name: "bytes";
21
- readonly test: (type: string) => type is "application/octet-stream";
21
+ readonly test: (mime: string) => mime is "application/octet-stream";
22
22
  readonly parse: (buffer: Buffer) => Buffer;
23
23
  }, {
24
24
  name: A[number];
25
25
  }>)["parse"]>>;
26
26
  export declare function validateRequestPayload<S extends z.ZodTypeAny>(req: IncomingMessage, schema: S, allow?: readonly KnownNames[]): Promise<z.infer<S>>;
27
+ export declare function validateHeaderValue(req: IncomingMessage, name: keyof IncomingMessage['headers'], allowedValues: readonly (string | null)[]): void;
27
28
  export declare function validateFetchMode(req: IncomingMessage, res: ServerResponse, expectedMode: readonly (null | 'navigate' | 'same-origin' | 'no-cors' | 'cors')[]): void;
29
+ export declare function validateFetchDest(req: IncomingMessage, res: ServerResponse, expectedDest: readonly (null | 'document' | 'embed' | 'font' | 'image' | 'manifest' | 'media' | 'object' | 'report' | 'script' | 'serviceworker' | 'sharedworker' | 'style' | 'worker' | 'xslt')[]): void;
30
+ export declare function validateFetchSite(req: IncomingMessage, res: ServerResponse, expectedSite: readonly (null | 'same-origin' | 'same-site' | 'cross-site' | 'none')[]): void;
28
31
  export declare function validateReferer(req: IncomingMessage, res: ServerResponse, reference: UrlReference, allowNull?: boolean): void;
29
32
  export declare function setupCsrfToken(req: IncomingMessage, res: ServerResponse, cookieName?: string): Promise<void>;
30
33
  export declare function validateSameOrigin(req: IncomingMessage, res: ServerResponse, origin: string, allowNull?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"request.d.ts","sourceRoot":"","s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E,SAAS,CACnB,IAAI,GACJ,UAAU,GACV,OAAO,GACP,MAAM,GACN,OAAO,GACP,UAAU,GACV,OAAO,GACP,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,eAAe,GACf,cAAc,GACd,OAAO,GACP,QAAQ,GACR,MAAM,CACT,EAAE,QAGJ;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,YAAY,EAAE,SAAS,CACnB,IAAI,GACJ,aAAa,GACb,WAAW,GACX,YAAY,GACZ,MAAM,CACT,EAAE,QAGJ;AAED,wBAAgB,eAAe,CAC7B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,YAAY,EACvB,SAAS,UAAQ,QAOlB;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,UAAU,SAAe,iBAa1B;AAGD,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,MAAM,EACd,SAAS,UAAO,QAMjB;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,SAAe,EACzB,WAAW,UAAQ,QAwBpB;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,eAAe,GACnB,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,CAM3C"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.parseHttpCookies = exports.validateCsrfToken = exports.validateSameOrigin = exports.setupCsrfToken = exports.validateReferer = exports.validateFetchMode = exports.validateRequestPayload = exports.parseRequestPayload = void 0;
6
+ exports.parseHttpCookies = exports.validateCsrfToken = exports.validateSameOrigin = exports.setupCsrfToken = exports.validateReferer = exports.validateFetchSite = exports.validateFetchDest = exports.validateFetchMode = exports.validateHeaderValue = exports.validateRequestPayload = exports.parseRequestPayload = void 0;
7
7
  const cookie_1 = require("cookie");
8
8
  const crypto_1 = require("crypto");
9
9
  const http_errors_1 = __importDefault(require("http-errors"));
@@ -19,23 +19,35 @@ async function validateRequestPayload(req, schema, allow = ['json', 'urlencoded'
19
19
  return schema.parseAsync(payload, { path: ['body'] });
20
20
  }
21
21
  exports.validateRequestPayload = validateRequestPayload;
22
- function validateFetchMode(req, res, expectedMode) {
23
- const reqMode = req.headers['sec-fetch-mode'] ?? null;
24
- if (Array.isArray(reqMode)) {
25
- throw (0, http_errors_1.default)(400, `Invalid sec-fetch-mode header`);
22
+ function validateHeaderValue(req, name, allowedValues) {
23
+ const value = req.headers[name] ?? null;
24
+ if (Array.isArray(value)) {
25
+ throw (0, http_errors_1.default)(400, `Invalid ${name} header`);
26
26
  }
27
- if (!expectedMode.includes(reqMode)) {
28
- throw (0, http_errors_1.default)(403, reqMode
29
- ? `Forbidden sec-fetch-mode "${reqMode}" (expected ${expectedMode})`
30
- : `Missing sec-fetch-mode (expected ${expectedMode})`);
27
+ if (!allowedValues.includes(value)) {
28
+ throw (0, http_errors_1.default)(400, value
29
+ ? `Forbidden ${name} header "${value}" (expected ${allowedValues})`
30
+ : `Missing ${name} header`);
31
31
  }
32
32
  }
33
+ exports.validateHeaderValue = validateHeaderValue;
34
+ function validateFetchMode(req, res, expectedMode) {
35
+ validateHeaderValue(req, 'sec-fetch-mode', expectedMode);
36
+ }
33
37
  exports.validateFetchMode = validateFetchMode;
38
+ function validateFetchDest(req, res, expectedDest) {
39
+ validateHeaderValue(req, 'sec-fetch-dest', expectedDest);
40
+ }
41
+ exports.validateFetchDest = validateFetchDest;
42
+ function validateFetchSite(req, res, expectedSite) {
43
+ validateHeaderValue(req, 'sec-fetch-site', expectedSite);
44
+ }
45
+ exports.validateFetchSite = validateFetchSite;
34
46
  function validateReferer(req, res, reference, allowNull = false) {
35
47
  const referer = req.headers['referer'];
36
48
  const refererUrl = referer ? new URL(referer) : null;
37
49
  if (refererUrl ? !(0, url_js_1.urlMatch)(refererUrl, reference) : !allowNull) {
38
- throw (0, http_errors_1.default)(403, `Invalid referer ${referer}`);
50
+ throw (0, http_errors_1.default)(400, `Invalid referer ${referer}`);
39
51
  }
40
52
  }
41
53
  exports.validateReferer = validateReferer;
@@ -53,7 +65,7 @@ exports.setupCsrfToken = setupCsrfToken;
53
65
  function validateSameOrigin(req, res, origin, allowNull = true) {
54
66
  const reqOrigin = req.headers['origin'];
55
67
  if (reqOrigin ? reqOrigin !== origin : !allowNull) {
56
- throw (0, http_errors_1.default)(403, `Invalid origin ${reqOrigin}`);
68
+ throw (0, http_errors_1.default)(400, `Invalid origin ${reqOrigin}`);
57
69
  }
58
70
  }
59
71
  exports.validateSameOrigin = validateSameOrigin;
@@ -63,7 +75,7 @@ function validateCsrfToken(req, res, csrfToken, cookieName = 'csrf_token', clear
63
75
  !cookies ||
64
76
  !cookieName ||
65
77
  cookies[cookieName] !== csrfToken) {
66
- throw (0, http_errors_1.default)(403, `Invalid CSRF token`);
78
+ throw (0, http_errors_1.default)(400, `Invalid CSRF token`);
67
79
  }
68
80
  if (clearCookie) {
69
81
  (0, response_js_1.appendHeader)(res, 'Set-Cookie', (0, cookie_1.serialize)(cookieName, '', {
@@ -1 +1 @@
1
- {"version":3,"file":"request.js","sourceRoot":"","sources":["../../../src/lib/http/request.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA2E;AAC3E,mCAAoC;AACpC,8DAAyC;AAIzC,+CAA4C;AAC5C,2CAAuD;AAEvD,qCAAiD;AAEjD,SAAgB,mBAAmB,CAEjC,GAAoB,EAAE,KAAS;IAC/B,OAAO,IAAA,uBAAW,EAChB,IAAA,wBAAY,EAAC,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC,EAClD,G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","sourceRoot":"","sources":["../../../src/lib/http/stream.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EACV,aAAa,EACb,YAAY,EAEb,MAAM,aAAa,CAAA;AAEpB,wBAAsB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ/D;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,QAAQ,EACb,QAAQ,GAAE,MAAmB,GAC5B,QAAQ,CAWV;AAED,wBAAsB,WAAW,CAC/B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE,EAEvD,GAAG,EAAE,QAAQ,EACb,WAAW,EAAE,CAAC,EACd,KAAK,CAAC,EAAE,CAAC,GACR,OAAO,CACR,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAC1E,CAAA;AACD,wBAAsB,WAAW,CAC/B,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE,EAEvD,GAAG,EAAE,QAAQ,EACb,WAAW,EAAE,OAAO,EACpB,KAAK,CAAC,EAAE,CAAC,GACR,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/http/stream.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAe,QAAQ,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,EACL,UAAU,EACV,WAAW,EACX,UAAU,EAEV,aAAa,EACb,YAAY,EAEb,MAAM,aAAa,CAAA;AAEpB,wBAAsB,UAAU,CAAC,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ/D;AAED,wBAAgB,YAAY,CAC1B,GAAG,EAAE,QAAQ,EACb,QAAQ,GAAE,MAAmB,GAC5B,QAAQ,CAWV;AAED,wBAAsB,WAAW,CAC/B,CAAC,SAAS,UAAU,EACpB,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE,EAEvD,GAAG,EAAE,QAAQ,EACb,WAAW,EAAE,CAAC,EACd,KAAK,CAAC,EAAE,CAAC,GACR,OAAO,CACR,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAC1E,CAAA;AACD,wBAAsB,WAAW,CAC/B,CAAC,SAAS,SAAS,UAAU,EAAE,GAAG,SAAS,UAAU,EAAE,EAEvD,GAAG,EAAE,QAAQ,EACb,WAAW,EAAE,OAAO,EACpB,KAAK,CAAC,EAAE,CAAC,GACR,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE;IAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAAC,CAAC,CAAA"}
@@ -35,12 +35,13 @@ async function parseStream(req, contentType = 'application/octet-stream', allow)
35
35
  if (typeof contentType !== 'string') {
36
36
  throw (0, http_errors_1.default)(400, 'Invalid content-type');
37
37
  }
38
- const parser = parser_js_1.parsers.find((parser) => allow?.includes(parser.name) !== false && parser.test(contentType));
38
+ const type = (0, parser_js_1.parseContentType)(contentType);
39
+ const parser = parser_js_1.parsers.find((parser) => allow?.includes(parser.name) !== false && parser.test(type.mime));
39
40
  if (!parser) {
40
41
  throw (0, http_errors_1.default)(400, 'Unsupported content-type');
41
42
  }
42
43
  const buffer = await readStream(req);
43
- return parser.parse(buffer);
44
+ return parser.parse(buffer, type);
44
45
  }
45
46
  exports.parseStream = parseStream;
46
47
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../src/lib/http/stream.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAmD;AACnD,yCAAuD;AAEvD,8DAAyC;AAEzC,2CAOoB;AAEb,KAAK,UAAU,UAAU,CAAC,GAAa;IAC5C,MAAM,MAAM,GAAa,EAAE,CAAA;IAC3B,IAAI,WAAW,GAAG,CAAC,CAAA;IACnB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,EAAE,CAAC;QAC9B,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAClB,WAAW,IAAI,KAAK,CAAC,MAAM,CAAA;IAC7B,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAC3C,CAAC;AARD,gCAQC;AAED,SAAgB,YAAY,CAC1B,GAAa,EACb,WAAmB,UAAU;IAE7B,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,SAAS;YACZ,OAAO,GAAG,CAAC,OAAO,CAAC,IAAA,yBAAa,GAAE,CAAC,CAAA;QACrC,KAAK,MAAM;YACT,OAAO,GAAG,CAAC,OAAO,CAAC,IAAA,wBAAY,GAAE,CAAC,CAAA;QACpC,KAAK,UAAU;YACb,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,yBAAW,EAAE,CAAC,CAAA;QACvC;YACE,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,8BAA8B,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC;AAdD,oCAcC;AAmBM,KAAK,UAAU,WAAW,CAC/B,GAAa,EACb,cAAuB,0BAA0B,EACjD,KAAgB;IAEhB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,sBAAsB,CAAC,CAAA;IACpD,CAAC;IAED,MAAM,MAAM,GAAG,mBAAO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,yBAAW,EAAE,CAAC,CAAA;QACvC;YACE,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,8BAA8B,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC;AAdD,oCAcC;AAmBM,KAAK,UAAU,WAAW,CAC/B,GAAa,EACb,cAAuB,0BAA0B,EACjD,KAAgB;IAEhB,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;QACpC,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,sBAAsB,CAAC,CAAA;IACpD,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,4BAAgB,EAAC,WAAW,CAAC,CAAA;IAE1C,MAAM,MAAM,GAAG,mBAAO,CAAC,IAAI,CACzB,CAAC,MAAM,EAAE,EAAE,CACT,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CACnE,CAAA;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAA,qBAAe,EAAC,GAAG,EAAE,0BAA0B,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,CAAA;IACpC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;AACnC,CAAC;AAtBD,kCAsBC"}
@@ -1,7 +1,6 @@
1
1
  import { Keyset } from '@atproto/jwk';
2
2
  import { OAuthAuthorizationServerMetadata } from '@atproto/oauth-types';
3
3
  export type CustomMetadata = {
4
- claims_supported?: string[];
5
4
  scopes_supported?: string[];
6
5
  authorization_details_types_supported?: string[];
7
6
  protected_resources?: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"build-metadata.d.ts","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAA;AAMvE,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,qCAAqC,CAAC,EAAE,MAAM,EAAE,CAAA;IAChD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B,CAAA;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,cAAc,GAC9B,gCAAgC,CAiJlC"}
1
+ {"version":3,"file":"build-metadata.d.ts","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAA;AAKvE,MAAM,MAAM,cAAc,GAAG;IAC3B,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,qCAAqC,CAAC,EAAE,MAAM,EAAE,CAAA;IAChD,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B,CAAA;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,cAAc,CAAC,EAAE,cAAc,GAC9B,gCAAgC,CAoGlC"}
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildMetadata = void 0;
4
4
  const client_js_1 = require("../client/client.js");
5
- const claims_js_1 = require("../oidc/claims.js");
6
5
  const crypto_js_1 = require("../lib/util/crypto.js");
7
6
  /**
8
7
  * @see {@link https://datatracker.ietf.org/doc/html/rfc8414#section-2}
@@ -12,30 +11,10 @@ function buildMetadata(issuer, keyset, customMetadata) {
12
11
  return {
13
12
  issuer,
14
13
  scopes_supported: [
15
- 'offline_access',
16
- 'openid',
17
- 'email',
18
- 'phone',
19
- 'profile',
14
+ 'atproto',
15
+ //
20
16
  ...(customMetadata?.scopes_supported ?? []),
21
17
  ],
22
- claims_supported: [
23
- /* IESG (Always provided) */
24
- 'sub', // did
25
- 'iss', // Authorization Server Origin
26
- 'aud',
27
- 'exp',
28
- 'iat',
29
- 'jti',
30
- 'client_id',
31
- /* OpenID */
32
- // 'acr', // "0"
33
- // 'amr',
34
- // 'azp',
35
- 'auth_time', // number - seconds since epoch
36
- 'nonce', // always required in "id_token", why would it not be supported?
37
- ...(customMetadata?.claims_supported ?? claims_js_1.OIDC_STANDARD_CLAIMS),
38
- ],
39
18
  subject_types_supported: [
40
19
  //
41
20
  'public', // The same "sub" is returned for all clients
@@ -44,14 +23,14 @@ function buildMetadata(issuer, keyset, customMetadata) {
44
23
  response_types_supported: [
45
24
  // OAuth
46
25
  'code',
47
- 'token',
26
+ // 'token',
48
27
  // OpenID
49
- 'none',
50
- 'code id_token token',
51
- 'code id_token',
52
- 'code token',
53
- 'id_token token',
54
- 'id_token',
28
+ // 'none',
29
+ // 'code id_token token',
30
+ // 'code id_token',
31
+ // 'code token',
32
+ // 'id_token token',
33
+ // 'id_token',
55
34
  ],
56
35
  response_modes_supported: [
57
36
  // https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes
@@ -74,7 +53,6 @@ function buildMetadata(issuer, keyset, customMetadata) {
74
53
  //
75
54
  'en-US',
76
55
  ],
77
- id_token_signing_alg_values_supported: [...keyset.signAlgorithms],
78
56
  display_values_supported: [
79
57
  //
80
58
  'page',
@@ -88,9 +66,6 @@ function buildMetadata(issuer, keyset, customMetadata) {
88
66
  request_object_signing_alg_values_supported: [...crypto_js_1.VERIFY_ALGOS, 'none'],
89
67
  request_object_encryption_alg_values_supported: [], // None
90
68
  request_object_encryption_enc_values_supported: [], // None
91
- // No claim makes sense to be translated
92
- claims_locales_supported: [],
93
- claims_parameter_supported: true,
94
69
  request_parameter_supported: true,
95
70
  request_uri_parameter_supported: true,
96
71
  require_request_uri_registration: true,
@@ -100,25 +75,10 @@ function buildMetadata(issuer, keyset, customMetadata) {
100
75
  token_endpoint_auth_methods_supported: [...client_js_1.Client.AUTH_METHODS_SUPPORTED],
101
76
  token_endpoint_auth_signing_alg_values_supported: [...crypto_js_1.VERIFY_ALGOS],
102
77
  revocation_endpoint: new URL('/oauth/revoke', issuer).href,
103
- revocation_endpoint_auth_methods_supported: [
104
- ...client_js_1.Client.AUTH_METHODS_SUPPORTED,
105
- ],
106
- revocation_endpoint_auth_signing_alg_values_supported: [...crypto_js_1.VERIFY_ALGOS],
107
78
  introspection_endpoint: new URL('/oauth/introspect', issuer).href,
108
- introspection_endpoint_auth_methods_supported: [
109
- ...client_js_1.Client.AUTH_METHODS_SUPPORTED,
110
- ],
111
- introspection_endpoint_auth_signing_alg_values_supported: [...crypto_js_1.VERIFY_ALGOS],
112
- userinfo_endpoint: new URL('/oauth/userinfo', issuer).href,
113
79
  // end_session_endpoint: new URL('/oauth/logout', issuer).href,
114
80
  // https://datatracker.ietf.org/doc/html/rfc9126#section-5
115
81
  pushed_authorization_request_endpoint: new URL('/oauth/par', issuer).href,
116
- pushed_authorization_request_endpoint_auth_methods_supported: [
117
- ...client_js_1.Client.AUTH_METHODS_SUPPORTED,
118
- ],
119
- pushed_authorization_request_endpoint_auth_signing_alg_values_supported: [
120
- ...crypto_js_1.VERIFY_ALGOS,
121
- ],
122
82
  require_pushed_authorization_requests: true,
123
83
  // https://datatracker.ietf.org/doc/html/rfc9449#section-5.1
124
84
  dpop_signing_alg_values_supported: [...crypto_js_1.VERIFY_ALGOS],
@@ -1 +1 @@
1
- {"version":3,"file":"build-metadata.js","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":";;;AAGA,mDAA4C;AAC5C,iDAAwD;AACxD,qDAAoD;AASpD;;;GAGG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,MAAc,EACd,cAA+B;IAE/B,OAAO;QACL,MAAM;QAEN,gBAAgB,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BAAY,CAAC;QAEpD,6DAA6D;QAC7D,qCAAqC,EACnC,cAAc,EAAE,qCAAqC;QAEvD,wFAAwF;QACxF,mBAAmB,EAAE,cAAc,EAAE,mBAAmB;QAExD,kIAAkI;QAClI,qCAAqC,EAAE,IAAI;KAC5C,CAAA;AACH,CAAC;AArJD,sCAqJC"}
1
+ {"version":3,"file":"build-metadata.js","sourceRoot":"","sources":["../../src/metadata/build-metadata.ts"],"names":[],"mappings":";;;AAGA,mDAA4C;AAC5C,qDAAoD;AAQpD;;;GAGG;AACH,SAAgB,aAAa,CAC3B,MAAc,EACd,MAAc,EACd,cAA+B;IAE/B,OAAO;QACL,MAAM;QAEN,gBAAgB,EAAE;YAChB,SAAS;YACT,EAAE;YACF,GAAG,CAAC,cAAc,EAAE,gBAAgB,IAAI,EAAE,CAAC;SAC5C;QACD,uBAAuB,EAAE;YACvB,EAAE;YACF,QAAQ,EAAE,6CAA6C;YACvD,+DAA+D;SAChE;QACD,wBAAwB,EAAE;YACxB,QAAQ;YACR,MAAM;YACN,WAAW;YAEX,SAAS;YACT,UAAU;YACV,yBAAyB;YACzB,mBAAmB;YACnB,gBAAgB;YAChB,oBAAoB;YACpB,cAAc;SACf;QACD,wBAAwB,EAAE;YACxB,mFAAmF;YACnF,OAAO;YACP,UAAU;YACV,0FAA0F;YAC1F,WAAW;SACZ;QACD,qBAAqB,EAAE;YACrB,EAAE;YACF,oBAAoB;YACpB,eAAe;SAChB;QACD,gCAAgC,EAAE;YAChC,sGAAsG;YACtG,MAAM;YACN,OAAO;SACR;QACD,oBAAoB,EAAE;YACpB,EAAE;YACF,OAAO;SACR;QACD,wBAAwB,EAAE;YACxB,EAAE;YACF,MAAM;YACN,OAAO;YACP,OAAO;YACP,aAAa;SACd;QAED,gDAAgD;QAChD,8CAA8C,EAAE,IAAI;QAEpD,0DAA0D;QAC1D,2CAA2C,EAAE,CAAC,GAAG,wBAAY,EAAE,MAAM,CAAC;QACtE,8CAA8C,EAAE,EAAE,EAAE,OAAO;QAC3D,8CAA8C,EAAE,EAAE,EAAE,OAAO;QAE3D,2BAA2B,EAAE,IAAI;QACjC,+BAA+B,EAAE,IAAI;QACrC,gCAAgC,EAAE,IAAI;QAEtC,QAAQ,EAAE,IAAI,GAAG,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,IAAI;QAE7C,sBAAsB,EAAE,IAAI,GAAG,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,IAAI;QAEhE,cAAc,EAAE,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,IAAI;QACpD,qCAAqC,EAAE,CAAC,GAAG,kBAAM,CAAC,sBAAsB,CAAC;QACzE,gDAAgD,EAAE,CAAC,GAAG,wBAAY,CAAC;QAEnE,mBAAmB,EAAE,IAAI,GAAG,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,IAAI;QAE1D,sBAAsB,EAAE,IAAI,GAAG,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC,IAAI;QAEjE,+DAA+D;QAE/D,0DAA0D;QAC1D,qCAAqC,EAAE,IAAI,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,IAAI;QAEzE,qCAAqC,EAAE,IAAI;QAE3C,4DAA4D;QAC5D,iCAAiC,EAAE,CAAC,GAAG,wBAAY,CAAC;QAEpD,6DAA6D;QAC7D,qCAAqC,EACnC,cAAc,EAAE,qCAAqC;QAEvD,wFAAwF;QACxF,mBAAmB,EAAE,cAAc,EAAE,mBAAmB;QAExD,kIAAkI;QAClI,qCAAqC,EAAE,IAAI;KAC5C,CAAA;AACH,CAAC;AAxGD,sCAwGC"}
@@ -5,8 +5,9 @@ import { ClientAuth } from './client/client-auth.js';
5
5
  import { ClientId } from './client/client-id.js';
6
6
  import { ClientInfo } from './client/client-info.js';
7
7
  import { Client } from './client/client.js';
8
+ import { InvalidAuthorizationDetailsError } from './errors/invalid-authorization-details-error.js';
8
9
  import { Awaitable } from './lib/util/type.js';
9
- export type { Account, Client, ClientAuth, ClientId, ClientInfo, Jwks, OAuthAuthenticationRequestParameters, OAuthAuthorizationDetails, OAuthClientMetadata, OAuthTokenResponse, };
10
+ export type { Account, Client, ClientAuth, ClientId, ClientInfo, InvalidAuthorizationDetailsError, Jwks, OAuthAuthenticationRequestParameters, OAuthAuthorizationDetails, OAuthClientMetadata, OAuthTokenResponse, };
10
11
  export type OAuthHooks = {
11
12
  /**
12
13
  * Use this to alter, override or validate the client metadata & jwks returned
@@ -21,7 +22,7 @@ export type OAuthHooks = {
21
22
  }) => Awaitable<void | undefined | Partial<ClientInfo>>;
22
23
  /**
23
24
  * Allows enriching the authorization details with additional information
24
- * before the tokens are issued.
25
+ * when the tokens are issued.
25
26
  *
26
27
  * @see {@link https://datatracker.ietf.org/doc/html/rfc9396 | RFC 9396}
27
28
  */
@@ -30,13 +31,5 @@ export type OAuthHooks = {
30
31
  parameters: OAuthAuthenticationRequestParameters;
31
32
  account: Account;
32
33
  }) => Awaitable<undefined | OAuthAuthorizationDetails>;
33
- /**
34
- * Allows altering the token response before it is sent to the client.
35
- */
36
- onTokenResponse?: (tokenResponse: OAuthTokenResponse, data: {
37
- client: Client;
38
- parameters: OAuthAuthenticationRequestParameters;
39
- account: Account;
40
- }) => Awaitable<void>;
41
34
  };
42
35
  //# sourceMappingURL=oauth-hooks.d.ts.map