function decode(data) {
  const buffer = Buffer.from(decodeURIComponent(data), "base64");

  const payload = decodeProtobuf(buffer);

  if (payload.version != "1") {
    console.error(`Expected payload version 1, but was ${payload.version}! Please comment your payload version (which is ${payload.version}), Google Authenticator app version and how many 2FA codes you exported in https://github.com/krissrex/google-authenticator-exporter/issues/23 .`)
  }

  const accounts = payload.otpParameters.map(account => {
    account.totpSecret = toBase32(account.secret);
    return account;
  })

  return accounts;
}
The data in the URI from Google Authenticator
 is a protobuff payload which is Base64 encoded and then URI encoded.
This function decodes those, and then decodes the protobuf data contained inside.

@param {String} data the `data` query parameter from the totp migration string that google authenticator outputs.