fastify-txstate 3.6.1 → 3.6.2

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.
@@ -12,6 +12,7 @@ const issuerKeys = new Map();
12
12
  const issuerConfig = new Map();
13
13
  const trustedClients = new Set();
14
14
  const uaCookieName = process.env.UA_COOKIE_NAME ?? (0, crypto_1.randomBytes)(16).toString('hex');
15
+ const uaCookieNameRegex = new RegExp(`${uaCookieName}=([^;]+)`);
15
16
  const tokenCache = new txstate_utils_1.Cache(async (token, req) => {
16
17
  const claims = (0, jose_1.decodeJwt)(token);
17
18
  let verifyKey;
@@ -69,9 +70,7 @@ function processIssuerConfig(config) {
69
70
  if (config.iss === 'unified-auth') {
70
71
  const validateUrl = (0, txstate_utils_1.isNotBlank)(config.validateUrl)
71
72
  ? new URL(config.validateUrl, config.url)
72
- : (0, txstate_utils_1.isNotBlank)(process.env.UA_URL)
73
- ? new URL(process.env.UA_URL + '/validateToken')
74
- : new URL('validateToken', config.url);
73
+ : new URL('validateToken', config.url);
75
74
  const logoutUrl = (0, txstate_utils_1.isNotBlank)(config.logoutUrl)
76
75
  ? new URL(config.logoutUrl, config.url)
77
76
  : (0, txstate_utils_1.isNotBlank)(process.env.UA_URL)
@@ -113,7 +112,7 @@ function tokenFromReq(req) {
113
112
  const m = req?.headers.authorization?.match(/^bearer (.*)$/i);
114
113
  if (m != null)
115
114
  return m[1];
116
- const m2 = req?.headers.cookie?.match(new RegExp(`${uaCookieName}=([^;]+)`));
115
+ const m2 = req?.headers.cookie?.match(uaCookieNameRegex);
117
116
  if (m2 != null)
118
117
  return m2[1];
119
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastify-txstate",
3
- "version": "3.6.1",
3
+ "version": "3.6.2",
4
4
  "description": "A small wrapper for fastify providing a set of common conventions & utility functions we use.",
5
5
  "exports": {
6
6
  ".": {