@openstax/ts-utils 1.37.1-hotfix → 1.37.1-hotfix2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import { VerifyConfig } from 'http-message-signatures';
3
3
  import { JWK } from 'node-jose';
4
4
  import { ConfigProviderForConfig } from '../../config';
5
5
  type Config = {
6
+ apiHost: string;
6
7
  bypassSignatureVerification: string;
7
8
  };
8
9
  interface Initializer<C> {
@@ -12,6 +12,7 @@ const helpers_1 = require("../../misc/helpers");
12
12
  const jwks_1 = require("../../misc/jwks");
13
13
  const createHttpMessageVerifier = ({ configSpace, fetcher }) => (configProvider) => {
14
14
  const config = configProvider[configSpace !== null && configSpace !== void 0 ? configSpace : 'verifier'];
15
+ const getApiHost = (0, helpers_1.once)(async () => await (0, config_1.resolveConfigValue)(config.apiHost));
15
16
  const getBypassSignatureVerification = (0, helpers_1.once)(async () => (await (0, config_1.resolveConfigValue)(config.bypassSignatureVerification)) === 'true');
16
17
  return ({ request }) => ({
17
18
  verify: async ({ configOverride, signatureAgentVerifier }) => {
@@ -44,8 +45,7 @@ const createHttpMessageVerifier = ({ configSpace, fetcher }) => (configProvider)
44
45
  body,
45
46
  headers,
46
47
  method: requestContext.http.method,
47
- // Node's request.url is really just the path and querystring
48
- url: requestContext.http.path,
48
+ url: `${await getApiHost()}${requestContext.http.path}${request.rawQueryString ? `?${request.rawQueryString}` : ''}`,
49
49
  };
50
50
  if (!await http_message_signatures_1.httpbis.verifyMessage({
51
51
  all: true,