function toHex (buffer) {
  const byteArray = new Uint8Array(buffer)
  const hexString = Array.from(byteArray, byte => byte.toString(16).padStart(2, '0')).join('')
  return hexString
}
Convert a buffer to a hex string
@param {*} buffer - the buffer to convert
@returns {string} - the hex string