Skip to content

Commit

Permalink
chore: move cache context object where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
ilteoood committed Nov 13, 2024
1 parent 9a481fc commit 0ab5fec
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions src/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,6 @@ function verify(
) {
const [callback, promise] = isAsync ? ensurePromiseCallback(cb) : []

const cacheContext = {
cache,
token,
cacheTTL,
errorCacheTTL,
payload: undefined,
ignoreExpiration,
ignoreNotBefore,
maxAge,
clockTimestamp,
clockTolerance
}

// Check the cache
if (cache) {
const [value, min, max] = cache.get(hashToken(token)) || [undefined, 0, 0]
Expand Down Expand Up @@ -297,7 +284,18 @@ function verify(
}

const { header, payload, signature } = decoded
cacheContext.payload = payload
const cacheContext = {
cache,
token,
cacheTTL,
errorCacheTTL,
ignoreExpiration,
ignoreNotBefore,
maxAge,
clockTimestamp,
clockTolerance,
payload
}
const validationContext = { validators, allowedAlgorithms, checkTyp, clockTimestamp, clockTolerance, requiredClaims }

// We have the key
Expand Down

0 comments on commit 0ab5fec

Please sign in to comment.