getPayload(data, version) {
    if (data.length === 0) {
      return false;
    }

    // Try to decrypt data first.
    try {
      if (!this.cipher) {
        throw new Error('Missing key or version in constructor.');
      }

      data = this.cipher.decrypt(data, version);
    } catch (_) {
      data = data.toString('utf8');
    }

    // Incoming 3.5 data isn't 0 because of iv and tag so check size after
    if (version === '3.5') {
      if (data.length === 0) {
        return false;
      }
    }

    // Try to parse data as JSON.
    // If error, return as string.
    if (typeof data === 'string') {
      try {
        data = JSON.parse(data);
      } catch (_) { }
    }

    return data;
  }
Attempts to decode a given payload into
an object or string.
@param {Buffer} data to decode
@param {String} version of protocol
@returns {Object|String}
object if payload is JSON, otherwise string