@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> {
@@ -9,6 +9,7 @@ import { once } from '../../misc/helpers';
9
9
  import { getJwksClient } from '../../misc/jwks';
10
10
  export const createHttpMessageVerifier = ({ configSpace, fetcher }) => (configProvider) => {
11
11
  const config = configProvider[configSpace !== null && configSpace !== void 0 ? configSpace : 'verifier'];
12
+ const getApiHost = once(async () => await resolveConfigValue(config.apiHost));
12
13
  const getBypassSignatureVerification = once(async () => (await resolveConfigValue(config.bypassSignatureVerification)) === 'true');
13
14
  return ({ request }) => ({
14
15
  verify: async ({ configOverride, signatureAgentVerifier }) => {
@@ -41,8 +42,7 @@ export const createHttpMessageVerifier = ({ configSpace, fetcher }) => (configPr
41
42
  body,
42
43
  headers,
43
44
  method: requestContext.http.method,
44
- // Node's request.url is really just the path and querystring
45
- url: requestContext.http.path,
45
+ url: `${await getApiHost()}${requestContext.http.path}${request.rawQueryString ? `?${request.rawQueryString}` : ''}`,
46
46
  };
47
47
  if (!await httpbis.verifyMessage({
48
48
  all: true,