module JWT::Algos::HmacRbNaClFixed

def verify(algorithm, key, signing_input, signature)

def verify(algorithm, key, signing_input, signature)
  key ||= ''
  raise JWT::DecodeError, 'HMAC key expected to be a String' unless key.is_a?(String)
  if (hmac = resolve_algorithm(algorithm)) && key.bytesize <= hmac.key_bytes
    hmac.verify(padded_key_bytes(key, hmac.key_bytes), signature.encode('binary'), signing_input.encode('binary'))
  else
    Hmac.verify(algorithm, key, signing_input, signature)
  end
rescue ::RbNaCl::BadAuthenticatorError
  false
end