Skip to content

Commit

Permalink
Replace tilde-indexOf with includes (#647)
Browse files Browse the repository at this point in the history
* Replace tilde-indexOf with includes

* remove package lock
  • Loading branch information
dviryamin authored Feb 10, 2020
1 parent a6235fa commit 88cb9df
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) {
}

if (!options.algorithms) {
options.algorithms = ~secretOrPublicKey.toString().indexOf('BEGIN CERTIFICATE') ||
~secretOrPublicKey.toString().indexOf('BEGIN PUBLIC KEY') ? PUB_KEY_ALGS :
~secretOrPublicKey.toString().indexOf('BEGIN RSA PUBLIC KEY') ? RSA_KEY_ALGS : HS_ALGS;
options.algorithms = secretOrPublicKey.toString().includes('BEGIN CERTIFICATE') ||
secretOrPublicKey.toString().includes('BEGIN PUBLIC KEY') ? PUB_KEY_ALGS :
secretOrPublicKey.toString().includes('BEGIN RSA PUBLIC KEY') ? RSA_KEY_ALGS : HS_ALGS;

}

Expand Down

0 comments on commit 88cb9df

Please sign in to comment.