Skip to content

Commit

Permalink
chore: unique if
Browse files Browse the repository at this point in the history
  • Loading branch information
ilteoood committed Nov 13, 2024
1 parent b7289ce commit e895a87
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,8 @@ function verifyToken(
validateAlgorithmAndSignature(input, header, signature, key, allowedAlgorithms)

// Verify typ
if (checkTyp) {
if (typeof header.typ !== 'string' || checkTyp !== header.typ.toLowerCase().replace(/^application\//, '')) {
throw new TokenError(TokenError.codes.invalidType, 'Invalid typ.')
}
if (checkTyp && (typeof header.typ !== 'string' || checkTyp !== header.typ.toLowerCase().replace(/^application\//, ''))) {
throw new TokenError(TokenError.codes.invalidType, 'Invalid typ.')
}

// Verify the payload
Expand Down

0 comments on commit e895a87

Please sign in to comment.