Skip to content

Commit

Permalink
fixed input as input instead of whole token.
Browse files Browse the repository at this point in the history
  • Loading branch information
msgadi committed Dec 13, 2024
1 parent f507195 commit 70d73d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function verify(
throw e
}

const { header, payload, signature } = decoded
const { header, payload, signature, input } = decoded
const cacheContext = {
cache,
token,
Expand All @@ -309,7 +309,7 @@ function verify(
try {
verifyToken(key, decoded, validationContext)

return cacheSet(cacheContext, complete ? { header, payload, signature, input: token } : payload)
return cacheSet(cacheContext, complete ? { header, payload, signature, input } : payload)
} catch (e) {
throw cacheSet(cacheContext, e)
}
Expand Down
2 changes: 1 addition & 1 deletion test/verifier.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test('it correctly verifies a token - sync', t => {
header: { typ: 'JWT', alg: 'HS256' },
payload: { a: 1 },
signature: '57TF7smP9XDhIexBqPC-F1toZReYZLWb_YRU5tv0sxM',
input: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxfQ.57TF7smP9XDhIexBqPC-F1toZReYZLWb_YRU5tv0sxM'
input: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoxfQ'
}
)

Expand Down

0 comments on commit 70d73d6

Please sign in to comment.