Skip to content

Commit

Permalink
fix: removed valid var
Browse files Browse the repository at this point in the history
  • Loading branch information
ilteoood committed Nov 13, 2024
1 parent 0e211ae commit b7289ce
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/verifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,17 @@ function exactStringClaimMatcher(allowed, actual) {
}

function checkAreCompatibleAlgorithms(expected, actual) {
let valid = false

for (const expectedAlg of expected) {
valid = actual.indexOf(expectedAlg) !== -1

// if at least one of the expected algorithms is compatible we're done
if (valid) {
break
if (actual.includes(expectedAlg)) {
return
}
}

if (!valid) {
throw new TokenError(
TokenError.codes.invalidKey,
`Invalid public key provided for algorithms ${expected.join(', ')}.`
)
}
throw new TokenError(
TokenError.codes.invalidKey,
`Invalid public key provided for algorithms ${expected.join(', ')}.`
)
}

function prepareKeyOrSecret(key, isSecret) {
Expand Down

0 comments on commit b7289ce

Please sign in to comment.