lib/jwt.js
function rsaVerify (input, algorithm, publicSecret, signature) {
  try {
    // verify with rsa_public_key.pem
    const verify = crypto.createVerify(algorithm).update(input).verify(
      publicSecret,
      base64URLUnescape(signature),
      'base64'
    )
    if (!verify) {
      errorMap['006'].message = 'Unvalid public secret for rsa verify, signature verification failed'
      errorMap['006'].error = new Error(errorMap['006'].message)
    }
    return verify
  } catch (e) {
    errorMap['006'].message = 'Exception error in rsa verify, signature verification failed'
    errorMap['006'].error = e
    return false
  }
}
function rsaVerify (input, algorithm, publicSecret, signature) {
  try {
    // verify with rsa_public_key.pem
    const verify = crypto.createVerify(algorithm).update(input).verify(
      publicSecret,
      base64URLUnescape(signature),
      'base64'
    )
    if (!verify) {
      errorMap['006'].message = 'Unvalid public secret for rsa verify, signature verification failed'
      errorMap['006'].error = new Error(errorMap['006'].message)
    }
    return verify
  } catch (e) {
    errorMap['006'].message = 'Exception error in rsa verify, signature verification failed'
    errorMap['006'].error = e
    return false
  }
}
function rsaVerify ( input , algorithm , publicSecret , signature ) { try { // verify with rsa_public_key.pem const verify = crypto . createVerify ( algorithm ) . update ( input ) . verify ( publicSecret , base64URLUnescape ( signature ) , 'base64' ) if ( ! verify ) { errorMap [ '006' ] . message = 'Unvalid public secret for rsa verify, signature verification failed' errorMap [ '006' ] . error = new Error ( errorMap [ '006' ] . message ) } return verify } catch ( e ) { errorMap [ '006' ] . message = 'Exception error in rsa verify, signature verification failed' errorMap [ '006' ] . error = e return false } }
rsa verify signature
@param  {String} input            rsa verify input
@param  {String} algorithm        rsa verify algorithm
@param  {String} publicSecret     rsa verify secret
@param  {String} signature        rsa verify signature
@return {Object}                  rsa verify result
rsa verify signature